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 2019/11/15 02:41:09 UTC

[james-project] branch master updated (2e87e12 -> fa6f51b)

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

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


    from 2e87e12  JAMES-2905 One more option about HostNameVerifier
     new 8440e83  JAMES-2704 Solve major performance issue for RandomStoring mailet
     new 9ab4f51  JAMES-2704 Improve ReroutingInformation
     new 21fd593  JAMES-2704 RandomStoringTest should have a per method lifecycle
     new 463f11a  JAMES-2704 RandomStoring should use james Iterators util for stream conversion
     new fa72fb4  JAMES-2704 do the mapping to a Rerouting infos only for not already discovered value
     new 49ad1cb  JAMES-2704 close smtp connection in tests
     new f5de467  [Refactoring] AbstractMailboxProcessor response methods should accept IMAP request
     new e928083  [Refactoring] processMessage rename
     new cf1288a  [Refactoring] processMessage tag and command are already specified in the request
     new d091eb3  [Refactoring] Merge some AbstractMailboxProcessor process methods
     new 8f14db3  [Refactoring] processMessage rename
     new e7188da  [Refactoring] Rename Message to Request in IMAP processor
     new 6520ebd  [Refactoring] Moving tests in mailbox.acl to JUnit 5
     new 180b19d  [Refactoring] Moving tests in mailbox.extractor to JUnit 5
     new f84dd3d  [Refactoring] Moving tests in mailbox.indexer to JUnit 5
     new 03af48a  [Refactoring] Moving tests in mailbox.manager to JUnit 5
     new 4b8a7a2  [Refactoring] Moving tests in mailbox.model.search to JUnit 5
     new 70265a4  [Refactoring] Moving tests in mailbox.model to JUnit 5
     new 07651c0  [Refactoring] Moving remaining tests in mailbox api to JUnit 5
     new c21d5f8  [Refactoring] Fix softly assertions coding style on backend-cassandra module
     new c0c2cde  MAILBOX-392 Rework slightly UserMailboxesService
     new 2f882d4  MAILBOX-392 Strengthen MailboxName validation
     new 071c8c3  [Refactoring] move code from AbstractMailRepository to FileMailRepository
     new ca3555e  [Refactoring] Set.add is idempotent in case of entry already present
     new e2d41e3  [Refactoring] update variable is always true
     new 8226d09  [Refactoring] replace some System.out by a logger
     new 6eab755  [Refactoring] replace Iterator by Stream in API
     new 35fbc89  [Refactoring] finally drop {un,}lock methods from MailRepository interface
     new 08a36f0  [Refactoring] Remove some unused methods in mailbox-store
     new fa6f51b  [Refactoring] Move remaining abstract test classes in mailbox api and their implementations to JUnit 5

The 30 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:
 .../cassandra/init/CassandraConfigurationTest.java |  29 +-
 .../apache/james/mailbox/model/MailboxPath.java    |  31 ++-
 .../mailbox/AbstractSubscriptionManagerTest.java   |  20 +-
 .../james/mailbox/ApplicableFlagBuilderTest.java   |  68 +++--
 .../james/mailbox/ComposedMessageIdTest.java       |   6 +-
 .../apache/james/mailbox/MailboxExceptionTest.java |  96 +++----
 .../james/mailbox/MailboxManagerStressTest.java    |   6 +-
 .../apache/james/mailbox/MailboxManagerTest.java   |   4 +-
 .../apache/james/mailbox/MessageMoveEventTest.java |  38 ++-
 .../org/apache/james/mailbox/MessageUidTest.java   |  21 +-
 .../java/org/apache/james/mailbox/RoleTest.java    |  56 ++--
 .../org/apache/james/mailbox/acl/ACLDiffTest.java  |  34 +--
 .../mailbox/acl/PositiveUserACLChangedTest.java    |   6 +-
 .../james/mailbox/acl/PositiveUserACLDiffTest.java |  46 +--
 .../acl/SimpleGroupMembershipResolverTest.java     |  18 +-
 .../mailbox/acl/UnionMailboxACLResolverTest.java   |  26 +-
 .../james/mailbox/extractor/ParsedContentTest.java |   6 +-
 .../indexer/ReindexingExecutionFailuresTest.java   |   2 +-
 .../mailbox/indexer/ReindexingFailureTest.java     |   2 +-
 .../mailbox/manager/QuotaMessageManagerTest.java   |  66 +++--
 .../james/mailbox/model/AttachmentIdTest.java      |  18 +-
 .../apache/james/mailbox/model/AttachmentTest.java |  83 +++---
 .../org/apache/james/mailbox/model/BlobIdTest.java |  16 +-
 .../org/apache/james/mailbox/model/BlobTest.java   |  14 +-
 .../org/apache/james/mailbox/model/CidTest.java    | 130 +++++----
 .../model/ComposedMessageIdWithMetaDataTest.java   |  52 ++--
 .../mailbox/model/MailboxACLEntryKeyTest.java      |  45 ++-
 .../apache/james/mailbox/model/MailboxACLTest.java |  46 +--
 .../mailbox/model/MailboxAnnotationKeyTest.java    | 128 +++++----
 .../james/mailbox/model/MailboxAnnotationTest.java |  36 ++-
 .../james/mailbox/model/MailboxAssertTests.java    |  49 ++--
 .../james/mailbox/model/MailboxCountersTest.java   |   6 +-
 .../james/mailbox/model/MailboxPathTest.java       | 106 +++++--
 .../james/mailbox/model/MessageAttachmentTest.java |  35 +--
 .../james/mailbox/model/MessageIdDtoTest.java      |  17 +-
 .../james/mailbox/model/MessageRangeTest.java      | 309 ++++++++++-----------
 .../model/MultimailboxesSearchQueryTest.java       |  30 +-
 .../org/apache/james/mailbox/model/QuotaTest.java  |  28 +-
 .../james/mailbox/model/Rfc4314RightsTest.java     |  83 +++---
 .../james/mailbox/model/SearchQueryTest.java       |   8 +-
 .../james/mailbox/model/UpdatedFlagsTest.java      |  30 +-
 .../james/mailbox/model/search/ExactNameTest.java  |  16 +-
 .../mailbox/model/search/MailboxQueryTest.java     |  70 ++---
 .../mailbox/model/search/PrefixedRegexTest.java    | 232 ++++++++--------
 .../mailbox/model/search/PrefixedWildcardTest.java |  18 +-
 .../james/mailbox/model/search/WildcardTest.java   |  14 +-
 .../cassandra/CassandraMailboxManagerProvider.java |   2 +-
 .../CassandraMailboxManagerStressTest.java         |  33 +--
 .../CassandraSubscriptionManagerTest.java          |  34 ++-
 .../cassandra/mail/CassandraMapperProvider.java    |   6 -
 .../mailbox/jpa/JPASubscriptionManagerTest.java    |  18 +-
 .../mailbox/jpa/JpaMailboxManagerStressTest.java   |  15 +-
 .../james/mailbox/jpa/mail/JPAMapperProvider.java  |   6 -
 .../DomainUserMaildirMailboxManagerStressTest.java |  20 +-
 .../FullUserMaildirMailboxManagerStressTest.java   |  20 +-
 .../maildir/MaildirSubscriptionManagerTest.java    |  19 +-
 .../UserMaildirMailboxManagerStressTest.java       |  20 +-
 .../inmemory/InMemoryMessageManagerTestSystem.java |  28 --
 .../inmemory/MemoryMailboxManagerStressTest.java   |  11 +-
 .../inmemory/mail/InMemoryMapperProvider.java      |   6 -
 .../manager/InMemoryIntegrationResources.java      |   2 +-
 .../src/main/resources/META-INF/spring/quota.xml   |   1 -
 .../james/mailbox/store/FakeAuthenticator.java     |   4 -
 .../james/mailbox/store/StoreMailboxManager.java   |  17 +-
 .../james/mailbox/store/StoreMessageIdManager.java |   8 -
 .../james/mailbox/store/StoreMessageManager.java   |  11 -
 .../model/MailboxIdDeserialisationException.java   |   3 -
 .../mail/model/impl/SimpleMailboxMessage.java      |  12 -
 .../store/mail/model/impl/SimpleMessage.java       |   6 -
 .../mailbox/store/quota/FixedMaxQuotaManager.java  |   4 -
 .../james/mailbox/store/quota/QuotaComponents.java |  11 +-
 .../store/streaming/LimitingFileInputStream.java   |  13 -
 .../apache/james/mailbox/store/MessageBuilder.java |   1 -
 .../mailbox/store/MessageManagerTestSystem.java    |   1 -
 .../mailbox/store/SimpleMailboxMembership.java     |   5 -
 .../mailbox/store/mail/model/MapperProvider.java   |   2 -
 .../cassandra/host/CassandraHostSystem.java        |   2 +-
 .../mpt/imapmailbox/jpa/host/JPAHostSystem.java    |   2 +-
 .../imap/processor/AbstractAuthProcessor.java      |  32 +--
 .../imap/processor/AbstractMailboxProcessor.java   |  59 ++--
 .../processor/AbstractMessageRangeProcessor.java   |  18 +-
 .../imap/processor/AbstractSelectionProcessor.java |  29 +-
 .../processor/AbstractSubscriptionProcessor.java   |  18 +-
 .../james/imap/processor/AppendProcessor.java      |  32 +--
 .../imap/processor/AuthenticateProcessor.java      |  23 +-
 .../james/imap/processor/CapabilityProcessor.java  |   8 +-
 .../james/imap/processor/CheckProcessor.java       |   8 +-
 .../james/imap/processor/CloseProcessor.java       |  10 +-
 .../apache/james/imap/processor/CopyProcessor.java |   8 +-
 .../james/imap/processor/CreateProcessor.java      |  16 +-
 .../james/imap/processor/DeleteACLProcessor.java   |  30 +-
 .../james/imap/processor/DeleteProcessor.java      |  16 +-
 .../james/imap/processor/EnableProcessor.java      |  12 +-
 .../james/imap/processor/ExamineProcessor.java     |  16 +-
 .../james/imap/processor/ExpungeProcessor.java     |  18 +-
 .../james/imap/processor/GetACLProcessor.java      |  24 +-
 .../imap/processor/GetAnnotationProcessor.java     |  36 ++-
 .../james/imap/processor/GetQuotaProcessor.java    |  18 +-
 .../imap/processor/GetQuotaRootProcessor.java      |  22 +-
 .../apache/james/imap/processor/IdleProcessor.java |   8 +-
 .../apache/james/imap/processor/LSubProcessor.java |  14 +-
 .../apache/james/imap/processor/ListProcessor.java |  14 +-
 .../james/imap/processor/ListRightsProcessor.java  |  28 +-
 .../james/imap/processor/LoginProcessor.java       |  12 +-
 .../james/imap/processor/LogoutProcessor.java      |  10 +-
 .../apache/james/imap/processor/MoveProcessor.java |   8 +-
 .../james/imap/processor/MyRightsProcessor.java    |  20 +-
 .../james/imap/processor/NamespaceProcessor.java   |   8 +-
 .../apache/james/imap/processor/NoopProcessor.java |   6 +-
 .../james/imap/processor/RenameProcessor.java      |  20 +-
 .../james/imap/processor/SearchProcessor.java      |  18 +-
 .../james/imap/processor/SetACLProcessor.java      |  34 ++-
 .../imap/processor/SetAnnotationProcessor.java     |  29 +-
 .../james/imap/processor/SetQuotaProcessor.java    |  14 +-
 .../james/imap/processor/StatusProcessor.java      |  15 +-
 .../james/imap/processor/StoreProcessor.java       |  19 +-
 .../james/imap/processor/SubscribeProcessor.java   |   8 +-
 .../james/imap/processor/UnselectProcessor.java    |  10 +-
 .../james/imap/processor/UnsubscribeProcessor.java |   8 +-
 .../james/imap/processor/fetch/FetchProcessor.java |  22 +-
 .../james/imap/processor/LSubProcessorTest.java    |   8 +-
 .../james/imap/processor/SearchProcessorTest.java  |   2 +-
 .../mailrepository/file/FileMailRepository.java    | 161 ++++++++---
 .../mailrepository/jdbc/JDBCMailRepository.java    |  18 --
 .../mailrepository/lib/AbstractMailRepository.java | 164 -----------
 .../james/repository/api/ObjectRepository.java     |   4 +-
 .../james/repository/api/StreamRepository.java     |   4 +-
 .../repository/file/AbstractFileRepository.java    |   8 +-
 .../apache/james/smtp/SmtpRandomStoringTest.java   |  56 ++--
 .../james/transport/mailets/RandomStoring.java     |  48 ++--
 .../james/mailrepository/api/MailRepository.java   |  11 -
 .../cassandra/CassandraMailRepository.java         |  10 -
 .../memory/MemoryMailRepository.java               |  11 +-
 .../webadmin/service/UserMailboxesService.java     |  10 +-
 134 files changed, 1803 insertions(+), 2033 deletions(-)
 delete mode 100644 server/data/data-library/src/main/java/org/apache/james/mailrepository/lib/AbstractMailRepository.java


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


[james-project] 27/30: [Refactoring] replace Iterator by Stream in API

Posted by bt...@apache.org.
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 6eab7556b22b86ccf092e3cfa8f995d21a871f69
Author: Matthieu Baechler <ma...@apache.org>
AuthorDate: Wed Nov 13 16:36:32 2019 +0100

    [Refactoring] replace Iterator by Stream in API
---
 .../mailrepository/file/FileMailRepository.java    | 40 +++++++++-------------
 .../james/repository/api/ObjectRepository.java     |  4 +--
 .../james/repository/api/StreamRepository.java     |  4 +--
 .../repository/file/AbstractFileRepository.java    |  8 ++---
 4 files changed, 24 insertions(+), 32 deletions(-)

diff --git a/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java b/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java
index 8d71e69..93107f8 100644
--- a/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java
+++ b/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java
@@ -27,6 +27,8 @@ import java.util.Collections;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 import javax.annotation.PostConstruct;
 import javax.inject.Inject;
@@ -51,7 +53,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.github.fge.lambdas.Throwing;
-import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Iterators;
 
 /**
@@ -152,14 +153,9 @@ public class FileMailRepository implements MailRepository, Configurable, Initial
             }
 
             // Finds non-matching pairs and deletes the extra files
-            HashSet<String> streamKeys = new HashSet<>();
-            for (Iterator<String> i = streamRepository.list(); i.hasNext(); ) {
-                streamKeys.add(i.next());
-            }
-            HashSet<String> objectKeys = new HashSet<>();
-            for (Iterator<String> i = objectRepository.list(); i.hasNext(); ) {
-                objectKeys.add(i.next());
-            }
+
+            HashSet<String> streamKeys = streamRepository.list().collect(Collectors.toCollection(HashSet::new));
+            HashSet<String> objectKeys = objectRepository.list().collect(Collectors.toCollection(HashSet::new));
 
             @SuppressWarnings("unchecked")
             Collection<String> strandedStreams = (Collection<String>) streamKeys.clone();
@@ -181,9 +177,7 @@ public class FileMailRepository implements MailRepository, Configurable, Initial
                 // Next get a list from the object repository
                 // and use that for the list of keys
                 keys.clear();
-                for (Iterator<String> i = objectRepository.list(); i.hasNext(); ) {
-                    keys.add(i.next());
-                }
+                objectRepository.list().forEach(keys::add);
             }
             LOGGER.debug("{} created in {}", getClass().getName(), destination);
         } catch (Exception e) {
@@ -313,9 +307,7 @@ public class FileMailRepository implements MailRepository, Configurable, Initial
 
     @Override
     public void remove(Collection<Mail> mails) throws MessagingException {
-        for (Mail mail : mails) {
-            remove(mail);
-        }
+        mails.forEach(Throwing.<Mail>consumer(this::remove).sneakyThrow());
     }
 
     @Override
@@ -338,7 +330,7 @@ public class FileMailRepository implements MailRepository, Configurable, Initial
 
     @Override
     public void removeAll() {
-        ImmutableList.copyOf(list())
+        listStream()
             .forEach(Throwing.<MailKey>consumer(this::remove).sneakyThrow());
     }
 
@@ -352,6 +344,11 @@ public class FileMailRepository implements MailRepository, Configurable, Initial
 
     @Override
     public Iterator<MailKey> list() {
+        return listStream()
+            .iterator();
+    }
+
+    private Stream<MailKey> listStream() {
         // Fix ConcurrentModificationException by cloning
         // the keyset before getting an iterator
         final ArrayList<String> clone;
@@ -360,17 +357,14 @@ public class FileMailRepository implements MailRepository, Configurable, Initial
                 clone = new ArrayList<>(keys);
             }
         } else {
-            clone = new ArrayList<>();
-            for (Iterator<String> i = objectRepository.list(); i.hasNext(); ) {
-                clone.add(i.next());
-            }
+            clone = objectRepository.list().collect(Collectors.toCollection(ArrayList::new));
         }
         if (fifo) {
             Collections.sort(clone); // Keys is a HashSet; impose FIFO for apps
         }
         // that need it
-        return clone.stream()
-            .map(MailKey::new)
-            .iterator();
+        return clone
+            .stream()
+            .map(MailKey::new);
     }
 }
diff --git a/server/data/data-library/src/main/java/org/apache/james/repository/api/ObjectRepository.java b/server/data/data-library/src/main/java/org/apache/james/repository/api/ObjectRepository.java
index 3ed3661..d4631bd 100644
--- a/server/data/data-library/src/main/java/org/apache/james/repository/api/ObjectRepository.java
+++ b/server/data/data-library/src/main/java/org/apache/james/repository/api/ObjectRepository.java
@@ -19,7 +19,7 @@
 
 package org.apache.james.repository.api;
 
-import java.util.Iterator;
+import java.util.stream.Stream;
 
 public interface ObjectRepository extends Repository {
 
@@ -29,7 +29,7 @@ public interface ObjectRepository extends Repository {
 
     Object get(String key, ClassLoader loader);
 
-    Iterator<String> list();
+    Stream<String> list();
 
     void put(String key, Object value);
 
diff --git a/server/data/data-library/src/main/java/org/apache/james/repository/api/StreamRepository.java b/server/data/data-library/src/main/java/org/apache/james/repository/api/StreamRepository.java
index b6d6065..4358aa9 100644
--- a/server/data/data-library/src/main/java/org/apache/james/repository/api/StreamRepository.java
+++ b/server/data/data-library/src/main/java/org/apache/james/repository/api/StreamRepository.java
@@ -21,13 +21,13 @@ package org.apache.james.repository.api;
 
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.util.Iterator;
+import java.util.stream.Stream;
 
 public interface StreamRepository extends Repository {
 
     InputStream get(String key);
 
-    Iterator<String> list();
+    Stream<String> list();
 
     OutputStream put(String key);
 
diff --git a/server/data/data-library/src/main/java/org/apache/james/repository/file/AbstractFileRepository.java b/server/data/data-library/src/main/java/org/apache/james/repository/file/AbstractFileRepository.java
index 5f8d22f..23486c9 100644
--- a/server/data/data-library/src/main/java/org/apache/james/repository/file/AbstractFileRepository.java
+++ b/server/data/data-library/src/main/java/org/apache/james/repository/file/AbstractFileRepository.java
@@ -28,7 +28,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.Arrays;
-import java.util.Iterator;
+import java.util.stream.Stream;
 
 import javax.annotation.PostConstruct;
 import javax.inject.Inject;
@@ -283,13 +283,11 @@ public abstract class AbstractFileRepository implements Repository, Configurable
     /**
      * Returns the list of used keys.
      */
-    public Iterator<String> list() {
+    public Stream<String> list() {
         final File storeDir = new File(baseDirectory.getAbsolutePath());
         final String[] names = storeDir.list(filter);
 
-        return Arrays.stream(names)
-            .map(this::decode)
-            .iterator();
+        return Arrays.stream(names).map(this::decode);
     }
 
     /**


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


[james-project] 17/30: [Refactoring] Moving tests in mailbox.model.search to JUnit 5

Posted by bt...@apache.org.
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 4b8a7a278e7fc428fadcab399fd768dd7ad7f29a
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Mon Nov 11 16:22:57 2019 +0700

    [Refactoring] Moving tests in mailbox.model.search to JUnit 5
---
 .../james/mailbox/model/search/ExactNameTest.java  |  16 +-
 .../mailbox/model/search/MailboxQueryTest.java     |  70 +++----
 .../mailbox/model/search/PrefixedRegexTest.java    | 232 ++++++++++-----------
 .../mailbox/model/search/PrefixedWildcardTest.java |  18 +-
 .../james/mailbox/model/search/WildcardTest.java   |  14 +-
 5 files changed, 175 insertions(+), 175 deletions(-)

diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/search/ExactNameTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/search/ExactNameTest.java
index 94ca305..77979a8 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/search/ExactNameTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/search/ExactNameTest.java
@@ -22,7 +22,7 @@ package org.apache.james.mailbox.model.search;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
 
@@ -30,43 +30,43 @@ public class ExactNameTest {
     public static final String NAME = "toto";
 
     @Test
-    public void shouldMatchBeanContract() {
+    void shouldMatchBeanContract() {
         EqualsVerifier.forClass(ExactName.class)
             .verify();
     }
 
     @Test
-    public void constructorShouldThrowOnNullName() {
+    void constructorShouldThrowOnNullName() {
         assertThatThrownBy(() -> new ExactName(null))
             .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void isWildShouldReturnFalse() {
+    void isWildShouldReturnFalse() {
         assertThat(new ExactName(NAME).isWild())
             .isFalse();
     }
 
     @Test
-    public void getCombinedNameShouldReturnName() {
+    void getCombinedNameShouldReturnName() {
         assertThat(new ExactName(NAME).getCombinedName())
             .isEqualTo(NAME);
     }
 
     @Test
-    public void isExpressionMatchShouldReturnTrueWhenName() {
+    void isExpressionMatchShouldReturnTrueWhenName() {
         assertThat(new ExactName(NAME).isExpressionMatch(NAME))
             .isTrue();
     }
 
     @Test
-    public void isExpressionMatchShouldReturnFalseWhenOtherValue() {
+    void isExpressionMatchShouldReturnFalseWhenOtherValue() {
         assertThat(new ExactName(NAME).isExpressionMatch("other"))
             .isFalse();
     }
 
     @Test
-    public void isExpressionMatchShouldThrowOnNullValue() {
+    void isExpressionMatchShouldThrowOnNullValue() {
         assertThatThrownBy(() -> new ExactName(NAME).isExpressionMatch(null))
             .isInstanceOf(NullPointerException.class);
     }
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/search/MailboxQueryTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/search/MailboxQueryTest.java
index 4f87989..664fa4c 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/search/MailboxQueryTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/search/MailboxQueryTest.java
@@ -21,33 +21,34 @@
 package org.apache.james.mailbox.model.search;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatCode;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mailbox.model.search.MailboxQuery.Builder;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
 
-public class MailboxQueryTest {
+class MailboxQueryTest {
     private static final String CURRENT_USER = "user";
 
     private MailboxPath mailboxPath;
 
-    @Before
-    public void setUp() {
+    @BeforeEach
+    void setUp() {
         mailboxPath = new MailboxPath("namespace", "user", "name");
     }
 
     @Test
-    public void shouldMatchBeanContract() {
+    void shouldMatchBeanContract() {
         EqualsVerifier.forClass(MailboxQuery.class)
             .verify();
     }
 
     @Test
-    public void buildShouldMatchAllValuesWhenMatchesAll() throws Exception {
-
+    void buildShouldMatchAllValuesWhenMatchesAll() {
         MailboxQuery actual = MailboxQuery.builder()
                 .userAndNamespaceFrom(mailboxPath)
                 .matchesAllMailboxNames()
@@ -57,7 +58,7 @@ public class MailboxQueryTest {
     }
 
     @Test
-    public void buildShouldConstructMailboxPathWhenPrivateUserMailboxes() throws Exception {
+    void buildShouldConstructMailboxPathWhenPrivateUserMailboxes() {
         MailboxPath expected = MailboxPath.forUser("user", "");
 
         MailboxQuery actual = MailboxQuery.builder()
@@ -71,7 +72,7 @@ public class MailboxQueryTest {
     }
 
     @Test
-    public void buildShouldMatchAllValuesWhenPrivateUserMailboxes() throws Exception {
+    void buildShouldMatchAllValuesWhenPrivateUserMailboxes() {
         Builder testee = MailboxQuery.builder()
                 .username("user")
                 .privateNamespace();
@@ -82,42 +83,41 @@ public class MailboxQueryTest {
     }
 
     @Test
-    public void builderShouldNotThrowWhenNoBaseDefined() throws Exception {
+    void builderShouldNotThrowWhenNoBaseDefined() {
         Builder testee = MailboxQuery.builder()
                 .expression(new ExactName("abc"));
 
-        testee.build();
+        assertThatCode(testee::build)
+            .doesNotThrowAnyException();
     }
 
-    @Test(expected = IllegalStateException.class)
-    public void builderShouldThrowWhenBaseAndUsernameGiven() throws Exception {
-        Builder testee = MailboxQuery.builder()
+    @Test
+    void builderShouldThrowWhenBaseAndUsernameGiven() {
+        assertThatThrownBy(() -> MailboxQuery.builder()
                 .userAndNamespaceFrom(mailboxPath)
-                .username("user");
-
-        testee.build();
+                .username("user"))
+            .isInstanceOf(IllegalStateException.class);
     }
 
-    @Test(expected = IllegalStateException.class)
-    public void builderShouldThrowWhenBaseGiven() throws Exception {
-        Builder testee = MailboxQuery.builder()
+    @Test
+    void builderShouldThrowWhenBaseGiven() {
+        assertThatThrownBy(() -> MailboxQuery.builder()
                 .userAndNamespaceFrom(mailboxPath)
-                .privateNamespace();
-
-        testee.build();
+                .privateNamespace())
+            .isInstanceOf(IllegalStateException.class);
     } 
 
     @Test
-    public void builderShouldNotThrowWhenMissingUsername() throws Exception {
+    void builderShouldNotThrowWhenMissingUsername() {
         Builder testee = MailboxQuery.builder()
                 .privateNamespace();
 
-        testee.build();
+        assertThatCode(testee::build)
+            .doesNotThrowAnyException();
     }
 
     @Test
-    public void builderShouldUseBaseWhenGiven() throws Exception {
-
+    void builderShouldUseBaseWhenGiven() {
         MailboxQuery actual = MailboxQuery.builder()
                 .userAndNamespaceFrom(mailboxPath)
                 .build();
@@ -128,7 +128,7 @@ public class MailboxQueryTest {
     }
 
     @Test
-    public void belongsToNamespaceAndUserShouldReturnTrueWithIdenticalMailboxes() {
+    void belongsToNamespaceAndUserShouldReturnTrueWithIdenticalMailboxes() {
         MailboxQuery mailboxQuery = MailboxQuery.builder()
             .userAndNamespaceFrom(mailboxPath)
             .build();
@@ -138,7 +138,7 @@ public class MailboxQueryTest {
     }
 
     @Test
-    public void belongsToNamespaceAndUserShouldReturnTrueWithIdenticalMailboxesWithNullNamespace() {
+    void belongsToNamespaceAndUserShouldReturnTrueWithIdenticalMailboxesWithNullNamespace() {
         MailboxPath mailboxPath = new MailboxPath(null, "user", "name");
 
         MailboxQuery mailboxQuery = MailboxQuery.builder()
@@ -150,7 +150,7 @@ public class MailboxQueryTest {
     }
 
     @Test
-    public void belongsToNamespaceAndUserShouldReturnTrueWithMailboxWithSameNamespaceAndUser() {
+    void belongsToNamespaceAndUserShouldReturnTrueWithMailboxWithSameNamespaceAndUser() {
         MailboxQuery mailboxQuery = MailboxQuery.builder()
             .userAndNamespaceFrom(new MailboxPath("namespace", CURRENT_USER, "name"))
             .build();
@@ -160,7 +160,7 @@ public class MailboxQueryTest {
     }
 
     @Test
-    public void belongsToNamespaceAndUserShouldReturnFalseWithDifferentNamespace() {
+    void belongsToNamespaceAndUserShouldReturnFalseWithDifferentNamespace() {
         MailboxQuery mailboxQuery = MailboxQuery.builder()
             .userAndNamespaceFrom(new MailboxPath("namespace", CURRENT_USER, "name"))
             .build();
@@ -170,7 +170,7 @@ public class MailboxQueryTest {
     }
 
     @Test
-    public void belongsToNamespaceAndUserShouldReturnFalseWithDifferentUser() {
+    void belongsToNamespaceAndUserShouldReturnFalseWithDifferentUser() {
         MailboxQuery mailboxQuery = MailboxQuery.builder()
             .userAndNamespaceFrom(new MailboxPath("namespace", CURRENT_USER, "name"))
             .build();
@@ -178,9 +178,9 @@ public class MailboxQueryTest {
         assertThat(mailboxQuery.belongsToRequestedNamespaceAndUser(new MailboxPath("namespace", CURRENT_USER + "2", "name")))
             .isFalse();
     }
-    
+
     @Test
-    public void belongsToNamespaceAndUserShouldReturnFalseWhenDifferentUser() {
+    void belongsToNamespaceAndUserShouldReturnFalseWhenDifferentUser() {
         MailboxQuery mailboxQuery = MailboxQuery.builder()
             .userAndNamespaceFrom(new MailboxPath("namespace", CURRENT_USER, "name"))
             .build();
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/search/PrefixedRegexTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/search/PrefixedRegexTest.java
index 6092e05..517eb72 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/search/PrefixedRegexTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/search/PrefixedRegexTest.java
@@ -21,11 +21,11 @@ package org.apache.james.mailbox.model.search;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
 
-public class PrefixedRegexTest {
+class PrefixedRegexTest {
     private static final char PATH_DELIMITER = '.';
     private static final String PREFIX = "name";
     private static final String EMPTY_PREFIX = "";
@@ -38,7 +38,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isWildShouldReturnTrueWhenOnlyFreeWildcard() throws Exception {
+    void isWildShouldReturnTrueWhenOnlyFreeWildcard() {
         PrefixedRegex prefixedRegex = new PrefixedRegex(PREFIX, "*", PATH_DELIMITER);
 
         boolean actual = prefixedRegex.isWild();
@@ -47,7 +47,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isWildShouldReturnTrueWhenOnlyLocalWildcard() throws Exception {
+    void isWildShouldReturnTrueWhenOnlyLocalWildcard() {
         PrefixedRegex prefixedRegex = new PrefixedRegex(PREFIX, "%", PATH_DELIMITER);
 
         boolean actual = prefixedRegex.isWild();
@@ -56,7 +56,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isWildShouldReturnTrueWhenFreeWildcardAtBeginning() throws Exception {
+    void isWildShouldReturnTrueWhenFreeWildcardAtBeginning() {
         PrefixedRegex prefixedRegex = new PrefixedRegex(PREFIX, "*One", PATH_DELIMITER);
 
         boolean actual = prefixedRegex.isWild();
@@ -65,7 +65,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isWildShouldReturnTrueWhenLocalWildcardAtBeginning() throws Exception {
+    void isWildShouldReturnTrueWhenLocalWildcardAtBeginning() {
         PrefixedRegex prefixedRegex = new PrefixedRegex(PREFIX, "%One", PATH_DELIMITER);
 
         boolean actual = prefixedRegex.isWild();
@@ -74,7 +74,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isWildShouldReturnTrueWhenFreeWildcardInMiddle() throws Exception {
+    void isWildShouldReturnTrueWhenFreeWildcardInMiddle() {
         PrefixedRegex prefixedRegex = new PrefixedRegex(PREFIX, "A*A", PATH_DELIMITER);
 
         boolean actual = prefixedRegex.isWild();
@@ -83,7 +83,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isWildShouldReturnTrueWhenLocalWildcardInMiddle() throws Exception {
+    void isWildShouldReturnTrueWhenLocalWildcardInMiddle() {
         PrefixedRegex prefixedRegex = new PrefixedRegex(PREFIX, "A%A", PATH_DELIMITER);
 
         boolean actual = prefixedRegex.isWild();
@@ -92,7 +92,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isWildShouldReturnTrueWhenFreeWildcardAtEnd() throws Exception {
+    void isWildShouldReturnTrueWhenFreeWildcardAtEnd() {
         PrefixedRegex prefixedRegex = new PrefixedRegex(PREFIX, "One*", PATH_DELIMITER);
 
         boolean actual = prefixedRegex.isWild();
@@ -101,7 +101,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isWildShouldReturnTrueWhenLocalWildcardAtEnd() throws Exception {
+    void isWildShouldReturnTrueWhenLocalWildcardAtEnd() {
         PrefixedRegex prefixedRegex = new PrefixedRegex(PREFIX, "One%", PATH_DELIMITER);
 
         boolean actual = prefixedRegex.isWild();
@@ -110,7 +110,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isWildShouldReturnFalseWhenEmptyExpression() throws Exception {
+    void isWildShouldReturnFalseWhenEmptyExpression() {
         PrefixedRegex prefixedRegex = new PrefixedRegex(PREFIX, "", PATH_DELIMITER);
 
         boolean actual = prefixedRegex.isWild();
@@ -119,7 +119,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isWildShouldReturnFalseWhenNullExpression() throws Exception {
+    void isWildShouldReturnFalseWhenNullExpression() {
         PrefixedRegex prefixedRegex = new PrefixedRegex(PREFIX, null, PATH_DELIMITER);
 
         boolean actual = prefixedRegex.isWild();
@@ -128,7 +128,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isWildShouldReturnFalseWhenNoWildcard() throws Exception {
+    void isWildShouldReturnFalseWhenNoWildcard() {
         PrefixedRegex prefixedRegex = new PrefixedRegex(PREFIX, "ONE", PATH_DELIMITER);
 
         boolean actual = prefixedRegex.isWild();
@@ -137,7 +137,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void getCombinedNameShouldWork() throws Exception {
+    void getCombinedNameShouldWork() {
         PrefixedRegex prefixedRegex = new PrefixedRegex(PREFIX, "mailbox", PATH_DELIMITER);
 
         String actual = prefixedRegex.getCombinedName();
@@ -146,7 +146,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void getCombinedNameShouldWorkWhenEmptyExpression() throws Exception {
+    void getCombinedNameShouldWorkWhenEmptyExpression() {
         PrefixedRegex prefixedRegex = new PrefixedRegex(PREFIX, "", PATH_DELIMITER);
 
         String actual = prefixedRegex.getCombinedName();
@@ -155,7 +155,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void getCombinedNameShouldReturnEmptyStringWhenNullMailboxPathAndExpression() throws Exception {
+    void getCombinedNameShouldReturnEmptyStringWhenNullMailboxPathAndExpression() {
         String prefix = null;
         String regex = null;
         PrefixedRegex prefixedRegex = new PrefixedRegex(prefix, regex, PATH_DELIMITER);
@@ -166,7 +166,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void getCombinedNameShouldIgnoreDelimiterWhenPresentAtBeginningOfExpression() throws Exception {
+    void getCombinedNameShouldIgnoreDelimiterWhenPresentAtBeginningOfExpression() {
         PrefixedRegex prefixedRegex = new PrefixedRegex(PREFIX, ".mailbox", PATH_DELIMITER);
 
         String actual = prefixedRegex.getCombinedName();
@@ -175,7 +175,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void getCombinedNameShouldIgnoreDelimiterWhenPresentAtEndOfMailboxName() throws Exception {
+    void getCombinedNameShouldIgnoreDelimiterWhenPresentAtEndOfMailboxName() {
         PrefixedRegex prefixedRegex = new PrefixedRegex(PREFIX + ".", ".mailbox", PATH_DELIMITER);
 
         String actual = prefixedRegex.getCombinedName();
@@ -184,7 +184,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldReturnFalseWhenNullExpression() throws Exception {
+    void isExpressionMatchShouldReturnFalseWhenNullExpression() {
         PrefixedRegex testee = new PrefixedRegex(PREFIX, null, PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("folder");
@@ -193,7 +193,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchFolderWhenMatching() throws Exception {
+    void isExpressionMatchShouldMatchFolderWhenMatching() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("mailbox");
@@ -202,7 +202,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldReturnFalseWhenNameBeginsWithDelimiter() throws Exception {
+    void isExpressionMatchShouldReturnFalseWhenNameBeginsWithDelimiter() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch(".mailbox");
@@ -211,7 +211,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldReturnFalseWhenNameEndsWithDelimiter() throws Exception {
+    void isExpressionMatchShouldReturnFalseWhenNameEndsWithDelimiter() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("mailbox.");
@@ -220,7 +220,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchFolderWhenNoMatching() throws Exception {
+    void isExpressionMatchShouldNotMatchFolderWhenNoMatching() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub");
@@ -229,7 +229,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchFolderWithExpandedEndName() throws Exception {
+    void isExpressionMatchShouldNotMatchFolderWithExpandedEndName() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("mailbox123");
@@ -238,7 +238,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchSubFolder() throws Exception {
+    void isExpressionMatchShouldNotMatchSubFolder() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("mailbox.123");
@@ -247,7 +247,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldReturnTrueWhenEmptyNameAndExpression() throws Exception {
+    void isExpressionMatchShouldReturnTrueWhenEmptyNameAndExpression() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("");
@@ -256,7 +256,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldReturnFalseWhenEmptyExpressionAndNameBeginsWithDelimiter() throws Exception {
+    void isExpressionMatchShouldReturnFalseWhenEmptyExpressionAndNameBeginsWithDelimiter() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch(".123");
@@ -265,7 +265,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchFolderWhenEmptyExpression() throws Exception {
+    void isExpressionMatchShouldNotMatchFolderWhenEmptyExpression() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("folder");
@@ -274,7 +274,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldReturnTrueWhenEmptyNameAndOnlyLocalWildcard() throws Exception {
+    void isExpressionMatchShouldReturnTrueWhenEmptyNameAndOnlyLocalWildcard() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "%", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("");
@@ -283,7 +283,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldReturnTrueWhenOnlyLocalWildcard() throws Exception {
+    void isExpressionMatchShouldReturnTrueWhenOnlyLocalWildcard() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "%", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("folder");
@@ -292,7 +292,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchSubFolderWhenOnlyLocalWildcard() throws Exception {
+    void isExpressionMatchShouldNotMatchSubFolderWhenOnlyLocalWildcard() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "%", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("mailbox.sub");
@@ -301,7 +301,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldReturnTrueWhenEmptyNameAndOnlyFreeWildcard() throws Exception {
+    void isExpressionMatchShouldReturnTrueWhenEmptyNameAndOnlyFreeWildcard() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "*", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("");
@@ -310,7 +310,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchFolderWhenOnlyFreeWildcard() throws Exception {
+    void isExpressionMatchShouldMatchFolderWhenOnlyFreeWildcard() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "*", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub");
@@ -319,7 +319,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchSubFolderWhenOnlyFreeWildcard() throws Exception {
+    void isExpressionMatchShouldMatchSubFolderWhenOnlyFreeWildcard() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "*", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("mailbox.sub");
@@ -328,7 +328,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldReturnFalseWhenEmptyNameAndLocalWildcardAtEnd() throws Exception {
+    void isExpressionMatchShouldReturnFalseWhenEmptyNameAndLocalWildcardAtEnd() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "mailbox%", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("");
@@ -337,7 +337,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldReturnFalseWhenLocalWildcardAtEndAndNoMatching() throws Exception {
+    void isExpressionMatchShouldReturnFalseWhenLocalWildcardAtEndAndNoMatching() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "mailbox%", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub");
@@ -346,7 +346,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchFolderWhenLocalWildcardAtEndNotUsed() throws Exception {
+    void isExpressionMatchShouldMatchFolderWhenLocalWildcardAtEndNotUsed() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "mailbox%", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("mailbox");
@@ -355,7 +355,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldReturnTrueWhenLocalWildcardAtEndUsed() throws Exception {
+    void isExpressionMatchShouldReturnTrueWhenLocalWildcardAtEndUsed() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "mailbox%", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("mailboxsub");
@@ -364,7 +364,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchSubFolderWhenLocalWildcardAtEnd() throws Exception {
+    void isExpressionMatchShouldNotMatchSubFolderWhenLocalWildcardAtEnd() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "mailbox%", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("mailbox.sub");
@@ -373,7 +373,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldReturnFalseWhenEmptyNameAndLocalWildcardAtBeginning() throws Exception {
+    void isExpressionMatchShouldReturnFalseWhenEmptyNameAndLocalWildcardAtBeginning() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "%mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("");
@@ -382,7 +382,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchFolderWhenLocalWildcardAtBeginningAndNoMatching() throws Exception {
+    void isExpressionMatchShouldNotMatchFolderWhenLocalWildcardAtBeginningAndNoMatching() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "%mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub");
@@ -391,7 +391,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchFolderWhenLocalWildcardAtBeginningNotUsed() throws Exception {
+    void isExpressionMatchShouldMatchFolderWhenLocalWildcardAtBeginningNotUsed() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "%mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("mailbox");
@@ -400,7 +400,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchFolderWhenLocalWildcardAtBeginningUsed() throws Exception {
+    void isExpressionMatchShouldMatchFolderWhenLocalWildcardAtBeginningUsed() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "%mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("submailbox");
@@ -409,7 +409,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchSubFolderWhenLocalWildcardAtBeginning() throws Exception {
+    void isExpressionMatchShouldNotMatchSubFolderWhenLocalWildcardAtBeginning() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "%mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub.mailbox");
@@ -418,7 +418,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchDeeplyNestedFolderWhenLocalWildcardAtBeginning() throws Exception {
+    void isExpressionMatchShouldNotMatchDeeplyNestedFolderWhenLocalWildcardAtBeginning() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "%mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub.mailbox.sub");
@@ -427,7 +427,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldReturnFalseWhenEmptyNameAndLocalWildcardInMiddle() throws Exception {
+    void isExpressionMatchShouldReturnFalseWhenEmptyNameAndLocalWildcardInMiddle() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub%mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("");
@@ -436,7 +436,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldReturnFalseWhenLocalWildcardInMiddleAndMissingEndName() throws Exception {
+    void isExpressionMatchShouldReturnFalseWhenLocalWildcardInMiddleAndMissingEndName() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub%mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub");
@@ -445,7 +445,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchFolderWhenLocalWildcardInMiddleAndMatching() throws Exception {
+    void isExpressionMatchShouldMatchFolderWhenLocalWildcardInMiddleAndMatching() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub%mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("submailbox");
@@ -454,7 +454,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchFolderWhenLocalWildcardInMiddle() throws Exception {
+    void isExpressionMatchShouldMatchFolderWhenLocalWildcardInMiddle() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub%mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub123mailbox");
@@ -463,7 +463,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchSubFolderWhenLocalWildcardInMiddle() throws Exception {
+    void isExpressionMatchShouldNotMatchSubFolderWhenLocalWildcardInMiddle() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub%mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub.mailbox");
@@ -472,7 +472,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchSubFolderWhenLocalWildcardInMiddleAndExpandedMiddleName() throws Exception {
+    void isExpressionMatchShouldNotMatchSubFolderWhenLocalWildcardInMiddleAndExpandedMiddleName() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub%mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub.123mailbox");
@@ -481,7 +481,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldReturnFalseWhenLocalWildcardInMiddleAndMissingBeginningName() throws Exception {
+    void isExpressionMatchShouldReturnFalseWhenLocalWildcardInMiddleAndMissingBeginningName() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub%mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("mailbox");
@@ -490,7 +490,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchDeeplyNestedFolderWhenLocalWildcardInMiddle() throws Exception {
+    void isExpressionMatchShouldNotMatchDeeplyNestedFolderWhenLocalWildcardInMiddle() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub%mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("subw.hat.eve.rmailbox");
@@ -499,7 +499,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchSubFolderWhenFreeWildcardAtEnd() throws Exception {
+    void isExpressionMatchShouldMatchSubFolderWhenFreeWildcardAtEnd() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "mailbox*", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("mailbox.sub");
@@ -508,7 +508,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldReturnFalseWhenEmptyNameAndFreeWildcardAtEnd() throws Exception {
+    void isExpressionMatchShouldReturnFalseWhenEmptyNameAndFreeWildcardAtEnd() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "mailbox*", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("");
@@ -517,7 +517,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchFolderWhenFreeWildcardAtEndAndNoMatching() throws Exception {
+    void isExpressionMatchShouldNotMatchFolderWhenFreeWildcardAtEndAndNoMatching() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "mailbox*", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub");
@@ -526,7 +526,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchFolderWhenFreeWildcardAtEndNotUsed() throws Exception {
+    void isExpressionMatchShouldMatchFolderWhenFreeWildcardAtEndNotUsed() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "mailbox*", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("mailbox");
@@ -535,7 +535,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchFolderWhenFreeWildcardAtEndUsed() throws Exception {
+    void isExpressionMatchShouldMatchFolderWhenFreeWildcardAtEndUsed() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "mailbox*", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("mailbox123");
@@ -544,7 +544,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldReturnFalseWhenEmptyNameAndFreeWildcardAtBeginning() throws Exception {
+    void isExpressionMatchShouldReturnFalseWhenEmptyNameAndFreeWildcardAtBeginning() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "*mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("");
@@ -553,7 +553,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchFolderWhenFreeWildcardAtBeginningAndNoMatching() throws Exception {
+    void isExpressionMatchShouldNotMatchFolderWhenFreeWildcardAtBeginningAndNoMatching() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "*mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub");
@@ -562,7 +562,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchFolderWhenFreeWildcardAtBeginningNotUsed() throws Exception {
+    void isExpressionMatchShouldMatchFolderWhenFreeWildcardAtBeginningNotUsed() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "*mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("mailbox");
@@ -571,7 +571,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchFolderWhenFreeWildcardAtBeginningUsed() throws Exception {
+    void isExpressionMatchShouldMatchFolderWhenFreeWildcardAtBeginningUsed() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "*mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("submailbox");
@@ -580,7 +580,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchSubFolderWhenFreeWildcardAtBeginning() throws Exception {
+    void isExpressionMatchShouldMatchSubFolderWhenFreeWildcardAtBeginning() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "*mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub.mailbox");
@@ -589,7 +589,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldReturnFalseWhenEmptyNameAndFreeWildcardInMiddle() throws Exception {
+    void isExpressionMatchShouldReturnFalseWhenEmptyNameAndFreeWildcardInMiddle() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub*mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("");
@@ -598,7 +598,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchFolderWhenFreeWildcardInMiddleAndMissingEndName() throws Exception {
+    void isExpressionMatchShouldNotMatchFolderWhenFreeWildcardInMiddleAndMissingEndName() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub*mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub");
@@ -607,7 +607,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchFolderWhenFreeWildcardInMiddleNotUsed() throws Exception {
+    void isExpressionMatchShouldMatchFolderWhenFreeWildcardInMiddleNotUsed() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub*mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("submailbox");
@@ -616,7 +616,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchSubFolderWhenFreeWildcardInMiddle() throws Exception {
+    void isExpressionMatchShouldMatchSubFolderWhenFreeWildcardInMiddle() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub*mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub.mailbox");
@@ -625,7 +625,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldReturnFalseWhenFreeWildcardInMiddleNotUsedAndMissingBeginningName() throws Exception {
+    void isExpressionMatchShouldReturnFalseWhenFreeWildcardInMiddleNotUsedAndMissingBeginningName() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub*mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("mailbox");
@@ -634,7 +634,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchDeeplyNestedFolderWhenFreeWildcardInMiddle() throws Exception {
+    void isExpressionMatchShouldMatchDeeplyNestedFolderWhenFreeWildcardInMiddle() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub*mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("subw.hat.eve.rmailbox");
@@ -643,7 +643,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldReturnFalseWhenEmptyNameAndDoubleFreeWildcardInMiddle() throws Exception {
+    void isExpressionMatchShouldReturnFalseWhenEmptyNameAndDoubleFreeWildcardInMiddle() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub**mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("");
@@ -652,7 +652,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldReturnFalseWhenDoubleFreeWildcardInMiddleAndMissingEndName() throws Exception {
+    void isExpressionMatchShouldReturnFalseWhenDoubleFreeWildcardInMiddleAndMissingEndName() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub**mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub");
@@ -661,7 +661,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldReturnTrueWhenDoubleFreeWildcardInMiddleNotUsed() throws Exception {
+    void isExpressionMatchShouldReturnTrueWhenDoubleFreeWildcardInMiddleNotUsed() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub**mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("submailbox");
@@ -670,7 +670,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchSubFolderWhenDoubleFreeWildcardInMiddle() throws Exception {
+    void isExpressionMatchShouldMatchSubFolderWhenDoubleFreeWildcardInMiddle() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub**mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub.mailbox");
@@ -679,7 +679,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldReturnFalseWhenDoubleFreeWildcardInMiddleAndMissingBeginningName() throws Exception {
+    void isExpressionMatchShouldReturnFalseWhenDoubleFreeWildcardInMiddleAndMissingBeginningName() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub**mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("mailbox");
@@ -688,7 +688,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchDeeplyNestedFolderWhenDoubleFreeWildcardInMiddle() throws Exception {
+    void isExpressionMatchShouldMatchDeeplyNestedFolderWhenDoubleFreeWildcardInMiddle() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub**mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("subw.hat.eve.rmailbox");
@@ -697,7 +697,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldReturnFalseWhenEmptyNameAndFreeLocalWildcardInMiddle() throws Exception {
+    void isExpressionMatchShouldReturnFalseWhenEmptyNameAndFreeLocalWildcardInMiddle() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub*%mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("");
@@ -706,7 +706,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldReturnFalseWhenFreeLocalWildcardInMiddleAndMissingEndName() throws Exception {
+    void isExpressionMatchShouldReturnFalseWhenFreeLocalWildcardInMiddleAndMissingEndName() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub*%mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub");
@@ -715,7 +715,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchFolderWhenFreeLocalWildcardInMiddleNotUsed() throws Exception {
+    void isExpressionMatchShouldMatchFolderWhenFreeLocalWildcardInMiddleNotUsed() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub*%mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("submailbox");
@@ -724,7 +724,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchSubFolderWhenFreeLocalWildcardInMiddle() throws Exception {
+    void isExpressionMatchShouldMatchSubFolderWhenFreeLocalWildcardInMiddle() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub*%mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub.mailbox");
@@ -733,7 +733,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldReturnFalseWhenFreeLocalWildcardInMiddleAndMissingBeginningName() throws Exception {
+    void isExpressionMatchShouldReturnFalseWhenFreeLocalWildcardInMiddleAndMissingBeginningName() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub*%mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("mailbox");
@@ -742,7 +742,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchDeeplyNestedFolderWhenFreeLocalWildcardInMiddle() throws Exception {
+    void isExpressionMatchShouldMatchDeeplyNestedFolderWhenFreeLocalWildcardInMiddle() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub*%mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("subw.hat.eve.rmailbox");
@@ -751,7 +751,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldReturnFalseWhenEmptyNameAndLocalFreeWildcardInMiddle() throws Exception {
+    void isExpressionMatchShouldReturnFalseWhenEmptyNameAndLocalFreeWildcardInMiddle() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub%*mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("");
@@ -760,7 +760,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchFolderWhenLocalFreeWildcardInMiddleAndMissingEndName() throws Exception {
+    void isExpressionMatchShouldNotMatchFolderWhenLocalFreeWildcardInMiddleAndMissingEndName() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub%*mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub");
@@ -769,7 +769,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchFolderWhenLocalFreewildcardInMiddleNotUsed() throws Exception {
+    void isExpressionMatchShouldMatchFolderWhenLocalFreewildcardInMiddleNotUsed() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub%*mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("submailbox");
@@ -778,7 +778,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchSubFolderWhenLocalFreeWildcardInMiddle() throws Exception {
+    void isExpressionMatchShouldMatchSubFolderWhenLocalFreeWildcardInMiddle() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub%*mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub.mailbox");
@@ -787,7 +787,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchFolderWhenLocalFreeWildcardInMiddleAndMissingBeginningName() throws Exception {
+    void isExpressionMatchShouldNotMatchFolderWhenLocalFreeWildcardInMiddleAndMissingBeginningName() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub%*mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("mailbox");
@@ -796,7 +796,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchDeeplyNestedFolderWhenLocalFreeWildcardInMiddle() throws Exception {
+    void isExpressionMatchShouldMatchDeeplyNestedFolderWhenLocalFreeWildcardInMiddle() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub%*mailbox", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("subw.hat.eve.rmailbox");
@@ -805,7 +805,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchFolderWhenMultipleFreeWildcards() throws Exception {
+    void isExpressionMatchShouldMatchFolderWhenMultipleFreeWildcards() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub*mailbox*sub**", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("submailboxsub");
@@ -814,7 +814,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchDeeplyNestedFolderWhenMultipleFreeWildcardsNotUsed() throws Exception {
+    void isExpressionMatchShouldMatchDeeplyNestedFolderWhenMultipleFreeWildcardsNotUsed() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub*mailbox*sub**", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub.mailbox.sub");
@@ -823,7 +823,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchDeeplyNestedFolderWhenMultipleFreeWildcardsUsed() throws Exception {
+    void isExpressionMatchShouldMatchDeeplyNestedFolderWhenMultipleFreeWildcardsUsed() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub*mailbox*sub**", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("subtosh.boshmailboxtosh.boshsubboshtosh");
@@ -832,7 +832,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchDeeplyNestedFolderWhenMultipleFreeWildcardsAndMissingMiddleName() throws Exception {
+    void isExpressionMatchShouldNotMatchDeeplyNestedFolderWhenMultipleFreeWildcardsAndMissingMiddleName() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub*mailbox*sub**", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub.a.sub");
@@ -841,7 +841,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchDeeplyNestedFolderWhenMultipleFreeWildcardsAndMissingEndName() throws Exception {
+    void isExpressionMatchShouldNotMatchDeeplyNestedFolderWhenMultipleFreeWildcardsAndMissingEndName() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub*mailbox*sub**", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub.a.submailbox.u");
@@ -850,7 +850,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchDeeplyNestedFolderWhenMultipleFreeWildcardsAndMissingBeginningdName() throws Exception {
+    void isExpressionMatchShouldNotMatchDeeplyNestedFolderWhenMultipleFreeWildcardsAndMissingBeginningdName() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub*mailbox*sub**", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("utosh.boshmailboxtosh.boshsubasubboshtoshmailboxu");
@@ -859,7 +859,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchFolderWhenMixedLocalFreeWildcardsNotUsed() throws Exception {
+    void isExpressionMatchShouldMatchFolderWhenMixedLocalFreeWildcardsNotUsed() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub%mailbox*sub", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("submailboxsub");
@@ -868,7 +868,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchSubFolderWhenMixedLocalFreeWildcards() throws Exception {
+    void isExpressionMatchShouldNotMatchSubFolderWhenMixedLocalFreeWildcards() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub%mailbox*sub", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub.mailboxsub");
@@ -877,7 +877,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchFolderWhenMixedFreeLocalWildcardsNotUsed() throws Exception {
+    void isExpressionMatchShouldMatchFolderWhenMixedFreeLocalWildcardsNotUsed() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub*mailbox%sub", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("submailboxsub");
@@ -886,7 +886,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchSubFolderWhenMixedFreeLocalWildcards() throws Exception {
+    void isExpressionMatchShouldMatchSubFolderWhenMixedFreeLocalWildcards() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub*mailbox%sub", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub.mailboxsub");
@@ -895,7 +895,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchSubFolderWhenMixedFreeLocalWildcards() throws Exception {
+    void isExpressionMatchShouldNotMatchSubFolderWhenMixedFreeLocalWildcards() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub*mailbox%sub", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("submailbox.sub");
@@ -904,7 +904,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchFolderWhenMixedFreeLocalWildcards() throws Exception {
+    void isExpressionMatchShouldMatchFolderWhenMixedFreeLocalWildcards() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub*mailbox%sub", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("submailboxwhateversub");
@@ -913,7 +913,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchSubFolderEndingWithDelimiterWhenMixedFreeLocalWildcards() throws Exception {
+    void isExpressionMatchShouldNotMatchSubFolderEndingWithDelimiterWhenMixedFreeLocalWildcards() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub*mailbox%sub", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("submailboxsub.Whatever.");
@@ -922,7 +922,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchDeeplyNestedFolderWhenMixedFreeLocalWildcards() throws Exception {
+    void isExpressionMatchShouldNotMatchDeeplyNestedFolderWhenMixedFreeLocalWildcards() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub*mailbox%sub", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub.mailboxsub.sub");
@@ -931,7 +931,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchSubFoldeWhenMixedFreeLocalWildcards() throws Exception {
+    void isExpressionMatchShouldMatchSubFoldeWhenMixedFreeLocalWildcards() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub*mailbox%sub", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub.mailboxsub");
@@ -940,7 +940,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchDeeplyNestedFoldeWhenMixedFreeLocalWildcards() throws Exception {
+    void isExpressionMatchShouldMatchDeeplyNestedFoldeWhenMixedFreeLocalWildcards() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "sub*mailbox%sub", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("sub.whatever.mailbox123sub");
@@ -949,7 +949,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchFolderWhenTwoLocalPathDelimitedWildcards() throws Exception {
+    void isExpressionMatchShouldNotMatchFolderWhenTwoLocalPathDelimitedWildcards() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "%.%", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("mailbox");
@@ -958,7 +958,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchDeeplyNestedFolderWhenTwoLocalPathDelimitedWildcards() throws Exception {
+    void isExpressionMatchShouldNotMatchDeeplyNestedFolderWhenTwoLocalPathDelimitedWildcards() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "%.%", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("mailbox.sub.sub");
@@ -967,7 +967,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchSubFolderWhenTwoLocalPathDelimitedWildcards() throws Exception {
+    void isExpressionMatchShouldMatchSubFolderWhenTwoLocalPathDelimitedWildcards() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "%.%", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("mailbox.sub");
@@ -976,7 +976,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldMatchSubFolderWhenFreeWildcardAndPathDelimiterAtBeginning() throws Exception {
+    void isExpressionMatchShouldMatchSubFolderWhenFreeWildcardAndPathDelimiterAtBeginning() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "*.test", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("blah.test");
@@ -985,7 +985,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchSubFolderWhenWhenFreeWildcardAndPathDelimiterAtBeginning() throws Exception {
+    void isExpressionMatchShouldNotMatchSubFolderWhenWhenFreeWildcardAndPathDelimiterAtBeginning() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "*.test", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("blah.test3");
@@ -994,7 +994,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotMatchDeeplyNestedFolderWhenFreeWildcardAndPathDelimiterAtBeginning() throws Exception {
+    void isExpressionMatchShouldNotMatchDeeplyNestedFolderWhenFreeWildcardAndPathDelimiterAtBeginning() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "*.test", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("blah.test.go");
@@ -1003,7 +1003,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldIgnoreRegexInjection() throws Exception {
+    void isExpressionMatchShouldIgnoreRegexInjection() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "folder^$!)(%3", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("folder^$!)(123");
@@ -1012,7 +1012,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldIgnoreRegexInjectionWhenUsingEndOfQuoteAndNoMatching() throws Exception {
+    void isExpressionMatchShouldIgnoreRegexInjectionWhenUsingEndOfQuoteAndNoMatching() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "\\Efo.", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("\\Efol");
@@ -1021,7 +1021,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldIgnoreRegexInjectionWhenUsingEndOfQuoteAndMatching() throws Exception {
+    void isExpressionMatchShouldIgnoreRegexInjectionWhenUsingEndOfQuoteAndMatching() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "\\Efo.", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("\\Efo.");
@@ -1030,7 +1030,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldIgnoreRegexInjectionWhenUsingBeginOfQuoteAndNoMatching() throws Exception {
+    void isExpressionMatchShouldIgnoreRegexInjectionWhenUsingBeginOfQuoteAndNoMatching() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "\\Qfo?", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("\\Qfol");
@@ -1039,7 +1039,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldIgnoreRegexInjectionWhenUsingBeginOfQuoteAndMatching() throws Exception {
+    void isExpressionMatchShouldIgnoreRegexInjectionWhenUsingBeginOfQuoteAndMatching() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "\\Qfo?", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("\\Qfo?");
@@ -1048,7 +1048,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotEscapeFreeWildcard() throws Exception {
+    void isExpressionMatchShouldNotEscapeFreeWildcard() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "folder\\*", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("folder\\123");
@@ -1057,7 +1057,7 @@ public class PrefixedRegexTest {
     }
 
     @Test
-    public void isExpressionMatchShouldNotEscapeLocalWildcard() throws Exception {
+    void isExpressionMatchShouldNotEscapeLocalWildcard() {
         PrefixedRegex testee = new PrefixedRegex(EMPTY_PREFIX, "folder\\%", PATH_DELIMITER);
 
         boolean actual = testee.isExpressionMatch("folder\\123");
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/search/PrefixedWildcardTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/search/PrefixedWildcardTest.java
index 9f67a64..3ff74cb 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/search/PrefixedWildcardTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/search/PrefixedWildcardTest.java
@@ -22,7 +22,7 @@ package org.apache.james.mailbox.model.search;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
 
@@ -30,49 +30,49 @@ public class PrefixedWildcardTest {
     public static final String NAME = "toto";
 
     @Test
-    public void shouldMatchBeanContract() {
+    void shouldMatchBeanContract() {
         EqualsVerifier.forClass(PrefixedWildcard.class)
             .verify();
     }
 
     @Test
-    public void constructorShouldThrowOnNullName() {
+    void constructorShouldThrowOnNullName() {
         assertThatThrownBy(() -> new PrefixedWildcard(null))
             .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void isWildShouldReturnTrue() {
+    void isWildShouldReturnTrue() {
         assertThat(new PrefixedWildcard(NAME).isWild())
             .isTrue();
     }
 
     @Test
-    public void getCombinedNameShouldReturnName() {
+    void getCombinedNameShouldReturnName() {
         assertThat(new PrefixedWildcard(NAME).getCombinedName())
             .isEqualTo(NAME + MailboxNameExpression.FREEWILDCARD);
     }
 
     @Test
-    public void isExpressionMatchShouldReturnTrueWhenName() {
+    void isExpressionMatchShouldReturnTrueWhenName() {
         assertThat(new PrefixedWildcard(NAME).isExpressionMatch(NAME))
             .isTrue();
     }
 
     @Test
-    public void isExpressionMatchShouldReturnTrueWhenNameAndPostfix() {
+    void isExpressionMatchShouldReturnTrueWhenNameAndPostfix() {
         assertThat(new PrefixedWildcard(NAME).isExpressionMatch(NAME + "any"))
             .isTrue();
     }
 
     @Test
-    public void isExpressionMatchShouldReturnFalseWhenOtherValue() {
+    void isExpressionMatchShouldReturnFalseWhenOtherValue() {
         assertThat(new PrefixedWildcard(NAME).isExpressionMatch("other"))
             .isFalse();
     }
 
     @Test
-    public void isExpressionMatchShouldThrowOnNullValue() {
+    void isExpressionMatchShouldThrowOnNullValue() {
         assertThatThrownBy(() -> new PrefixedWildcard(NAME).isExpressionMatch(null))
             .isInstanceOf(NullPointerException.class);
     }
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/search/WildcardTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/search/WildcardTest.java
index 1290a39..014c077 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/search/WildcardTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/search/WildcardTest.java
@@ -22,36 +22,36 @@ package org.apache.james.mailbox.model.search;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-public class WildcardTest {
+class WildcardTest {
 
     @Test
-    public void isWildShouldBeTrue() {
+    void isWildShouldBeTrue() {
         assertThat(Wildcard.INSTANCE.isWild())
             .isTrue();
     }
 
     @Test
-    public void getCombinedNameShouldReturnWildcard() {
+    void getCombinedNameShouldReturnWildcard() {
         assertThat(Wildcard.INSTANCE.getCombinedName())
             .isEqualTo(String.valueOf(MailboxNameExpression.FREEWILDCARD));
     }
 
     @Test
-    public void isExpressionMatchShouldMatchAnyValue() {
+    void isExpressionMatchShouldMatchAnyValue() {
         assertThat(Wildcard.INSTANCE.isExpressionMatch("any"))
             .isTrue();
     }
 
     @Test
-    public void isExpressionMatchShouldMatchEmptyValue() {
+    void isExpressionMatchShouldMatchEmptyValue() {
         assertThat(Wildcard.INSTANCE.isExpressionMatch(""))
             .isTrue();
     }
 
     @Test
-    public void isExpressionMatchShouldThrowOnNullValue() {
+    void isExpressionMatchShouldThrowOnNullValue() {
         assertThatThrownBy(() -> Wildcard.INSTANCE.isExpressionMatch(null))
             .isInstanceOf(NullPointerException.class);
     }


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


[james-project] 09/30: [Refactoring] processMessage tag and command are already specified in the request

Posted by bt...@apache.org.
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 cf1288afb246904fadc5fa6fcaef1c40704bb478
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Nov 11 12:39:16 2019 +0700

    [Refactoring] processMessage tag and command are already specified in the request
---
 .../apache/james/imap/processor/AbstractMailboxProcessor.java |  4 ++--
 .../james/imap/processor/AbstractMessageRangeProcessor.java   |  4 +---
 .../james/imap/processor/AbstractSelectionProcessor.java      |  6 ++----
 .../james/imap/processor/AbstractSubscriptionProcessor.java   | 10 +++-------
 .../java/org/apache/james/imap/processor/AppendProcessor.java |  4 +---
 .../apache/james/imap/processor/AuthenticateProcessor.java    |  4 +---
 .../org/apache/james/imap/processor/CapabilityProcessor.java  |  4 +---
 .../java/org/apache/james/imap/processor/CheckProcessor.java  |  4 +---
 .../java/org/apache/james/imap/processor/CloseProcessor.java  |  4 +---
 .../java/org/apache/james/imap/processor/CreateProcessor.java |  4 +---
 .../org/apache/james/imap/processor/DeleteACLProcessor.java   |  8 +++-----
 .../java/org/apache/james/imap/processor/DeleteProcessor.java |  4 +---
 .../java/org/apache/james/imap/processor/EnableProcessor.java |  4 +---
 .../org/apache/james/imap/processor/ExpungeProcessor.java     |  4 +---
 .../java/org/apache/james/imap/processor/GetACLProcessor.java |  4 +---
 .../apache/james/imap/processor/GetAnnotationProcessor.java   |  7 ++-----
 .../org/apache/james/imap/processor/GetQuotaProcessor.java    |  6 ++----
 .../apache/james/imap/processor/GetQuotaRootProcessor.java    |  6 ++----
 .../java/org/apache/james/imap/processor/IdleProcessor.java   |  6 ++----
 .../java/org/apache/james/imap/processor/LSubProcessor.java   |  4 +---
 .../java/org/apache/james/imap/processor/ListProcessor.java   |  4 +---
 .../org/apache/james/imap/processor/ListRightsProcessor.java  |  8 +++-----
 .../java/org/apache/james/imap/processor/LoginProcessor.java  |  4 +---
 .../java/org/apache/james/imap/processor/LogoutProcessor.java |  4 +---
 .../org/apache/james/imap/processor/MyRightsProcessor.java    |  6 ++----
 .../org/apache/james/imap/processor/NamespaceProcessor.java   |  4 +---
 .../java/org/apache/james/imap/processor/NoopProcessor.java   |  4 +---
 .../java/org/apache/james/imap/processor/RenameProcessor.java |  4 +---
 .../java/org/apache/james/imap/processor/SearchProcessor.java |  6 ++----
 .../java/org/apache/james/imap/processor/SetACLProcessor.java |  8 +++-----
 .../apache/james/imap/processor/SetAnnotationProcessor.java   | 11 ++++-------
 .../org/apache/james/imap/processor/SetQuotaProcessor.java    |  6 ++----
 .../java/org/apache/james/imap/processor/StatusProcessor.java |  4 +---
 .../java/org/apache/james/imap/processor/StoreProcessor.java  | 11 +++++------
 .../org/apache/james/imap/processor/SubscribeProcessor.java   |  4 +---
 .../org/apache/james/imap/processor/UnselectProcessor.java    |  4 +---
 .../org/apache/james/imap/processor/UnsubscribeProcessor.java |  4 +---
 .../org/apache/james/imap/processor/fetch/FetchProcessor.java |  4 +---
 .../org/apache/james/imap/processor/LSubProcessorTest.java    |  8 ++++----
 .../org/apache/james/imap/processor/SearchProcessorTest.java  |  2 +-
 40 files changed, 67 insertions(+), 144 deletions(-)

diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
index 752bed3..53b114f 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
@@ -109,7 +109,7 @@ public abstract class AbstractMailboxProcessor<M extends ImapRequest> extends Ab
             } else {
                 getMailboxManager().startProcessingRequest(ImapSessionUtils.getMailboxSession(session));
 
-                processMessage(message, session, tag, command, responder);
+                processMessage(message, session, responder);
 
                 getMailboxManager().endProcessingRequest(ImapSessionUtils.getMailboxSession(session));
 
@@ -370,7 +370,7 @@ public abstract class AbstractMailboxProcessor<M extends ImapRequest> extends Ab
         responder.respond(response);
     }
 
-    protected abstract void processMessage(M message, ImapSession session, Tag tag, ImapCommand command, Responder responder);
+    protected abstract void processMessage(M message, ImapSession session, Responder responder);
 
     /**
      * Joins the elements of a mailboxPath together and returns them as a string
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMessageRangeProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMessageRangeProcessor.java
index 7906815..2a61822 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMessageRangeProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMessageRangeProcessor.java
@@ -22,9 +22,7 @@ package org.apache.james.imap.processor;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.IdRange;
 import org.apache.james.imap.api.message.response.StatusResponse;
@@ -62,7 +60,7 @@ public abstract class AbstractMessageRangeProcessor<M extends AbstractMessageRan
     protected abstract String getOperationName();
 
     @Override
-    protected void processMessage(M request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(M request, ImapSession session, Responder responder) {
         final MailboxPath targetMailbox = PathConverter.forSession(session).buildFullPath(request.getMailboxName());
         final IdRange[] idSet = request.getIdSet();
         final boolean useUids = request.isUseUids();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
index bebfc25..8d20313 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
@@ -22,11 +22,9 @@ package org.apache.james.imap.processor;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapMessage;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.IdRange;
 import org.apache.james.imap.api.message.UidRange;
@@ -79,7 +77,7 @@ abstract class AbstractSelectionProcessor<M extends AbstractMailboxSelectionRequ
     }
 
     @Override
-    protected void processMessage(M request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(M request, ImapSession session, Responder responder) {
         final String mailboxName = request.getMailboxName();
         try {
             final MailboxPath fullMailboxPath = PathConverter.forSession(session).buildFullPath(mailboxName);
@@ -89,7 +87,7 @@ abstract class AbstractSelectionProcessor<M extends AbstractMailboxSelectionRequ
             
         } catch (MailboxNotFoundException e) {
             LOGGER.debug("Select failed as mailbox does not exist {}", mailboxName, e);
-            responder.respond(statusResponseFactory.taggedNo(tag, command, HumanReadableText.FAILURE_NO_SUCH_MAILBOX));
+            responder.respond(statusResponseFactory.taggedNo(request.getTag(), request.getCommand(), HumanReadableText.FAILURE_NO_SUCH_MAILBOX));
         } catch (MailboxException e) {
             LOGGER.error("Select failed for mailbox {}", mailboxName, e);
             no(request, responder, HumanReadableText.SELECT);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSubscriptionProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSubscriptionProcessor.java
index 4ca5ac5..929a5c3 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSubscriptionProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSubscriptionProcessor.java
@@ -18,9 +18,7 @@
  ****************************************************************/
 package org.apache.james.imap.processor;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
@@ -54,12 +52,12 @@ public abstract class AbstractSubscriptionProcessor<M extends ImapRequest> exten
     }
 
     @Override
-    protected final void processMessage(M message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected final void processMessage(M message, ImapSession session, Responder responder) {
 
         // take care of calling the start/end processing
         MailboxSession mSession = ImapSessionUtils.getMailboxSession(session);
         getSubscriptionManager().startProcessingRequest(mSession);
-        doProcessRequest(message, session, tag, command, responder);
+        doProcessRequest(message, session, responder);
         getSubscriptionManager().endProcessingRequest(mSession);
     }
 
@@ -68,10 +66,8 @@ public abstract class AbstractSubscriptionProcessor<M extends ImapRequest> exten
      * 
      * @param message
      * @param session
-     * @param tag
-     * @param command
      * @param responder
      */
-    protected abstract void doProcessRequest(M message, ImapSession session, Tag tag, ImapCommand command, Responder responder);
+    protected abstract void doProcessRequest(M message, ImapSession session, Responder responder);
 
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AppendProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AppendProcessor.java
index 179792c..0a8282e 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AppendProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AppendProcessor.java
@@ -29,9 +29,7 @@ import java.util.Date;
 import javax.mail.Flags;
 
 import org.apache.commons.io.IOUtils;
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.UidRange;
 import org.apache.james.imap.api.message.response.StatusResponse;
@@ -64,7 +62,7 @@ public class AppendProcessor extends AbstractMailboxProcessor<AppendRequest> {
     }
 
     @Override
-    protected void processMessage(AppendRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(AppendRequest request, ImapSession session, Responder responder) {
         final String mailboxName = request.getMailboxName();
         final InputStream messageIn = request.getMessage();
         final Date datetime = request.getDatetime();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AuthenticateProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AuthenticateProcessor.java
index 5a666c0..33b82e3 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AuthenticateProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AuthenticateProcessor.java
@@ -26,8 +26,6 @@ import java.util.Base64;
 import java.util.List;
 import java.util.StringTokenizer;
 
-import org.apache.james.imap.api.ImapCommand;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
@@ -57,7 +55,7 @@ public class AuthenticateProcessor extends AbstractAuthProcessor<AuthenticateReq
     }
 
     @Override
-    protected void processMessage(AuthenticateRequest request, ImapSession session, final Tag tag, final ImapCommand command, final Responder responder) {
+    protected void processMessage(AuthenticateRequest request, ImapSession session, final Responder responder) {
         final String authType = request.getAuthType();
         if (authType.equalsIgnoreCase(PLAIN)) {
             // See if AUTH=PLAIN is allowed. See IMAP-304
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java
index ffd2656..aed50c8 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java
@@ -31,9 +31,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConfiguration;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
 import org.apache.james.imap.api.process.ImapSession;
@@ -80,7 +78,7 @@ public class CapabilityProcessor extends AbstractMailboxProcessor<CapabilityRequ
     }
 
     @Override
-    protected void processMessage(CapabilityRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(CapabilityRequest request, ImapSession session, Responder responder) {
         final CapabilityResponse result = new CapabilityResponse(getSupportedCapabilities(session));        
         responder.respond(result);
         unsolicitedResponses(session, responder, false);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/CheckProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/CheckProcessor.java
index 10594fd..ccb4de8 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/CheckProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/CheckProcessor.java
@@ -21,8 +21,6 @@ package org.apache.james.imap.processor;
 
 import java.io.Closeable;
 
-import org.apache.james.imap.api.ImapCommand;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
 import org.apache.james.imap.api.process.ImapSession;
@@ -39,7 +37,7 @@ public class CheckProcessor extends AbstractMailboxProcessor<CheckRequest> {
     }
 
     @Override
-    protected void processMessage(CheckRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(CheckRequest message, ImapSession session, Responder responder) {
         unsolicitedResponses(session, responder, false);
         okComplete(message, responder);
     }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/CloseProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/CloseProcessor.java
index 3c92857..2d06c12 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/CloseProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/CloseProcessor.java
@@ -21,9 +21,7 @@ package org.apache.james.imap.processor;
 
 import java.io.Closeable;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
@@ -49,7 +47,7 @@ public class CloseProcessor extends AbstractMailboxProcessor<CloseRequest> {
     }
 
     @Override
-    protected void processMessage(CloseRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(CloseRequest message, ImapSession session, Responder responder) {
         try {
             MessageManager mailbox = getSelectedMailbox(session);
             final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/CreateProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/CreateProcessor.java
index 964b04c..09cd9c1 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/CreateProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/CreateProcessor.java
@@ -21,9 +21,7 @@ package org.apache.james.imap.processor;
 
 import java.io.Closeable;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
@@ -49,7 +47,7 @@ public class CreateProcessor extends AbstractMailboxProcessor<CreateRequest> {
     }
 
     @Override
-    protected void processMessage(CreateRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(CreateRequest request, ImapSession session, Responder responder) {
         final MailboxPath mailboxPath = PathConverter.forSession(session).buildFullPath(request.getMailboxName());
         try {
             final MailboxManager mailboxManager = getMailboxManager();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java
index 074f67b..26a3a4a 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java
@@ -22,10 +22,8 @@ package org.apache.james.imap.processor;
 import java.io.Closeable;
 import java.util.List;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
@@ -61,7 +59,7 @@ public class DeleteACLProcessor extends AbstractMailboxProcessor<DeleteACLReques
     }
 
     @Override
-    protected void processMessage(DeleteACLRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(DeleteACLRequest message, ImapSession session, Responder responder) {
 
         final MailboxManager mailboxManager = getMailboxManager();
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
@@ -88,7 +86,7 @@ public class DeleteACLProcessor extends AbstractMailboxProcessor<DeleteACLReques
                 /* RFC 4314 section 4. */
                 Object[] params = new Object[] {
                         MailboxACL.Right.Administer.toString(),
-                        command.getName(),
+                        message.getCommand().getName(),
                         mailboxName
                 };
                 HumanReadableText text = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
@@ -130,7 +128,7 @@ public class DeleteACLProcessor extends AbstractMailboxProcessor<DeleteACLReques
         } catch (MailboxNotFoundException e) {
             no(message, responder, HumanReadableText.MAILBOX_NOT_FOUND);
         } catch (MailboxException e) {
-            LOGGER.error("{} failed for mailbox {}", command.getName(), mailboxName, e);
+            LOGGER.error("{} failed for mailbox {}", message.getCommand().getName(), mailboxName, e);
             no(message, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java
index d05f4f9..ebcb4a9 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java
@@ -21,9 +21,7 @@ package org.apache.james.imap.processor;
 
 import java.io.Closeable;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
@@ -51,7 +49,7 @@ public class DeleteProcessor extends AbstractMailboxProcessor<DeleteRequest> {
     }
 
     @Override
-    protected void processMessage(DeleteRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(DeleteRequest request, ImapSession session, Responder responder) {
         final MailboxPath mailboxPath = PathConverter.forSession(session).buildFullPath(request.getMailboxName());
         try {
             final SelectedMailbox selected = session.getSelected();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/EnableProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/EnableProcessor.java
index 2123142..01920f5 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/EnableProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/EnableProcessor.java
@@ -28,8 +28,6 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
-import org.apache.james.imap.api.ImapCommand;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
@@ -69,7 +67,7 @@ public class EnableProcessor extends AbstractMailboxProcessor<EnableRequest> imp
 
 
     @Override
-    protected void processMessage(EnableRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(EnableRequest request, ImapSession session, Responder responder) {
         try {
 
             List<String> caps = request.getCapabilities();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java
index 07309bf..e2dedaf 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java
@@ -23,10 +23,8 @@ import java.io.Closeable;
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.IdRange;
 import org.apache.james.imap.api.message.response.StatusResponse.ResponseCode;
@@ -62,7 +60,7 @@ public class ExpungeProcessor extends AbstractMailboxProcessor<ExpungeRequest> i
     }
 
     @Override
-    protected void processMessage(ExpungeRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(ExpungeRequest request, ImapSession session, Responder responder) {
         try {
             final MessageManager mailbox = getSelectedMailbox(session);
             final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java
index 8f7a81b..a06ef57 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java
@@ -22,10 +22,8 @@ package org.apache.james.imap.processor;
 import java.io.Closeable;
 import java.util.List;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
@@ -63,7 +61,7 @@ public class GetACLProcessor extends AbstractMailboxProcessor<GetACLRequest> imp
     }
 
     @Override
-    protected void processMessage(GetACLRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(GetACLRequest message, ImapSession session, Responder responder) {
 
         final MailboxManager mailboxManager = getMailboxManager();
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetAnnotationProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetAnnotationProcessor.java
index 2d89a7a..672655e 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetAnnotationProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetAnnotationProcessor.java
@@ -27,10 +27,8 @@ import java.util.Set;
 import java.util.function.Predicate;
 
 import org.apache.commons.lang3.NotImplementedException;
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.StatusResponse.ResponseCode;
@@ -70,12 +68,11 @@ public class GetAnnotationProcessor extends AbstractMailboxProcessor<GetAnnotati
     }
 
     @Override
-    protected void processMessage(GetAnnotationRequest message, ImapSession session, Tag tag, ImapCommand command,
-                                  Responder responder) {
+    protected void processMessage(GetAnnotationRequest message, ImapSession session, Responder responder) {
         try {
             proceed(message, session, responder);
         } catch (MailboxNotFoundException e) {
-            LOGGER.info("The command: {} is failed because not found mailbox {}", command.getName(), message.getMailboxName());
+            LOGGER.info("The command: {} is failed because not found mailbox {}", message.getCommand().getName(), message.getMailboxName());
             no(message, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX, ResponseCode.tryCreate());
         } catch (MailboxException e) {
             LOGGER.error("GetAnnotation on mailbox {} failed for user {}", message.getMailboxName(), ImapSessionUtils.getUserName(session), e);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java
index f6850f4..f16cd43 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java
@@ -24,10 +24,8 @@ import java.util.List;
 
 import org.apache.james.core.quota.QuotaCount;
 import org.apache.james.core.quota.QuotaSize;
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
@@ -71,7 +69,7 @@ public class GetQuotaProcessor extends AbstractMailboxProcessor<GetQuotaRequest>
     }
 
     @Override
-    protected void processMessage(GetQuotaRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(GetQuotaRequest message, ImapSession session, Responder responder) {
         try {
             QuotaRoot quotaRoot = quotaRootResolver.fromString(message.getQuotaRoot());
             if (hasRight(quotaRoot, session)) {
@@ -87,7 +85,7 @@ public class GetQuotaProcessor extends AbstractMailboxProcessor<GetQuotaRequest>
             } else {
                 Object[] params = new Object[]{
                         MailboxACL.Right.Read.toString(),
-                        command.getName(),
+                        message.getCommand().getName(),
                         "Any mailbox of this user USER"
                 };
                 HumanReadableText humanReadableText = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java
index 6003eff..7f1fc41 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java
@@ -24,10 +24,8 @@ import java.util.List;
 
 import org.apache.james.core.quota.QuotaCount;
 import org.apache.james.core.quota.QuotaSize;
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
@@ -72,7 +70,7 @@ public class GetQuotaRootProcessor extends AbstractMailboxProcessor<GetQuotaRoot
     }
 
     @Override
-    protected void processMessage(GetQuotaRootRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(GetQuotaRootRequest message, ImapSession session, Responder responder) {
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
         final MailboxManager mailboxManager = getMailboxManager();
 
@@ -95,7 +93,7 @@ public class GetQuotaRootProcessor extends AbstractMailboxProcessor<GetQuotaRoot
             } else {
                 Object[] params = new Object[]{
                         MailboxACL.Right.Read.toString(),
-                        command.getName(),
+                        message.getCommand().getName(),
                         message.getMailboxName()
                 };
                 HumanReadableText humanReadableText = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/IdleProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/IdleProcessor.java
index fa19b61..42903c0 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/IdleProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/IdleProcessor.java
@@ -30,10 +30,8 @@ import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConfiguration;
 import org.apache.james.imap.api.ImapSessionState;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.response.StatusResponse;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
@@ -86,7 +84,7 @@ public class IdleProcessor extends AbstractMailboxProcessor<IdleRequest> impleme
     }
 
     @Override
-    protected void processMessage(IdleRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(IdleRequest message, ImapSession session, Responder responder) {
         SelectedMailbox sm = session.getSelected();
         Registration registration;
         if (sm != null) {
@@ -112,7 +110,7 @@ public class IdleProcessor extends AbstractMailboxProcessor<IdleRequest> impleme
                 }
                 session.popLineHandler();
                 if (!DONE.equals(line.toUpperCase(Locale.US))) {
-                    StatusResponse response = getStatusResponseFactory().taggedBad(tag, command, HumanReadableText.INVALID_COMMAND);
+                    StatusResponse response = getStatusResponseFactory().taggedBad(message.getTag(), message.getCommand(), HumanReadableText.INVALID_COMMAND);
                     responder.respond(response);
                 } else {
                     okComplete(message, responder);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/LSubProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/LSubProcessor.java
index ef7f299..58aa33d 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/LSubProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/LSubProcessor.java
@@ -23,9 +23,7 @@ import java.io.Closeable;
 import java.util.ArrayList;
 import java.util.Collection;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.display.ModifiedUtf7;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
@@ -54,7 +52,7 @@ public class LSubProcessor extends AbstractSubscriptionProcessor<LsubRequest> {
     }
 
     @Override
-    protected void doProcessRequest(LsubRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void doProcessRequest(LsubRequest request, ImapSession session, Responder responder) {
         String referenceName = request.getBaseReferenceName();
         String mailboxPattern = request.getMailboxPattern();
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java
index c27b98f..a535273 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java
@@ -22,10 +22,8 @@ package org.apache.james.imap.processor;
 import java.io.Closeable;
 import java.util.List;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapMessage;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.display.ModifiedUtf7;
 import org.apache.james.imap.api.message.response.ImapResponseMessage;
@@ -70,7 +68,7 @@ public class ListProcessor extends AbstractMailboxProcessor<ListRequest> {
      * reference is non-rooted or is an empty string.
      */
     @Override
-    protected void processMessage(ListRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(ListRequest request, ImapSession session, Responder responder) {
         String baseReferenceName = request.getBaseReferenceName();
         String mailboxPatternString = request.getMailboxPattern();
         MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java
index 8cde8ca..9cfc43f 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java
@@ -22,10 +22,8 @@ package org.apache.james.imap.processor;
 import java.io.Closeable;
 import java.util.List;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
@@ -62,7 +60,7 @@ public class ListRightsProcessor extends AbstractMailboxProcessor<ListRightsRequ
     }
 
     @Override
-    protected void processMessage(ListRightsRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(ListRightsRequest message, ImapSession session, Responder responder) {
 
         final MailboxManager mailboxManager = getMailboxManager();
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
@@ -90,7 +88,7 @@ public class ListRightsProcessor extends AbstractMailboxProcessor<ListRightsRequ
                 /* RFC 4314 section 4. */
                 Object[] params = new Object[] {
                         MailboxACL.Right.Administer.toString(),
-                        command.getName(),
+                        message.getCommand().getName(),
                         mailboxName
                 };
                 HumanReadableText text = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
@@ -119,7 +117,7 @@ public class ListRightsProcessor extends AbstractMailboxProcessor<ListRightsRequ
         } catch (MailboxNotFoundException e) {
             no(message, responder, HumanReadableText.MAILBOX_NOT_FOUND);
         } catch (MailboxException e) {
-            LOGGER.error("{} failed for mailbox {}", command.getName(), mailboxName, e);
+            LOGGER.error("{} failed for mailbox {}", message.getCommand().getName(), mailboxName, e);
             no(message, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/LoginProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/LoginProcessor.java
index adf9aef..87f4b00 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/LoginProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/LoginProcessor.java
@@ -23,8 +23,6 @@ import java.io.Closeable;
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.james.imap.api.ImapCommand;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
@@ -49,7 +47,7 @@ public class LoginProcessor extends AbstractAuthProcessor<LoginRequest> implemen
     }
 
     @Override
-    protected void processMessage(LoginRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(LoginRequest request, ImapSession session, Responder responder) {
             // check if the login is allowed with LOGIN command. See IMAP-304
             if (session.isPlainAuthDisallowed() && session.isTLSActive() == false) {
                 no(request, responder, HumanReadableText.DISABLED_LOGIN);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java
index 2c15df7..17204f9 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java
@@ -21,9 +21,7 @@ package org.apache.james.imap.processor;
 
 import java.io.Closeable;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
@@ -46,7 +44,7 @@ public class LogoutProcessor extends AbstractMailboxProcessor<LogoutRequest> {
     }
 
     @Override
-    protected void processMessage(LogoutRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(LogoutRequest request, ImapSession session, Responder responder) {
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
         try {
             getMailboxManager().logout(mailboxSession, false);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java
index 64ba139..e904805 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java
@@ -23,10 +23,8 @@ import java.io.Closeable;
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
@@ -60,7 +58,7 @@ public class MyRightsProcessor extends AbstractMailboxProcessor<MyRightsRequest>
     }
 
     @Override
-    protected void processMessage(MyRightsRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(MyRightsRequest message, ImapSession session, Responder responder) {
 
         final MailboxManager mailboxManager = getMailboxManager();
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
@@ -102,7 +100,7 @@ public class MyRightsProcessor extends AbstractMailboxProcessor<MyRightsRequest>
         } catch (MailboxNotFoundException e) {
             no(message, responder, HumanReadableText.MAILBOX_NOT_FOUND);
         } catch (MailboxException e) {
-            LOGGER.error("{} failed for mailbox {}", command.getName(), mailboxName, e);
+            LOGGER.error("{} failed for mailbox {}", message.getCommand().getName(), mailboxName, e);
             no(message, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/NamespaceProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/NamespaceProcessor.java
index e34990e..c6ba459 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/NamespaceProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/NamespaceProcessor.java
@@ -27,9 +27,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
 import org.apache.james.imap.api.process.ImapSession;
@@ -53,7 +51,7 @@ public class NamespaceProcessor extends AbstractMailboxProcessor<NamespaceReques
     }
 
     @Override
-    protected void processMessage(NamespaceRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(NamespaceRequest request, ImapSession session, Responder responder) {
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
         final List<NamespaceResponse.Namespace> personalNamespaces = buildPersonalNamespaces(mailboxSession, session);
         final List<NamespaceResponse.Namespace> otherUsersNamespaces = buildOtherUsersSpaces(mailboxSession, session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/NoopProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/NoopProcessor.java
index c1b3375..9dd7e24 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/NoopProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/NoopProcessor.java
@@ -21,8 +21,6 @@ package org.apache.james.imap.processor;
 
 import java.io.Closeable;
 
-import org.apache.james.imap.api.ImapCommand;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
 import org.apache.james.imap.api.process.ImapSession;
@@ -39,7 +37,7 @@ public class NoopProcessor extends AbstractMailboxProcessor<NoopRequest> {
     }
 
     @Override
-    protected void processMessage(NoopRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(NoopRequest message, ImapSession session, Responder responder) {
         // So, unsolicated responses are returned to check for new mail
         unsolicitedResponses(session, responder, false);
         okComplete(message, responder);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/RenameProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/RenameProcessor.java
index b099c07..b418fae 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/RenameProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/RenameProcessor.java
@@ -21,10 +21,8 @@ package org.apache.james.imap.processor;
 
 import java.io.Closeable;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
@@ -52,7 +50,7 @@ public class RenameProcessor extends AbstractMailboxProcessor<RenameRequest> {
     }
 
     @Override
-    protected void processMessage(RenameRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(RenameRequest request, ImapSession session, Responder responder) {
         PathConverter pathConverter = PathConverter.forSession(session);
         MailboxPath existingPath = pathConverter.buildFullPath(request.getExistingName());
         MailboxPath newPath = pathConverter.buildFullPath(request.getNewName());
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/SearchProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/SearchProcessor.java
index f047482..c2752a9 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/SearchProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/SearchProcessor.java
@@ -29,10 +29,8 @@ import java.util.stream.Stream;
 
 import javax.mail.Flags.Flag;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.IdRange;
 import org.apache.james.imap.api.message.UidRange;
@@ -83,7 +81,7 @@ public class SearchProcessor extends AbstractMailboxProcessor<SearchRequest> imp
     }
 
     @Override
-    protected void processMessage(SearchRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(SearchRequest request, ImapSession session, Responder responder) {
         final SearchOperation operation = request.getSearchOperation();
         final SearchKey searchKey = operation.getSearchKey();
         final boolean useUids = request.isUseUids();
@@ -173,7 +171,7 @@ public class SearchProcessor extends AbstractMailboxProcessor<SearchRequest> imp
                             SearchResUtil.saveSequenceSet(session, savedRanges.toArray(new IdRange[0]));
                         }
                     }
-                    response = new ESearchResponse(min, max, count, idRanges, uidRanges, highestModSeq, tag, useUids, resultOptions);
+                    response = new ESearchResponse(min, max, count, idRanges, uidRanges, highestModSeq, request.getTag(), useUids, resultOptions);
                 } else {
                     // Just save the returned sequence-set as this is not SEARCHRES + ESEARCH
                     SearchResUtil.saveSequenceSet(session, idRanges);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java
index 3dd4a14..97bb3aa 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java
@@ -23,10 +23,8 @@ import java.io.Closeable;
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
@@ -62,7 +60,7 @@ public class SetACLProcessor extends AbstractMailboxProcessor<SetACLRequest> imp
     }
 
     @Override
-    protected void processMessage(SetACLRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(SetACLRequest message, ImapSession session, Responder responder) {
 
         final MailboxManager mailboxManager = getMailboxManager();
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
@@ -107,7 +105,7 @@ public class SetACLProcessor extends AbstractMailboxProcessor<SetACLRequest> imp
                 /* RFC 4314 section 4. */
                 Object[] params = new Object[] {
                         MailboxACL.Right.Administer.toString(),
-                        command.getName(),
+                        message.getCommand().getName(),
                         mailboxName
                 };
                 HumanReadableText text = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
@@ -147,7 +145,7 @@ public class SetACLProcessor extends AbstractMailboxProcessor<SetACLRequest> imp
         } catch (MailboxNotFoundException e) {
             no(message, responder, HumanReadableText.MAILBOX_NOT_FOUND);
         } catch (MailboxException e) {
-            LOGGER.error("{} failed for mailbox {}", command.getName(), mailboxName, e);
+            LOGGER.error("{} failed for mailbox {}", message.getCommand().getName(), mailboxName, e);
             no(message, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetAnnotationProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetAnnotationProcessor.java
index 848e906..ca9e773 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetAnnotationProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetAnnotationProcessor.java
@@ -22,10 +22,8 @@ package org.apache.james.imap.processor;
 import java.io.Closeable;
 import java.util.List;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.response.StatusResponse;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
@@ -60,8 +58,7 @@ public class SetAnnotationProcessor extends AbstractMailboxProcessor<SetAnnotati
     }
 
     @Override
-    protected void processMessage(SetAnnotationRequest message, ImapSession session, Tag tag, ImapCommand command,
-                                  Responder responder) {
+    protected void processMessage(SetAnnotationRequest message, ImapSession session, Responder responder) {
         final MailboxManager mailboxManager = getMailboxManager();
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
         final String mailboxName = message.getMailboxName();
@@ -72,13 +69,13 @@ public class SetAnnotationProcessor extends AbstractMailboxProcessor<SetAnnotati
 
             okComplete(message, responder);
         } catch (MailboxNotFoundException e) {
-            LOGGER.info("{} failed for mailbox {}", command.getName(), mailboxName, e);
+            LOGGER.info("{} failed for mailbox {}", message.getCommand().getName(), mailboxName, e);
             no(message, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX, StatusResponse.ResponseCode.tryCreate());
         } catch (AnnotationException e) {
-            LOGGER.info("{} failed for mailbox {}", command.getName(), mailboxName, e);
+            LOGGER.info("{} failed for mailbox {}", message.getCommand().getName(), mailboxName, e);
             no(message, responder, new HumanReadableText(HumanReadableText.MAILBOX_ANNOTATION_KEY, e.getMessage()));
         } catch (MailboxException e) {
-            LOGGER.error("{} failed for mailbox {}", command.getName(), mailboxName, e);
+            LOGGER.error("{} failed for mailbox {}", message.getCommand().getName(), mailboxName, e);
             no(message, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
     }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetQuotaProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetQuotaProcessor.java
index 0a4b1f2..69a56e6 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetQuotaProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetQuotaProcessor.java
@@ -23,9 +23,7 @@ import java.io.Closeable;
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConstants;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
@@ -52,10 +50,10 @@ public class SetQuotaProcessor extends AbstractMailboxProcessor<SetQuotaRequest>
     }
 
     @Override
-    protected void processMessage(SetQuotaRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(SetQuotaRequest message, ImapSession session, Responder responder) {
         Object[] params = new Object[]{
             "Full admin rights",
-            command.getName(),
+            message.getCommand().getName(),
             "Can not perform SETQUOTA commands"
         };
         HumanReadableText humanReadableText = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/StatusProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/StatusProcessor.java
index d16e911..7620d54 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/StatusProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/StatusProcessor.java
@@ -21,9 +21,7 @@ package org.apache.james.imap.processor;
 
 import java.io.Closeable;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.StatusDataItems;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
@@ -52,7 +50,7 @@ public class StatusProcessor extends AbstractMailboxProcessor<StatusRequest> {
     }
 
     @Override
-    protected void processMessage(StatusRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(StatusRequest request, ImapSession session, Responder responder) {
         MailboxPath mailboxPath = PathConverter.forSession(session).buildFullPath(request.getMailboxName());
         StatusDataItems statusDataItems = request.getStatusDataItems();
         MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/StoreProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/StoreProcessor.java
index ef95fa1..8f8b876 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/StoreProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/StoreProcessor.java
@@ -32,7 +32,6 @@ import javax.mail.Flags;
 import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.IdRange;
 import org.apache.james.imap.api.message.UidRange;
@@ -76,11 +75,11 @@ public class StoreProcessor extends AbstractMailboxProcessor<StoreRequest> {
     }
 
     @Override
-    protected void processMessage(StoreRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(StoreRequest request, ImapSession session, Responder responder) {
         final IdRange[] idSet = request.getIdSet();
         final boolean useUids = request.isUseUids();
         final long unchangedSince = request.getUnchangedSince();
-        ImapCommand imapCommand = command;
+        ImapCommand imapCommand = request.getCommand();
         
         try {
             final MessageManager mailbox = getSelectedMailbox(session);
@@ -104,7 +103,7 @@ public class StoreProcessor extends AbstractMailboxProcessor<StoreRequest> {
                         //       Use of UNCHANGEDSINCE with a modification sequence of 0 always
                         //       fails if the metadata item exists.  A system flag MUST always be
                         //       considered existent, whether it was set or not.
-                        final StatusResponse response = getStatusResponseFactory().taggedOk(tag, command, HumanReadableText.FAILED, ResponseCode.condStore(idSet));
+                        final StatusResponse response = getStatusResponseFactory().taggedOk(request.getTag(), request.getCommand(), HumanReadableText.FAILED, ResponseCode.condStore(idSet));
                         responder.respond(response);
                         return;
                     }
@@ -195,7 +194,7 @@ public class StoreProcessor extends AbstractMailboxProcessor<StoreRequest> {
                     // we need to return the failed sequences
                     //
                     // See RFC4551 3.2. STORE and UID STORE Commands
-                    final StatusResponse response = getStatusResponseFactory().taggedOk(tag, command, HumanReadableText.FAILED, ResponseCode.condStore(idRanges));
+                    final StatusResponse response = getStatusResponseFactory().taggedOk(request.getTag(), request.getCommand(), HumanReadableText.FAILED, ResponseCode.condStore(idRanges));
                     responder.respond(response);
                 } else {
                     List<IdRange> ranges = new ArrayList<>();
@@ -204,7 +203,7 @@ public class StoreProcessor extends AbstractMailboxProcessor<StoreRequest> {
                     }
                     IdRange[] failedRanges = IdRange.mergeRanges(ranges).toArray(new IdRange[0]);
                     // See RFC4551 3.2. STORE and UID STORE Commands
-                    final StatusResponse response = getStatusResponseFactory().taggedOk(tag, command, HumanReadableText.FAILED, ResponseCode.condStore(failedRanges));
+                    final StatusResponse response = getStatusResponseFactory().taggedOk(request.getTag(), request.getCommand(), HumanReadableText.FAILED, ResponseCode.condStore(failedRanges));
                     responder.respond(response);
                     
                 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/SubscribeProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/SubscribeProcessor.java
index b4a2797..02c2c0f 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/SubscribeProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/SubscribeProcessor.java
@@ -21,9 +21,7 @@ package org.apache.james.imap.processor;
 
 import java.io.Closeable;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
@@ -47,7 +45,7 @@ public class SubscribeProcessor extends AbstractSubscriptionProcessor<SubscribeR
     }
 
     @Override
-    protected void doProcessRequest(SubscribeRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void doProcessRequest(SubscribeRequest request, ImapSession session, Responder responder) {
         final String mailboxName = request.getMailboxName();
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
         try {
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/UnselectProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/UnselectProcessor.java
index 7f34734..cac3095 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/UnselectProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/UnselectProcessor.java
@@ -23,8 +23,6 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.james.imap.api.ImapCommand;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
@@ -49,7 +47,7 @@ public class UnselectProcessor extends AbstractMailboxProcessor<UnselectRequest>
     }
 
     @Override
-    protected void processMessage(UnselectRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(UnselectRequest message, ImapSession session, Responder responder) {
         if (session.getSelected() != null) {
             session.deselect();
             okComplete(message, responder);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/UnsubscribeProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/UnsubscribeProcessor.java
index 17fdcb4..d251607 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/UnsubscribeProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/UnsubscribeProcessor.java
@@ -21,9 +21,7 @@ package org.apache.james.imap.processor;
 
 import java.io.Closeable;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
@@ -47,7 +45,7 @@ public class UnsubscribeProcessor extends AbstractSubscriptionProcessor<Unsubscr
     }
 
     @Override
-    protected void doProcessRequest(UnsubscribeRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void doProcessRequest(UnsubscribeRequest request, ImapSession session, Responder responder) {
         final String mailboxName = request.getMailboxName();
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
         try {
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java
index 76e34f2..2cf8481 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java
@@ -24,10 +24,8 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.BodyFetchElement;
 import org.apache.james.imap.api.message.FetchData;
@@ -65,7 +63,7 @@ public class FetchProcessor extends AbstractMailboxProcessor<FetchRequest> {
     }
 
     @Override
-    protected void processMessage(FetchRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(FetchRequest request, ImapSession session, Responder responder) {
         final boolean useUids = request.isUseUids();
         final IdRange[] idSet = request.getIdSet();
         final FetchData fetch = request.getFetch();
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/processor/LSubProcessorTest.java b/protocols/imap/src/test/java/org/apache/james/imap/processor/LSubProcessorTest.java
index 81bcc2d..f6b0243 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/processor/LSubProcessorTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/processor/LSubProcessorTest.java
@@ -114,7 +114,7 @@ public class LSubProcessorTest {
 
         LsubRequest request = new LsubRequest(command, "", PARENT
                 + HIERARCHY_DELIMITER + "%", TAG);
-        processor.doProcessRequest(request, session, TAG, command, responderImpl);
+        processor.doProcessRequest(request, session, responderImpl);
 
         verify(responder).respond(new LSubResponse(CHILD_ONE, false, HIERARCHY_DELIMITER));
         verify(responder).respond(new LSubResponse(CHILD_TWO, false, HIERARCHY_DELIMITER));
@@ -136,7 +136,7 @@ public class LSubProcessorTest {
 
         LsubRequest request = new LsubRequest(command, "", ROOT
                 + HIERARCHY_DELIMITER + "%", TAG);
-        processor.doProcessRequest(request, session, TAG, command, responderImpl);
+        processor.doProcessRequest(request, session, responderImpl);
 
         verify(responder).respond(new LSubResponse(PARENT, true, HIERARCHY_DELIMITER));
         verify(responder).respond(statusResponse);
@@ -158,7 +158,7 @@ public class LSubProcessorTest {
 
         LsubRequest request = new LsubRequest(command, "", ROOT
                 + HIERARCHY_DELIMITER + "%", TAG);
-        processor.doProcessRequest(request, session, TAG, command, responderImpl);
+        processor.doProcessRequest(request, session, responderImpl);
 
         verify(responder).respond(new LSubResponse(PARENT, false, HIERARCHY_DELIMITER));
         verify(responder).respond(statusResponse);
@@ -174,7 +174,7 @@ public class LSubProcessorTest {
             .thenReturn(statusResponse);
 
         LsubRequest request = new LsubRequest(command, "", "*", TAG);
-        processor.doProcessRequest(request, session, TAG, command, responderImpl);
+        processor.doProcessRequest(request, session, responderImpl);
 
         verify(responder).respond(new LSubResponse(MAILBOX_A, false, HIERARCHY_DELIMITER));
         verify(responder).respond(new LSubResponse(MAILBOX_B, false, HIERARCHY_DELIMITER));
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/processor/SearchProcessorTest.java b/protocols/imap/src/test/java/org/apache/james/imap/processor/SearchProcessorTest.java
index 15d2f90..00f6b9c 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/processor/SearchProcessorTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/processor/SearchProcessorTest.java
@@ -473,7 +473,7 @@ public class SearchProcessorTest {
         when(selectedMailbox.hasNewApplicableFlags()).thenReturn(false);
 
         SearchRequest message = new SearchRequest(command, new SearchOperation(key, new ArrayList<>()), false, TAG);
-        processor.processMessage(message, session, TAG, command, responder);
+        processor.processMessage(message, session, responder);
     }
 
     private void expectOk() {


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


[james-project] 05/30: JAMES-2704 do the mapping to a Rerouting infos only for not already discovered value

Posted by bt...@apache.org.
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 fa72fb453aa8694f59b61376e86cdaab5a6cbe68
Author: Rémi KOWALSKI <rk...@linagora.com>
AuthorDate: Fri Nov 8 11:56:25 2019 +0100

    JAMES-2704 do the mapping to a Rerouting infos only for not already discovered value
---
 .../src/main/java/org/apache/james/transport/mailets/RandomStoring.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RandomStoring.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RandomStoring.java
index 58e816c..94a9648 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RandomStoring.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RandomStoring.java
@@ -100,8 +100,8 @@ public class RandomStoring extends GenericMailet {
         return ThreadLocalRandom
             .current()
             .ints(0, reroutingInfos.size())
-            .mapToObj(reroutingInfos::get)
             .distinct()
+            .mapToObj(reroutingInfos::get)
             .limit(randomRecipientsNumbers.get())
             .collect(Guavate.toImmutableSet());
     }


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


[james-project] 18/30: [Refactoring] Moving tests in mailbox.model to JUnit 5

Posted by bt...@apache.org.
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 70265a4932ccd15cf22f0a02948442551840ad61
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Mon Nov 11 16:23:16 2019 +0700

    [Refactoring] Moving tests in mailbox.model to JUnit 5
---
 .../james/mailbox/model/AttachmentIdTest.java      |  18 +-
 .../apache/james/mailbox/model/AttachmentTest.java |  83 +++---
 .../org/apache/james/mailbox/model/BlobIdTest.java |  16 +-
 .../org/apache/james/mailbox/model/BlobTest.java   |  14 +-
 .../org/apache/james/mailbox/model/CidTest.java    | 130 +++++----
 .../model/ComposedMessageIdWithMetaDataTest.java   |  52 ++--
 .../mailbox/model/MailboxACLEntryKeyTest.java      |  45 ++-
 .../apache/james/mailbox/model/MailboxACLTest.java |  46 +--
 .../mailbox/model/MailboxAnnotationKeyTest.java    | 128 +++++----
 .../james/mailbox/model/MailboxAnnotationTest.java |  36 ++-
 .../james/mailbox/model/MailboxAssertTests.java    |  49 ++--
 .../james/mailbox/model/MailboxCountersTest.java   |   6 +-
 .../james/mailbox/model/MailboxPathTest.java       |  50 ++--
 .../james/mailbox/model/MessageAttachmentTest.java |  35 +--
 .../james/mailbox/model/MessageIdDtoTest.java      |  17 +-
 .../james/mailbox/model/MessageRangeTest.java      | 309 ++++++++++-----------
 .../model/MultimailboxesSearchQueryTest.java       |  30 +-
 .../org/apache/james/mailbox/model/QuotaTest.java  |  28 +-
 .../james/mailbox/model/Rfc4314RightsTest.java     |  83 +++---
 .../james/mailbox/model/SearchQueryTest.java       |   8 +-
 .../james/mailbox/model/UpdatedFlagsTest.java      |  30 +-
 21 files changed, 628 insertions(+), 585 deletions(-)

diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/AttachmentIdTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/AttachmentIdTest.java
index c69e9ce..d6f4565 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/AttachmentIdTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/AttachmentIdTest.java
@@ -24,50 +24,50 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import java.util.UUID;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-public class AttachmentIdTest {
+class AttachmentIdTest {
 
     @Test
-    public void randomShouldGenerateDifferentIds() {
+    void randomShouldGenerateDifferentIds() {
         AttachmentId attachmentId = AttachmentId.random();
         AttachmentId attachmentId2 = AttachmentId.random();
         assertThat(attachmentId.getId()).isNotEqualTo(attachmentId2.getId());
     }
 
     @Test
-    public void fromShouldThrowWhenIdIsNull() {
+    void fromShouldThrowWhenIdIsNull() {
         String value = null;
         assertThatThrownBy(() -> AttachmentId.from(value)).isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void fromShouldThrowWhenBlobIdIsNull() {
+    void fromShouldThrowWhenBlobIdIsNull() {
         BlobId value = null;
         assertThatThrownBy(() -> AttachmentId.from(value)).isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void fromShouldThrowWhenIdIsEmpty() {
+    void fromShouldThrowWhenIdIsEmpty() {
         assertThatThrownBy(() -> AttachmentId.from("")).isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void fromStringShouldWork() {
+    void fromStringShouldWork() {
         String expectedId = "f07e5a815613c5abeddc4b682247a4c42d8a95df";
         AttachmentId attachmentId = AttachmentId.from(expectedId);
         assertThat(attachmentId.getId()).isEqualTo(expectedId);
     }
 
     @Test
-    public void fromBlobIdShouldWork() {
+    void fromBlobIdShouldWork() {
         String expectedId = "f07e5a815613c5abeddc4b682247a4c42d8a95df";
         AttachmentId attachmentId = AttachmentId.from(BlobId.fromString(expectedId));
         assertThat(attachmentId.getId()).isEqualTo(expectedId);
     }
 
     @Test
-    public void asUUIDShouldReturnAValidUUID() {
+    void asUUIDShouldReturnAValidUUID() {
         AttachmentId attachmentId = AttachmentId.from("magic");
 
         assertThat(attachmentId.asUUID())
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/AttachmentTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/AttachmentTest.java
index d73e073..69c5636 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/AttachmentTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/AttachmentTest.java
@@ -21,20 +21,21 @@
 package org.apache.james.mailbox.model;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import java.io.InputStream;
 import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
 
 import org.apache.commons.io.IOUtils;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-public class AttachmentTest {
+class AttachmentTest {
 
     private static Charset CHARSET = StandardCharsets.UTF_8;
 
     @Test
-    public void streamShouldBeConsumedOneTime() throws Exception {
+    void streamShouldBeConsumedOneTime() throws Exception {
         String input = "mystream";
         Attachment attachment = Attachment.builder()
                 .bytes(input.getBytes(CHARSET))
@@ -47,7 +48,7 @@ public class AttachmentTest {
     }
 
     @Test
-    public void getByteShouldReturnByteArrayRepresentingTheAttachment() {
+    void getByteShouldReturnByteArrayRepresentingTheAttachment() {
         String input = "mystream";
         Attachment attachment = Attachment.builder()
             .bytes(input.getBytes(CHARSET))
@@ -59,7 +60,7 @@ public class AttachmentTest {
     }
 
     @Test
-    public void streamShouldBeConsumedMoreThanOneTime() throws Exception {
+    void streamShouldBeConsumedMoreThanOneTime() throws Exception {
         String input = "mystream";
         Attachment attachment = Attachment.builder()
                 .bytes(input.getBytes(CHARSET))
@@ -72,52 +73,60 @@ public class AttachmentTest {
         assertThat(IOUtils.toString(stream, CHARSET)).isEqualTo(input);
     }
 
-    @Test (expected = IllegalArgumentException.class)
-    public void builderShouldThrowWhenAttachmentIdIsNull() {
-        Attachment.builder()
-            .attachmentId(null);
+    @Test
+    void builderShouldThrowWhenAttachmentIdIsNull() {
+        assertThatThrownBy(() -> Attachment.builder()
+                .attachmentId(null))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
-    @Test (expected = IllegalArgumentException.class)
-    public void builderShouldThrowWhenBytesIsNull() {
-        Attachment.builder()
-            .bytes(null);
+    @Test
+    void builderShouldThrowWhenBytesIsNull() {
+        assertThatThrownBy(() -> Attachment.builder()
+                .bytes(null))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
-    @Test (expected = IllegalArgumentException.class)
-    public void builderShouldThrowWhenTypeIsNull() {
-        Attachment.builder()
-            .type(null);
+    @Test
+    void builderShouldThrowWhenTypeIsNull() {
+        assertThatThrownBy(() -> Attachment.builder()
+                .type(null))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
-    @Test (expected = IllegalArgumentException.class)
-    public void builderShouldThrowWhenTypeIsEmpty() {
-        Attachment.builder()
-            .type("");
+    @Test
+    void builderShouldThrowWhenTypeIsEmpty() {
+        assertThatThrownBy(() -> Attachment.builder()
+                .type(""))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
-    @Test (expected = IllegalStateException.class)
-    public void buildShouldThrowWhenAttachmentIdIsNotProvided() {
-        Attachment.builder().build();
+    @Test
+    void buildShouldThrowWhenAttachmentIdIsNotProvided() {
+        assertThatThrownBy(() -> Attachment.builder()
+                .build())
+            .isInstanceOf(IllegalStateException.class);
     }
 
-    @Test (expected = IllegalStateException.class)
-    public void buildShouldThrowWhenBytesIsNotProvided() {
-        Attachment.builder()
-            .attachmentId(AttachmentId.random())
-            .build();
+    @Test
+    void buildShouldThrowWhenBytesIsNotProvided() {
+        assertThatThrownBy(() -> Attachment.builder()
+                .attachmentId(AttachmentId.random())
+                .build())
+            .isInstanceOf(IllegalStateException.class);
     }
 
-    @Test (expected = IllegalStateException.class)
-    public void buildShouldThrowWhenTypeIsNotProvided() {
-        Attachment.builder()
-            .attachmentId(AttachmentId.random())
-            .bytes("mystream".getBytes(CHARSET))
-            .build();
+    @Test
+    void buildShouldThrowWhenTypeIsNotProvided() {
+        assertThatThrownBy(() -> Attachment.builder()
+                .attachmentId(AttachmentId.random())
+                .bytes("mystream".getBytes(CHARSET))
+                .build())
+            .isInstanceOf(IllegalStateException.class);
     }
 
     @Test
-    public void buildShouldSetTheSize() {
+    void buildShouldSetTheSize() {
         String input = "mystream";
         Attachment attachment = Attachment.builder()
                 .bytes(input.getBytes(CHARSET))
@@ -128,7 +137,7 @@ public class AttachmentTest {
     }
 
     @Test
-    public void toBlobShouldGenerateTheAttachmentBlob() {
+    void toBlobShouldGenerateTheAttachmentBlob() {
         byte[] bytes = "mystream".getBytes(CHARSET);
         String content = "content";
         Attachment attachment = Attachment.builder()
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/BlobIdTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/BlobIdTest.java
index f91b9c7..1d4e3b2 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/BlobIdTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/BlobIdTest.java
@@ -24,44 +24,44 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import java.nio.charset.StandardCharsets;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
 
-public class BlobIdTest {
+class BlobIdTest {
 
     @Test
-    public void shouldMatchBeanContact() {
+    void shouldMatchBeanContact() {
         EqualsVerifier.forClass(BlobId.class)
             .verify();
     }
 
     @Test
-    public void fromStringShouldThrowOnNull() {
+    void fromStringShouldThrowOnNull() {
         assertThatThrownBy(() -> BlobId.fromString(null))
             .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void fromStringShouldThrowOnEmpty() {
+    void fromStringShouldThrowOnEmpty() {
         assertThatThrownBy(() -> BlobId.fromString(""))
             .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void asStringShouldReturnUnderlyingId() {
+    void asStringShouldReturnUnderlyingId() {
         assertThat(BlobId.fromString("abc").asString())
             .isEqualTo("abc");
     }
 
     @Test
-    public void fromBytesShouldProduceASHA256() {
+    void fromBytesShouldProduceASHA256() {
         assertThat(BlobId.fromBytes("abc".getBytes(StandardCharsets.UTF_8)).asString())
             .isEqualTo("ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad");
     }
 
     @Test
-    public void fromBytesShouldCalculateSameSha256() {
+    void fromBytesShouldCalculateSameSha256() {
         byte[] bytes = "abc".getBytes(StandardCharsets.UTF_8);
 
         assertThat(BlobId.fromBytes(bytes))
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/BlobTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/BlobTest.java
index 0c306d4..b19219d 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/BlobTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/BlobTest.java
@@ -24,25 +24,25 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import java.nio.charset.StandardCharsets;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
 
-public class BlobTest {
+class BlobTest {
 
     public static final BlobId ID = BlobId.fromString("123");
     public static final String CONTENT_TYPE = "text/plain";
     public static final byte[] PAYLOAD = "abc".getBytes(StandardCharsets.UTF_8);
 
     @Test
-    public void shouldMatchBeanContract() {
+    void shouldMatchBeanContract() {
         EqualsVerifier.forClass(Blob.class)
             .withIgnoredFields("payload", "size")
             .verify();
     }
 
     @Test
-    public void buildShouldConstructValidBlob() {
+    void buildShouldConstructValidBlob() {
         assertThat(
             Blob.builder()
                 .id(ID)
@@ -54,7 +54,7 @@ public class BlobTest {
     }
 
     @Test
-    public void buildShouldThrowOnMissingBlobId() {
+    void buildShouldThrowOnMissingBlobId() {
         assertThatThrownBy(() ->
             Blob.builder()
                 .contentType(CONTENT_TYPE)
@@ -64,7 +64,7 @@ public class BlobTest {
     }
 
     @Test
-    public void buildShouldThrowOnMissingContentType() {
+    void buildShouldThrowOnMissingContentType() {
         assertThatThrownBy(() ->
             Blob.builder()
                 .id(ID)
@@ -74,7 +74,7 @@ public class BlobTest {
     }
 
     @Test
-    public void buildShouldThrowOnMissingPayload() {
+    void buildShouldThrowOnMissingPayload() {
         assertThatThrownBy(() ->
             Blob.builder()
                 .id(ID)
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/CidTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/CidTest.java
index 3939a39..1e1c59b 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/CidTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/CidTest.java
@@ -20,75 +20,72 @@
 package org.apache.james.mailbox.model;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import java.util.Optional;
 
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
 
-public class CidTest {
-
-    @Rule public ExpectedException expectedException = ExpectedException.none();
+class CidTest {
 
     @Test
-    public void fromShouldThrowWhenNull() {
-        expectedException.expect(IllegalArgumentException.class);
-        Cid.from(null);
+    void fromShouldThrowWhenNull() {
+        assertThatThrownBy(() -> Cid.from(null))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void fromShouldThrowWhenEmpty() {
-        expectedException.expect(IllegalArgumentException.class);
-        Cid.from("");
+    void fromShouldThrowWhenEmpty() {
+        assertThatThrownBy(() -> Cid.from(""))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void fromShouldThrowWhenBlank() {
-        expectedException.expect(IllegalArgumentException.class);
-        Cid.from("    ");
+    void fromShouldThrowWhenBlank() {
+        assertThatThrownBy(() -> Cid.from("    "))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void fromShouldThrowWhenEmptyAfterRemoveTags() {
-        expectedException.expect(IllegalArgumentException.class);
-        Cid.from("<>");
+    void fromShouldThrowWhenEmptyAfterRemoveTags() {
+        assertThatThrownBy(() -> Cid.from("<>"))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void fromShouldThrowWhenBlankAfterRemoveTags() {
-        expectedException.expect(IllegalArgumentException.class);
-        Cid.from("<   >");
+    void fromShouldThrowWhenBlankAfterRemoveTags() {
+        assertThatThrownBy(() -> Cid.from("<   >"))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void fromShouldRemoveTagsWhenExists() {
+    void fromShouldRemoveTagsWhenExists() {
         Cid cid = Cid.from("<123>");
         assertThat(cid.getValue()).isEqualTo("123");
     }
 
     @Test
-    public void fromShouldNotRemoveTagsWhenNone() {
+    void fromShouldNotRemoveTagsWhenNone() {
         Cid cid = Cid.from("123");
         assertThat(cid.getValue()).isEqualTo("123");
     }
 
     @Test
-    public void fromShouldNotRemoveTagsWhenNotEndTag() {
+    void fromShouldNotRemoveTagsWhenNotEndTag() {
         Cid cid = Cid.from("<123");
         assertThat(cid.getValue()).isEqualTo("<123");
     }
 
     @Test
-    public void fromShouldNotRemoveTagsWhenNotStartTag() {
+    void fromShouldNotRemoveTagsWhenNotStartTag() {
         Cid cid = Cid.from("123>");
         assertThat(cid.getValue()).isEqualTo("123>");
     }
 
     @Test
-    public void fromRelaxedNoUnwrapShouldReturnAbsentWhenNull() {
+    void fromRelaxedNoUnwrapShouldReturnAbsentWhenNull() {
         assertThat(Cid.parser()
             .relaxed()
             .parse(null))
@@ -96,7 +93,7 @@ public class CidTest {
     }
 
     @Test
-    public void fromRelaxedNoUnwrapShouldReturnAbsentWhenEmpty() {
+    void fromRelaxedNoUnwrapShouldReturnAbsentWhenEmpty() {
         assertThat(Cid.parser()
             .relaxed()
             .parse(""))
@@ -104,7 +101,7 @@ public class CidTest {
     }
 
     @Test
-    public void fromRelaxedNoUnwrapShouldReturnAbsentWhenBlank() {
+    void fromRelaxedNoUnwrapShouldReturnAbsentWhenBlank() {
         assertThat(Cid.parser()
             .relaxed()
             .parse("     "))
@@ -112,7 +109,7 @@ public class CidTest {
     }
 
     @Test
-    public void fromRelaxedNoUnwrapShouldReturnCidWhenEmptyAfterRemoveTags() {
+    void fromRelaxedNoUnwrapShouldReturnCidWhenEmptyAfterRemoveTags() {
         Optional<Cid> actual = Cid.parser()
             .relaxed()
             .parse("<>");
@@ -121,7 +118,7 @@ public class CidTest {
     }
 
     @Test
-    public void fromRelaxedNoUnwrapShouldReturnCidWhenBlankAfterRemoveTags() {
+    void fromRelaxedNoUnwrapShouldReturnCidWhenBlankAfterRemoveTags() {
         Optional<Cid> actual = Cid.parser()
             .relaxed()
             .parse("<   >");
@@ -130,7 +127,7 @@ public class CidTest {
     }
 
     @Test
-    public void fromRelaxedNoUnwrapShouldNotRemoveTagsWhenExists() {
+    void fromRelaxedNoUnwrapShouldNotRemoveTagsWhenExists() {
         Optional<Cid> actual = Cid.parser()
             .relaxed()
             .parse("<123>");
@@ -139,7 +136,7 @@ public class CidTest {
     }
 
     @Test
-    public void fromRelaxedNoUnwrapShouldNotRemoveTagsWhenNone() {
+    void fromRelaxedNoUnwrapShouldNotRemoveTagsWhenNone() {
         assertThat(Cid.parser()
             .relaxed()
             .parse("123"))
@@ -147,7 +144,7 @@ public class CidTest {
     }
 
     @Test
-    public void fromRelaxedNoUnwrapShouldNotRemoveTagsWhenNotEndTag() {
+    void fromRelaxedNoUnwrapShouldNotRemoveTagsWhenNotEndTag() {
         assertThat(Cid.parser()
             .relaxed()
             .parse("<123"))
@@ -155,7 +152,7 @@ public class CidTest {
     }
 
     @Test
-    public void fromRelaxedNoUnwrapShouldNotRemoveTagsWhenNotStartTag() {
+    void fromRelaxedNoUnwrapShouldNotRemoveTagsWhenNotStartTag() {
         assertThat(Cid.parser()
             .relaxed()
             .parse("123>"))
@@ -164,7 +161,7 @@ public class CidTest {
 
 
     @Test
-    public void fromRelaxedUnwrapShouldReturnAbsentWhenNull() {
+    void fromRelaxedUnwrapShouldReturnAbsentWhenNull() {
         assertThat(Cid.parser()
             .relaxed()
             .unwrap()
@@ -173,7 +170,7 @@ public class CidTest {
     }
 
     @Test
-    public void fromRelaxedUnwrapShouldReturnAbsentWhenEmpty() {
+    void fromRelaxedUnwrapShouldReturnAbsentWhenEmpty() {
         assertThat(Cid.parser()
             .relaxed()
             .unwrap()
@@ -182,7 +179,7 @@ public class CidTest {
     }
 
     @Test
-    public void fromRelaxedUnwrapShouldReturnAbsentWhenBlank() {
+    void fromRelaxedUnwrapShouldReturnAbsentWhenBlank() {
         assertThat(Cid.parser()
             .relaxed()
             .unwrap()
@@ -191,7 +188,7 @@ public class CidTest {
     }
 
     @Test
-    public void fromRelaxedUnwrapShouldReturnAbsentWhenEmptyAfterRemoveTags() {
+    void fromRelaxedUnwrapShouldReturnAbsentWhenEmptyAfterRemoveTags() {
         assertThat(Cid.parser()
             .relaxed()
             .unwrap()
@@ -200,7 +197,7 @@ public class CidTest {
     }
 
     @Test
-    public void fromRelaxedUnwrapShouldReturnAbsentWhenBlankAfterRemoveTags() {
+    void fromRelaxedUnwrapShouldReturnAbsentWhenBlankAfterRemoveTags() {
         assertThat(Cid.parser()
             .relaxed()
             .unwrap()
@@ -209,7 +206,7 @@ public class CidTest {
     }
 
     @Test
-    public void fromRelaxedUnwrapShouldRemoveTagsWhenExists() {
+    void fromRelaxedUnwrapShouldRemoveTagsWhenExists() {
         Optional<Cid> actual = Cid.parser()
             .relaxed()
             .unwrap()
@@ -219,7 +216,7 @@ public class CidTest {
     }
 
     @Test
-    public void fromRelaxedUnwrapShouldNotRemoveTagsWhenNone() {
+    void fromRelaxedUnwrapShouldNotRemoveTagsWhenNone() {
         assertThat(Cid.parser()
             .relaxed()
             .unwrap()
@@ -228,7 +225,7 @@ public class CidTest {
     }
 
     @Test
-    public void fromRelaxedUnwrapShouldNotRemoveTagsWhenNotEndTag() {
+    void fromRelaxedUnwrapShouldNotRemoveTagsWhenNotEndTag() {
         assertThat(Cid.parser()
             .relaxed()
             .unwrap()
@@ -237,7 +234,7 @@ public class CidTest {
     }
 
     @Test
-    public void fromRelaxedUnwrapShouldNotRemoveTagsWhenNotStartTag() {
+    void fromRelaxedUnwrapShouldNotRemoveTagsWhenNotStartTag() {
         assertThat(Cid.parser()
             .relaxed()
             .unwrap()
@@ -246,34 +243,31 @@ public class CidTest {
     }
 
     @Test
-    public void fromStrictNoUnwrapShouldThrowWhenNull() {
-        expectedException.expect(IllegalArgumentException.class);
-
-        Cid.parser()
-            .strict()
-            .parse(null);
+    void fromStrictNoUnwrapShouldThrowWhenNull() {
+        assertThatThrownBy(() -> Cid.parser()
+                .strict()
+                .parse(null))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void fromStrictNoUnwrapShouldThrowWhenEmpty() {
-        expectedException.expect(IllegalArgumentException.class);
-
-        Cid.parser()
-            .strict()
-            .parse("");
+    void fromStrictNoUnwrapShouldThrowWhenEmpty() {
+        assertThatThrownBy(() -> Cid.parser()
+                .strict()
+                .parse(""))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void fromStrinctNoUnwrapShouldThrowWhenBlank() {
-        expectedException.expect(IllegalArgumentException.class);
-
-        Cid.parser()
-            .strict()
-            .parse("   ");
+    void fromStrinctNoUnwrapShouldThrowWhenBlank() {
+        assertThatThrownBy(() -> Cid.parser()
+                .strict()
+                .parse("   "))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void fromStrictNoUnwrapShouldNotRemoveTagWhenEmptyAfterRemoveTags() {
+    void fromStrictNoUnwrapShouldNotRemoveTagWhenEmptyAfterRemoveTags() {
         Optional<Cid> actual = Cid.parser()
             .strict()
             .parse("<>");
@@ -282,7 +276,7 @@ public class CidTest {
     }
 
     @Test
-    public void fromStrictNoUnwrapShouldNotRemoveTagWhenBlankAfterRemoveTags() {
+    void fromStrictNoUnwrapShouldNotRemoveTagWhenBlankAfterRemoveTags() {
         Optional<Cid> actual = Cid.parser()
             .strict()
             .parse("<   >");
@@ -291,7 +285,7 @@ public class CidTest {
     }
 
     @Test
-    public void fromStrictNoUnwrapShouldNotRemoveTagsWhenExists() {
+    void fromStrictNoUnwrapShouldNotRemoveTagsWhenExists() {
         Optional<Cid> actual = Cid.parser()
             .strict()
             .parse("<123>");
@@ -300,7 +294,7 @@ public class CidTest {
     }
 
     @Test
-    public void fromStrictNoUnwrapShouldNotRemoveTagsWhenNone() {
+    void fromStrictNoUnwrapShouldNotRemoveTagsWhenNone() {
         assertThat(Cid.parser()
             .strict()
             .parse("123"))
@@ -308,7 +302,7 @@ public class CidTest {
     }
 
     @Test
-    public void fromStrictNoUnwrapShouldNotRemoveTagsWhenNotEndTag() {
+    void fromStrictNoUnwrapShouldNotRemoveTagsWhenNotEndTag() {
         assertThat(Cid.parser()
             .strict()
             .parse("<123"))
@@ -316,7 +310,7 @@ public class CidTest {
     }
 
     @Test
-    public void fromStrictNoUnwrapShouldNotRemoveTagsWhenNotStartTag() {
+    void fromStrictNoUnwrapShouldNotRemoveTagsWhenNotStartTag() {
         assertThat(Cid.parser()
             .strict()
             .parse("123>"))
@@ -324,7 +318,7 @@ public class CidTest {
     }
 
     @Test
-    public void shouldRespectJavaBeanContract() {
+    void shouldRespectJavaBeanContract() {
         EqualsVerifier.forClass(Cid.class).verify();
     }
 }
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/ComposedMessageIdWithMetaDataTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/ComposedMessageIdWithMetaDataTest.java
index 8df2ba4..b120c87 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/ComposedMessageIdWithMetaDataTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/ComposedMessageIdWithMetaDataTest.java
@@ -19,44 +19,48 @@
 package org.apache.james.mailbox.model;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import javax.mail.Flags;
 import javax.mail.Flags.Flag;
 
 import org.apache.james.mailbox.MessageUid;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
 
-public class ComposedMessageIdWithMetaDataTest {
+class ComposedMessageIdWithMetaDataTest {
 
-    public static final TestId TEST_ID = TestId.of(1L);
-    public static final TestMessageId TEST_MESSAGE_ID = new TestMessageId("2");
-    public static final MessageUid MESSAGE_UID = MessageUid.of(3);
-    public static final ComposedMessageId COMPOSED_MESSAGE_ID = new ComposedMessageId(TEST_ID, TEST_MESSAGE_ID, MESSAGE_UID);
+    private static final TestId TEST_ID = TestId.of(1L);
+    private static final TestMessageId TEST_MESSAGE_ID = new TestMessageId("2");
+    private static final MessageUid MESSAGE_UID = MessageUid.of(3);
+    private static final ComposedMessageId COMPOSED_MESSAGE_ID = new ComposedMessageId(TEST_ID, TEST_MESSAGE_ID, MESSAGE_UID);
 
-    @Test(expected = NullPointerException.class)
-    public void buildShoudThrownWhenComposedMessageIdIsNull() {
-        ComposedMessageIdWithMetaData.builder().build();
+    @Test
+    void buildShoudThrownWhenComposedMessageIdIsNull() {
+        assertThatThrownBy(() -> ComposedMessageIdWithMetaData.builder().build())
+            .isInstanceOf(NullPointerException.class);
     }
 
-    @Test(expected = NullPointerException.class)
-    public void buildShoudThrownWhenFlagsIsNull() {
-        ComposedMessageIdWithMetaData.builder()
-            .composedMessageId(COMPOSED_MESSAGE_ID)
-            .build();
+    @Test
+    void buildShoudThrownWhenFlagsIsNull() {
+        assertThatThrownBy(() -> ComposedMessageIdWithMetaData.builder()
+                .composedMessageId(COMPOSED_MESSAGE_ID)
+                .build())
+            .isInstanceOf(NullPointerException.class);
     }
 
-    @Test(expected = NullPointerException.class)
-    public void buildShoudThrownWhenModSeqIsNull() {
-        ComposedMessageIdWithMetaData.builder()
-            .composedMessageId(COMPOSED_MESSAGE_ID)
-            .flags(new Flags())
-            .build();
+    @Test
+    void buildShoudThrownWhenModSeqIsNull() {
+        assertThatThrownBy(() -> ComposedMessageIdWithMetaData.builder()
+                .composedMessageId(COMPOSED_MESSAGE_ID)
+                .flags(new Flags())
+                .build())
+            .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void buildShoudWork() {
+    void buildShoudWork() {
         Flags flags = new Flags(Flag.RECENT);
         long modSeq = 1;
 
@@ -72,7 +76,7 @@ public class ComposedMessageIdWithMetaDataTest {
     }
 
     @Test
-    public void isMatchingShouldReturnTrueWhenSameMessageId() {
+    void isMatchingShouldReturnTrueWhenSameMessageId() {
         ComposedMessageIdWithMetaData composedMessageIdWithMetaData = ComposedMessageIdWithMetaData.builder()
                 .composedMessageId(new ComposedMessageId(TEST_ID, TEST_MESSAGE_ID, MESSAGE_UID))
                 .flags(new Flags(Flag.RECENT))
@@ -83,7 +87,7 @@ public class ComposedMessageIdWithMetaDataTest {
     }
 
     @Test
-    public void isMatchingShouldReturnFalseWhenOtherMessageId() {
+    void isMatchingShouldReturnFalseWhenOtherMessageId() {
         ComposedMessageIdWithMetaData composedMessageIdWithMetaData = ComposedMessageIdWithMetaData.builder()
                 .composedMessageId(COMPOSED_MESSAGE_ID)
                 .flags(new Flags(Flag.RECENT))
@@ -94,7 +98,7 @@ public class ComposedMessageIdWithMetaDataTest {
     }
 
     @Test
-    public void shouldRespectJavaBeanContract() {
+    void shouldRespectJavaBeanContract() {
         EqualsVerifier.forClass(ComposedMessageIdWithMetaData.class)
             .verify();
     }
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxACLEntryKeyTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxACLEntryKeyTest.java
index 8617f55..0e0307b 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxACLEntryKeyTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxACLEntryKeyTest.java
@@ -22,132 +22,131 @@ package org.apache.james.mailbox.model;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-import org.apache.james.mailbox.exception.UnsupportedRightException;
 import org.apache.james.mailbox.model.MailboxACL.EntryKey;
 import org.apache.james.mailbox.model.MailboxACL.NameType;
 import org.apache.james.mailbox.model.MailboxACL.SpecialName;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-public class MailboxACLEntryKeyTest {
+class MailboxACLEntryKeyTest {
     private static final String GROUP_1 = "group1";
     private static final String USER_1 = "user1";
 
     @Test
-    public void testUser() throws UnsupportedRightException {
+    void testUser() {
         assertThat(EntryKey.deserialize(USER_1))
             .isEqualTo(new EntryKey(USER_1, NameType.user, false));
     }
 
     @Test
-    public void testNegativeUser() throws UnsupportedRightException {
+    void testNegativeUser() {
         assertThat(EntryKey.deserialize(MailboxACL.DEFAULT_NEGATIVE_MARKER + USER_1))
             .isEqualTo(new EntryKey(USER_1, NameType.user, true));
     }
 
     @Test
-    public void testGroup() throws UnsupportedRightException {
+    void testGroup() {
         assertThat(EntryKey.deserialize(MailboxACL.DEFAULT_GROUP_MARKER + GROUP_1))
             .isEqualTo(new EntryKey(GROUP_1, NameType.group, false));
     }
 
     @Test
-    public void testNegativeGroup() throws UnsupportedRightException {
+    void testNegativeGroup() {
         assertThat(EntryKey.deserialize(String.valueOf(MailboxACL.DEFAULT_NEGATIVE_MARKER) + MailboxACL.DEFAULT_GROUP_MARKER + GROUP_1))
             .isEqualTo(new EntryKey(GROUP_1, NameType.group, true));
     }
 
     @Test
-    public void testOwner() throws UnsupportedRightException {
+    void testOwner() {
         assertThat(EntryKey.deserialize(SpecialName.owner.toString()))
             .isEqualTo(new EntryKey(SpecialName.owner.toString(), NameType.special, false));
     }
 
     @Test
-    public void testNegativeOwner() throws UnsupportedRightException {
+    void testNegativeOwner() {
         assertThat(EntryKey.deserialize(MailboxACL.DEFAULT_NEGATIVE_MARKER + SpecialName.owner.toString()))
             .isEqualTo(new EntryKey(SpecialName.owner.toString(), NameType.special, true));
     }
 
     @Test
-    public void testAnybody() throws UnsupportedRightException {
+    void testAnybody() {
         assertThat(EntryKey.deserialize(SpecialName.anybody.toString()))
             .isEqualTo(new EntryKey(SpecialName.anybody.toString(), NameType.special, false));
     }
 
     @Test
-    public void testNegativeAnybody() throws UnsupportedRightException {
+    void testNegativeAnybody() {
         assertThat(EntryKey.deserialize(MailboxACL.DEFAULT_NEGATIVE_MARKER + SpecialName.anybody.toString()))
             .isEqualTo(new EntryKey(SpecialName.anybody.toString(), NameType.special, true));
     }
 
     @Test
-    public void testAuthenticated() throws UnsupportedRightException {
+    void testAuthenticated() {
         assertThat(EntryKey.deserialize(SpecialName.authenticated.toString()))
             .isEqualTo(new EntryKey(SpecialName.authenticated.toString(), NameType.special, false));
     }
 
     @Test
-    public void testNegativeAuthenticated() throws UnsupportedRightException {
+    void testNegativeAuthenticated() {
         assertThat(EntryKey.deserialize(MailboxACL.DEFAULT_NEGATIVE_MARKER + SpecialName.authenticated.toString()))
             .isEqualTo(new EntryKey(SpecialName.authenticated.toString(), NameType.special, true));
     }
 
     @Test
-    public void testSerializeUser() throws UnsupportedRightException {
+    void testSerializeUser() {
         assertThat(new EntryKey(USER_1, NameType.user, false).serialize())
             .isEqualTo(USER_1);
     }
 
     @Test
-    public void testSerializeNegativeUser() throws UnsupportedRightException {
+    void testSerializeNegativeUser() {
         assertThat(new EntryKey(USER_1, NameType.user, true).serialize())
             .isEqualTo(MailboxACL.DEFAULT_NEGATIVE_MARKER + USER_1);
     }
 
     @Test
-    public void testSerializeGroup() throws UnsupportedRightException {
+    void testSerializeGroup() {
         assertThat(new EntryKey(GROUP_1, NameType.group, false).serialize())
             .isEqualTo(MailboxACL.DEFAULT_GROUP_MARKER + GROUP_1);
     }
 
     @Test
-    public void testSerializeNegativeGroup() throws UnsupportedRightException {
+    void testSerializeNegativeGroup() {
         assertThat(new EntryKey(GROUP_1, NameType.group, true).serialize())
             .isEqualTo(String.valueOf(MailboxACL.DEFAULT_NEGATIVE_MARKER) + MailboxACL.DEFAULT_GROUP_MARKER + GROUP_1);
     }
 
     @Test
-    public void testSerializeOwner() throws UnsupportedRightException {
+    void testSerializeOwner() {
         assertThat(new EntryKey(SpecialName.owner.toString(), NameType.special, false).serialize())
             .isEqualTo(SpecialName.owner.toString());
     }
 
     @Test
-    public void testSerializeNegativeOwner() throws UnsupportedRightException {
+    void testSerializeNegativeOwner() {
         assertThat(new EntryKey(SpecialName.owner.toString(), NameType.special, true).serialize())
             .isEqualTo(MailboxACL.DEFAULT_NEGATIVE_MARKER + SpecialName.owner.toString());
     }
 
     @Test
-    public void testSerializeAnybody() throws UnsupportedRightException {
+    void testSerializeAnybody() {
         assertThat(new EntryKey(SpecialName.anybody.toString(), NameType.special, false).serialize())
             .isEqualTo(SpecialName.anybody.toString());
     }
 
     @Test
-    public void testSerializeNegativeAnybody() throws UnsupportedRightException {
+    void testSerializeNegativeAnybody() {
         assertThat(new EntryKey(SpecialName.anybody.toString(), NameType.special, true).serialize())
             .isEqualTo(MailboxACL.DEFAULT_NEGATIVE_MARKER + SpecialName.anybody.toString());
     }
 
     @Test
-    public void testSerializeAuthenticated() throws UnsupportedRightException {
+    void testSerializeAuthenticated() {
         assertThat(new EntryKey(SpecialName.authenticated.toString(), NameType.special, false).serialize())
             .isEqualTo(SpecialName.authenticated.toString());
     }
 
     @Test
-    public void testSerializeNegativeAuthenticated() throws UnsupportedRightException {
+    void testSerializeNegativeAuthenticated() {
         assertThat(new EntryKey(SpecialName.authenticated.toString(), NameType.special, true).serialize())
             .isEqualTo(MailboxACL.DEFAULT_NEGATIVE_MARKER + SpecialName.authenticated.toString());
     }
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxACLTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxACLTest.java
index fd0e05d..8282c9d 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxACLTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxACLTest.java
@@ -32,12 +32,12 @@ import org.apache.james.mailbox.model.MailboxACL.EntryKey;
 import org.apache.james.mailbox.model.MailboxACL.NameType;
 import org.apache.james.mailbox.model.MailboxACL.Rfc4314Rights;
 import org.assertj.core.data.MapEntry;
-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.ImmutableMap;
 
-public class MailboxACLTest {
+class MailboxACLTest {
 
     private static final String USER_1 = "user1";
     private static final String USER_2 = "user2";
@@ -53,8 +53,8 @@ public class MailboxACLTest {
 
     private MailboxACL u1u2g1g2ACL;
 
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    void setUp() throws Exception {
 
         u1u2g1g2Properties = new Properties();
 
@@ -68,7 +68,7 @@ public class MailboxACLTest {
     }
 
     @Test
-    public void testUnionACLNew() throws UnsupportedRightException {
+    void testUnionACLNew() throws UnsupportedRightException {
 
         Map<EntryKey, Rfc4314Rights> expectedEntries = new HashMap<>(u1u2g1g2ACL.getEntries());
         expectedEntries.put(MailboxACL.OWNER_KEY, MailboxACL.FULL_RIGHTS);
@@ -82,7 +82,7 @@ public class MailboxACLTest {
     }
 
     @Test
-    public void testUnionEntryNew() throws UnsupportedRightException {
+    void testUnionEntryNew() throws UnsupportedRightException {
 
         Map<EntryKey, Rfc4314Rights> expectedEntries = new HashMap<>(u1u2g1g2ACL.getEntries());
         expectedEntries.put(MailboxACL.OWNER_KEY, MailboxACL.FULL_RIGHTS);
@@ -95,7 +95,7 @@ public class MailboxACLTest {
     }
 
     @Test
-    public void testUnionACLExisting() throws UnsupportedRightException {
+    void testUnionACLExisting() throws UnsupportedRightException {
 
         Map<EntryKey, Rfc4314Rights> expectedEntries = new HashMap<>(u1u2g1g2ACL.getEntries());
         expectedEntries.put(EntryKey.deserialize(USER_1), Rfc4314Rights.fromSerializedRfc4314Rights(aeik + lprs));
@@ -109,7 +109,7 @@ public class MailboxACLTest {
     }
 
     @Test
-    public void testUnionEntryExisting() throws UnsupportedRightException {
+    void testUnionEntryExisting() throws UnsupportedRightException {
 
         Map<EntryKey, Rfc4314Rights> expectedEntries = new HashMap<>(u1u2g1g2ACL.getEntries());
         expectedEntries.put(EntryKey.deserialize(USER_1), Rfc4314Rights.fromSerializedRfc4314Rights(aeik + lprs));
@@ -122,17 +122,17 @@ public class MailboxACLTest {
     }
 
     @Test
-    public void testUnionACLZero() throws UnsupportedRightException {
+    void testUnionACLZero() throws UnsupportedRightException {
 
     }
 
     @Test
-    public void testUnionEntryZero() throws UnsupportedRightException {
+    void testUnionEntryZero() throws UnsupportedRightException {
 
     }
 
     @Test
-    public void testExceptACLNew() throws UnsupportedRightException {
+    void testExceptACLNew() throws UnsupportedRightException {
 
         /* actually no change expected */
         Map<EntryKey, Rfc4314Rights> expectedEntries = new HashMap<>(u1u2g1g2ACL.getEntries());
@@ -146,7 +146,7 @@ public class MailboxACLTest {
     }
 
     @Test
-    public void testExceptEntryNew() throws UnsupportedRightException {
+    void testExceptEntryNew() throws UnsupportedRightException {
 
         /* actually no change expected */
         Map<EntryKey, Rfc4314Rights> expectedEntries = new HashMap<>(u1u2g1g2ACL.getEntries());
@@ -159,7 +159,7 @@ public class MailboxACLTest {
     }
 
     @Test
-    public void testExceptACLExisting() throws UnsupportedRightException {
+    void testExceptACLExisting() throws UnsupportedRightException {
 
         Map<EntryKey, Rfc4314Rights> expectedEntries = new HashMap<>(u1u2g1g2ACL.getEntries());
         expectedEntries.put(EntryKey.deserialize(USER_1), Rfc4314Rights.fromSerializedRfc4314Rights(ik));
@@ -173,7 +173,7 @@ public class MailboxACLTest {
     }
 
     @Test
-    public void testExceptEntryExisting() throws UnsupportedRightException {
+    void testExceptEntryExisting() throws UnsupportedRightException {
 
         Map<EntryKey, Rfc4314Rights> expectedEntries = new HashMap<>(u1u2g1g2ACL.getEntries());
         expectedEntries.put(EntryKey.deserialize(USER_1), Rfc4314Rights.fromSerializedRfc4314Rights(ik));
@@ -186,7 +186,7 @@ public class MailboxACLTest {
     }
 
     @Test
-    public void testExceptACLFull() throws UnsupportedRightException {
+    void testExceptACLFull() throws UnsupportedRightException {
 
         Map<EntryKey, Rfc4314Rights> expectedEntries = new HashMap<>(u1u2g1g2ACL.getEntries());
         expectedEntries.remove(EntryKey.deserialize(USER_1));
@@ -200,7 +200,7 @@ public class MailboxACLTest {
     }
 
     @Test
-    public void testExceptEntryFull() throws UnsupportedRightException {
+    void testExceptEntryFull() throws UnsupportedRightException {
 
         Map<EntryKey, Rfc4314Rights> expectedEntries = new HashMap<>(u1u2g1g2ACL.getEntries());
         expectedEntries.remove(EntryKey.deserialize(USER_1));
@@ -213,26 +213,26 @@ public class MailboxACLTest {
     }
 
     @Test
-    public void propertiesConstructorShouldAcceptNullValues() throws Exception {
+    void propertiesConstructorShouldAcceptNullValues() throws Exception {
         assertThat(new MailboxACL((Properties) null))
             .isEqualTo(MailboxACL.EMPTY);
     }
 
     @Test
-    public void applyShouldNotThrowWhenRemovingANonExistingEntry() throws Exception {
+    void applyShouldNotThrowWhenRemovingANonExistingEntry() throws Exception {
         assertThat(MailboxACL.EMPTY
             .apply(MailboxACL.command().forUser("bob").noRights().asReplacement()))
             .isEqualTo(MailboxACL.EMPTY);
     }
 
     @Test
-    public void usersACLShouldReturnEmptyMapWhenEmpty() {
+    void usersACLShouldReturnEmptyMapWhenEmpty() {
         assertThat(MailboxACL.EMPTY.ofPositiveNameType(NameType.user))
             .isEmpty();
     }
 
     @Test
-    public void usersACLShouldReturnEmptyMapWhenNoUserEntry() {
+    void usersACLShouldReturnEmptyMapWhenNoUserEntry() {
         MailboxACL mailboxACL = new MailboxACL(
                 ImmutableMap.of(EntryKey.createGroupEntryKey("group"), MailboxACL.FULL_RIGHTS,
                     EntryKey.createGroupEntryKey("group2"), MailboxACL.NO_RIGHTS));
@@ -241,7 +241,7 @@ public class MailboxACLTest {
     }
 
     @Test
-    public void usersACLShouldReturnOnlyUsersMapWhenSomeUserEntries() throws Exception {
+    void usersACLShouldReturnOnlyUsersMapWhenSomeUserEntries() throws Exception {
         MailboxACL.Rfc4314Rights rights = MailboxACL.Rfc4314Rights.fromSerializedRfc4314Rights("aei");
         MailboxACL mailboxACL = new MailboxACL(
             ImmutableMap.of(EntryKey.createUserEntryKey("user1"), MailboxACL.FULL_RIGHTS,
@@ -255,7 +255,7 @@ public class MailboxACLTest {
     }
 
     @Test
-    public void ofPositiveNameTypeShouldFilterOutNegativeEntries() throws Exception {
+    void ofPositiveNameTypeShouldFilterOutNegativeEntries() throws Exception {
         MailboxACL mailboxACL = new MailboxACL(
             ImmutableMap.of(EntryKey.createUserEntryKey("user1", NEGATIVE), MailboxACL.FULL_RIGHTS));
         assertThat(mailboxACL.ofPositiveNameType(NameType.user))
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxAnnotationKeyTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxAnnotationKeyTest.java
index 4b5986e..d9dfd82 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxAnnotationKeyTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxAnnotationKeyTest.java
@@ -20,109 +20,123 @@
 package org.apache.james.mailbox.model;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-public class MailboxAnnotationKeyTest {
-    @Test(expected = IllegalArgumentException.class)
-    public void newInstanceShouldThrowsExceptionWhenKeyDoesNotStartWithSlash() throws Exception {
-        new MailboxAnnotationKey("shared");
+class MailboxAnnotationKeyTest {
+    @Test
+    void newInstanceShouldThrowsExceptionWhenKeyDoesNotStartWithSlash() {
+        assertThatThrownBy(() -> new MailboxAnnotationKey("shared"))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void newInstanceShouldThrowsExceptionWhenKeyContainsAsterisk() throws Exception {
-        new MailboxAnnotationKey("/private/key*comment");
+    @Test
+    void newInstanceShouldThrowsExceptionWhenKeyContainsAsterisk() {
+        assertThatThrownBy(() -> new MailboxAnnotationKey("/private/key*comment"))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void newInstanceShouldThrowsExceptionWhenKeyContainsPercent() throws Exception {
-        new MailboxAnnotationKey("/private/key%comment");
+    @Test
+    void newInstanceShouldThrowsExceptionWhenKeyContainsPercent() {
+        assertThatThrownBy(() -> new MailboxAnnotationKey("/private/key%comment"))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void validKeyShouldThrowsExceptionWhenKeyContainsTwoConsecutiveSlash() throws Exception {
-        new MailboxAnnotationKey("/private//keycomment");
+    @Test
+    void validKeyShouldThrowsExceptionWhenKeyContainsTwoConsecutiveSlash() {
+        assertThatThrownBy(() -> new MailboxAnnotationKey("/private//keycomment"))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void validKeyShouldThrowsExceptionWhenKeyEndsWithSlash() throws Exception {
-        new MailboxAnnotationKey("/private/keycomment/");
+    @Test
+    void validKeyShouldThrowsExceptionWhenKeyEndsWithSlash() {
+        assertThatThrownBy(() -> new MailboxAnnotationKey("/private/keycomment/"))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void validKeyShouldThrowsExceptionWhenKeyContainsNonASCII() throws Exception {
-        new MailboxAnnotationKey("/private/key comment");
+    @Test
+    void validKeyShouldThrowsExceptionWhenKeyContainsNonASCII() {
+        assertThatThrownBy(() -> new MailboxAnnotationKey("/private/key comment"))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void validKeyShouldThrowsExceptionWhenKeyContainsTabCharacter() throws Exception {
-        new MailboxAnnotationKey("/private/key\tcomment");
+    @Test
+    void validKeyShouldThrowsExceptionWhenKeyContainsTabCharacter() {
+        assertThatThrownBy(() -> new MailboxAnnotationKey("/private/key\tcomment"))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void newInstanceShouldThrowsExceptionWithEmptyKey() throws Exception {
-        new MailboxAnnotationKey("");
+    @Test
+    void newInstanceShouldThrowsExceptionWithEmptyKey() {
+        assertThatThrownBy(() -> new MailboxAnnotationKey(""))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void newInstanceShouldThrowsExceptionWithBlankKey() throws Exception {
-        new MailboxAnnotationKey("    ");
+    @Test
+    void newInstanceShouldThrowsExceptionWithBlankKey() {
+        assertThatThrownBy(() -> new MailboxAnnotationKey("    "))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void newInstanceShouldReturnRightKeyValue() throws Exception {
+    void newInstanceShouldReturnRightKeyValue() {
         MailboxAnnotationKey annotationKey = new MailboxAnnotationKey("/private/comment");
         assertThat(annotationKey.asString()).isEqualTo("/private/comment");
     }
 
     @Test
-    public void keyValueShouldBeCaseInsensitive() throws Exception {
+    void keyValueShouldBeCaseInsensitive() {
         MailboxAnnotationKey annotationKey = new MailboxAnnotationKey("/private/comment");
         MailboxAnnotationKey anotherAnnotationKey = new MailboxAnnotationKey("/PRIVATE/COMMENT");
 
         assertThat(annotationKey).isEqualTo(anotherAnnotationKey);
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void newInstanceShouldThrowsExceptionWhenKeyContainsPunctuationCharacters() throws Exception {
-        new MailboxAnnotationKey("/private/+comment");
+    @Test
+    void newInstanceShouldThrowsExceptionWhenKeyContainsPunctuationCharacters() {
+        assertThatThrownBy(() -> new MailboxAnnotationKey("/private/+comment"))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void countSlashShouldReturnRightNumberOfSlash() throws Exception {
+    void countSlashShouldReturnRightNumberOfSlash() {
         MailboxAnnotationKey annotationKey = new MailboxAnnotationKey("/private/comment/user/name");
         assertThat(annotationKey.countComponents()).isEqualTo(4);
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void keyMustContainAtLeastTwoComponents() throws Exception {
-        new MailboxAnnotationKey("/private");
+    @Test
+    void keyMustContainAtLeastTwoComponents() {
+        assertThatThrownBy(() -> new MailboxAnnotationKey("/private"))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void keyVendorShouldThrowsExceptionWithTwoComponents() throws Exception {
-        new MailboxAnnotationKey("/private/vendor");
+    @Test
+    void keyVendorShouldThrowsExceptionWithTwoComponents() {
+        assertThatThrownBy(() -> new MailboxAnnotationKey("/private/vendor"))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void keyVendorShouldThrowsExceptionWithThreeComponents() throws Exception {
-        new MailboxAnnotationKey("/shared/vendor/token");
+    @Test
+    void keyVendorShouldThrowsExceptionWithThreeComponents() {
+        assertThatThrownBy(() -> new MailboxAnnotationKey("/shared/vendor/token"))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void keyVendorShouldOKWithFourComponents() throws Exception {
+    void keyVendorShouldOKWithFourComponents() {
         new MailboxAnnotationKey("/shared/vendor/token/comment");
     }
 
     @Test
-    public void isParentOrIsEqualShouldReturnTrueWhenSameKey() {
+    void isParentOrIsEqualShouldReturnTrueWhenSameKey() {
         MailboxAnnotationKey key1 = new MailboxAnnotationKey("/private/comment");
 
         assertThat(key1.isParentOrIsEqual(key1)).isTrue();
     }
 
     @Test
-    public void isParentOrIsEqualShouldReturnTrueWhenParent() {
+    void isParentOrIsEqualShouldReturnTrueWhenParent() {
         MailboxAnnotationKey key1 = new MailboxAnnotationKey("/private/comment");
         MailboxAnnotationKey key2 = new MailboxAnnotationKey("/private/comment/toto");
 
@@ -130,7 +144,7 @@ public class MailboxAnnotationKeyTest {
     }
 
     @Test
-    public void isParentOrIsEqualShouldReturnFalseWhenChild() {
+    void isParentOrIsEqualShouldReturnFalseWhenChild() {
         MailboxAnnotationKey key1 = new MailboxAnnotationKey("/private/comment");
         MailboxAnnotationKey key2 = new MailboxAnnotationKey("/private/comment/toto");
 
@@ -138,7 +152,7 @@ public class MailboxAnnotationKeyTest {
     }
 
     @Test
-    public void isParentOrIsEqualShouldReturnFalseWhenGrandParent() {
+    void isParentOrIsEqualShouldReturnFalseWhenGrandParent() {
         MailboxAnnotationKey key1 = new MailboxAnnotationKey("/private/comment");
         MailboxAnnotationKey key2 = new MailboxAnnotationKey("/private/comment/toto/tata");
 
@@ -146,7 +160,7 @@ public class MailboxAnnotationKeyTest {
     }
 
     @Test
-    public void isParentOrIsEqualShouldReturnFalseWhenCousin() {
+    void isParentOrIsEqualShouldReturnFalseWhenCousin() {
         MailboxAnnotationKey key1 = new MailboxAnnotationKey("/private/comment/tutu");
         MailboxAnnotationKey key2 = new MailboxAnnotationKey("/private/comment/toto/tata");
 
@@ -155,14 +169,14 @@ public class MailboxAnnotationKeyTest {
 
 
     @Test
-    public void isAncestorOrIsEqualShouldReturnTrueWhenSameKey() {
+    void isAncestorOrIsEqualShouldReturnTrueWhenSameKey() {
         MailboxAnnotationKey key1 = new MailboxAnnotationKey("/private/comment");
 
         assertThat(key1.isAncestorOrIsEqual(key1)).isTrue();
     }
 
     @Test
-    public void isAncestorOrIsEqualShouldReturnTrueWhenParent() {
+    void isAncestorOrIsEqualShouldReturnTrueWhenParent() {
         MailboxAnnotationKey key1 = new MailboxAnnotationKey("/private/comment");
         MailboxAnnotationKey key2 = new MailboxAnnotationKey("/private/comment/toto");
 
@@ -170,7 +184,7 @@ public class MailboxAnnotationKeyTest {
     }
 
     @Test
-    public void isAncestorOrIsEqualShouldReturnFalseWhenChild() {
+    void isAncestorOrIsEqualShouldReturnFalseWhenChild() {
         MailboxAnnotationKey key1 = new MailboxAnnotationKey("/private/comment");
         MailboxAnnotationKey key2 = new MailboxAnnotationKey("/private/comment/toto");
 
@@ -178,7 +192,7 @@ public class MailboxAnnotationKeyTest {
     }
 
     @Test
-    public void isAncestorOrIsEqualShouldReturnTrueWhenGrandParent() {
+    void isAncestorOrIsEqualShouldReturnTrueWhenGrandParent() {
         MailboxAnnotationKey key1 = new MailboxAnnotationKey("/private/comment");
         MailboxAnnotationKey key2 = new MailboxAnnotationKey("/private/comment/toto/tata");
 
@@ -186,7 +200,7 @@ public class MailboxAnnotationKeyTest {
     }
 
     @Test
-    public void isAncestorOrIsEqualShouldReturnFalseWhenCousin() {
+    void isAncestorOrIsEqualShouldReturnFalseWhenCousin() {
         MailboxAnnotationKey key1 = new MailboxAnnotationKey("/private/comment/tutu");
         MailboxAnnotationKey key2 = new MailboxAnnotationKey("/private/comment/toto/tata");
 
@@ -194,7 +208,7 @@ public class MailboxAnnotationKeyTest {
     }
 
     @Test
-    public void isAncestorOrIsEqualShouldWorkOnCousinKeyUsingKeyAsAPrefix() {
+    void isAncestorOrIsEqualShouldWorkOnCousinKeyUsingKeyAsAPrefix() {
         MailboxAnnotationKey key1 = new MailboxAnnotationKey("/private/comment/tutu");
         MailboxAnnotationKey key2 = new MailboxAnnotationKey("/private/comment/tututata");
 
@@ -202,7 +216,7 @@ public class MailboxAnnotationKeyTest {
     }
 
     @Test
-    public void isParentOrIsEqualShouldWorkOnCousinKeyUsingKeyAsAPrefix() {
+    void isParentOrIsEqualShouldWorkOnCousinKeyUsingKeyAsAPrefix() {
         MailboxAnnotationKey key1 = new MailboxAnnotationKey("/private/comment/tutu");
         MailboxAnnotationKey key2 = new MailboxAnnotationKey("/private/comment/tututata");
 
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxAnnotationTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxAnnotationTest.java
index 583f960..b1d2a81 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxAnnotationTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxAnnotationTest.java
@@ -20,63 +20,61 @@
 package org.apache.james.mailbox.model;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-public class MailboxAnnotationTest {
+class MailboxAnnotationTest {
     private static final MailboxAnnotationKey ANNOTATION_KEY = new MailboxAnnotationKey("/private/comment");
     private static final String ANNOTATION_VALUE = "anyValue";
 
     @Test
-    public void sizeOfAnnotationShouldBeReturnLengthOfValue() throws Exception {
+    void sizeOfAnnotationShouldBeReturnLengthOfValue() {
         MailboxAnnotation mailboxAnnotation = MailboxAnnotation.newInstance(ANNOTATION_KEY, ANNOTATION_VALUE);
 
         assertThat(mailboxAnnotation.size()).isEqualTo(8);
     }
 
     @Test
-    public void sizeOfNilAnnotationShouldBeZero() throws Exception {
+    void sizeOfNilAnnotationShouldBeZero() {
         MailboxAnnotation mailboxAnnotation = MailboxAnnotation.nil(ANNOTATION_KEY);
 
         assertThat(mailboxAnnotation.size()).isEqualTo(0);
     }
     
-    @Test(expected = NullPointerException.class)
-    public void newInstanceShouldThrowsExceptionWithNullKey() throws Exception {
-        MailboxAnnotation.newInstance(null, null);
+    @Test
+    void newInstanceShouldThrowsExceptionWithNullKey() {
+        assertThatThrownBy(() -> MailboxAnnotation.newInstance(null, null))
+            .isInstanceOf(NullPointerException.class);
     }
 
-    @Test(expected = NullPointerException.class)
-    public void newInstanceShouldThrowsExceptionWithNullValue() throws Exception {
-        MailboxAnnotation.newInstance(ANNOTATION_KEY, null);
+    @Test
+    void newInstanceShouldThrowsExceptionWithNullValue() {
+        assertThatThrownBy(() -> MailboxAnnotation.newInstance(ANNOTATION_KEY, null))
+            .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void nilInstanceShouldReturnAbsentValue() throws Exception {
+    void nilInstanceShouldReturnAbsentValue() {
         MailboxAnnotation annotation = MailboxAnnotation.nil(ANNOTATION_KEY);
 
         assertThat(annotation.getValue()).isEmpty();
     }
 
     @Test
-    public void isNilShouldReturnTrueForNilObject() throws Exception {
+    void isNilShouldReturnTrueForNilObject() {
         MailboxAnnotation nilAnnotation = MailboxAnnotation.nil(ANNOTATION_KEY);
         assertThat(nilAnnotation.isNil()).isTrue();
     }
 
     @Test
-    public void isNilShouldReturnFalseForNotNilObject() throws Exception {
+    void isNilShouldReturnFalseForNotNilObject() {
         MailboxAnnotation nilAnnotation = MailboxAnnotation.newInstance(ANNOTATION_KEY, ANNOTATION_VALUE);
         assertThat(nilAnnotation.isNil()).isFalse();
     }
 
-    @Test(expected = NullPointerException.class)
-    public void newInstanceMailboxAnnotationShouldThrowExceptionWithNullValue() throws Exception {
-        MailboxAnnotation.newInstance(ANNOTATION_KEY, null);
-    }
-
     @Test
-    public void newInstanceMailboxAnnotationShouldCreateNewInstance() throws Exception {
+    void newInstanceMailboxAnnotationShouldCreateNewInstance() {
         MailboxAnnotation annotation = MailboxAnnotation.newInstance(ANNOTATION_KEY, ANNOTATION_VALUE);
 
         assertThat(annotation.getKey()).isEqualTo(ANNOTATION_KEY);
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxAssertTests.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxAssertTests.java
index f006308..62f8bae 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxAssertTests.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxAssertTests.java
@@ -19,64 +19,77 @@
 
 package org.apache.james.mailbox.model;
 
-import org.junit.Test;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
-public class MailboxAssertTests {
+import org.junit.jupiter.api.Test;
+
+class MailboxAssertTests {
 
     private static final long UID_VALIDITY = 42;
     private static final TestId MAILBOX_ID = TestId.of(24);
 
     @Test
-    public void isEqualToShouldNotFailWithEqualMailbox() {
+    void isEqualToShouldNotFailWithEqualMailbox() {
         Mailbox mailbox1 = new Mailbox(MailboxPath.forUser("user", "name"), UID_VALIDITY);
         Mailbox mailbox2 = new Mailbox(MailboxPath.forUser("user", "name"), UID_VALIDITY);
         mailbox1.setMailboxId(MAILBOX_ID);
         mailbox2.setMailboxId(MAILBOX_ID);
+
         MailboxAssert.assertThat(mailbox1).isEqualTo(mailbox2);
     }
 
-    @Test(expected = AssertionError.class)
-    public void isEqualToShouldFailWithNotEqualNamespace() {
+    @Test
+    void isEqualToShouldFailWithNotEqualNamespace() {
         Mailbox mailbox1 = new Mailbox(MailboxPath.forUser("user", "name"), UID_VALIDITY);
         Mailbox mailbox2 = new Mailbox(new MailboxPath("other_namespace", "user", "name"), UID_VALIDITY);
         mailbox1.setMailboxId(MAILBOX_ID);
         mailbox2.setMailboxId(MAILBOX_ID);
-        MailboxAssert.assertThat(mailbox1).isEqualTo(mailbox2);
+
+        assertThatThrownBy(() -> MailboxAssert.assertThat(mailbox1).isEqualTo(mailbox2))
+            .isInstanceOf(AssertionError.class);
     }
 
-    @Test(expected = AssertionError.class)
-    public void isEqualToShouldFailWithNotEqualUser() {
+    @Test
+    void isEqualToShouldFailWithNotEqualUser() {
         Mailbox mailbox1 = new Mailbox(MailboxPath.forUser("user", "name"), UID_VALIDITY);
         Mailbox mailbox2 = new Mailbox(new MailboxPath("namespace", "other_user", "name"), UID_VALIDITY);
         mailbox1.setMailboxId(MAILBOX_ID);
         mailbox2.setMailboxId(MAILBOX_ID);
-        MailboxAssert.assertThat(mailbox1).isEqualTo(mailbox2);
+
+        assertThatThrownBy(() -> MailboxAssert.assertThat(mailbox1).isEqualTo(mailbox2))
+            .isInstanceOf(AssertionError.class);
     }
 
-    @Test(expected = AssertionError.class)
-    public void isEqualToShouldFailWithNotEqualName() {
+    @Test
+    void isEqualToShouldFailWithNotEqualName() {
         Mailbox mailbox1 = new Mailbox(MailboxPath.forUser("user", "name"), UID_VALIDITY);
         Mailbox mailbox2 = new Mailbox(new MailboxPath("namespace", "user", "other_name"), UID_VALIDITY);
         mailbox1.setMailboxId(MAILBOX_ID);
         mailbox2.setMailboxId(MAILBOX_ID);
-        MailboxAssert.assertThat(mailbox1).isEqualTo(mailbox2);
+
+        assertThatThrownBy(() -> MailboxAssert.assertThat(mailbox1).isEqualTo(mailbox2))
+            .isInstanceOf(AssertionError.class);
     }
 
-    @Test(expected = AssertionError.class)
-    public void isEqualToShouldFailWithNotEqualId() {
+    @Test
+    void isEqualToShouldFailWithNotEqualId() {
         Mailbox mailbox1 = new Mailbox(MailboxPath.forUser("user", "name"), UID_VALIDITY);
         Mailbox mailbox2 = new Mailbox(MailboxPath.forUser("user", "name"), UID_VALIDITY);
         mailbox1.setMailboxId(MAILBOX_ID);
         mailbox2.setMailboxId(TestId.of(MAILBOX_ID.id + 1));
-        MailboxAssert.assertThat(mailbox1).isEqualTo(mailbox2);
+
+        assertThatThrownBy(() -> MailboxAssert.assertThat(mailbox1).isEqualTo(mailbox2))
+            .isInstanceOf(AssertionError.class);
     }
 
-    @Test(expected = AssertionError.class)
-    public void isEqualToShouldFailWithNotEqualUidValidity() {
+    @Test
+    void isEqualToShouldFailWithNotEqualUidValidity() {
         Mailbox mailbox1 = new Mailbox(MailboxPath.forUser("user", "name"), UID_VALIDITY);
         Mailbox mailbox2 = new Mailbox(MailboxPath.forUser("user", "name"), UID_VALIDITY + 1);
         mailbox1.setMailboxId(MAILBOX_ID);
         mailbox2.setMailboxId(MAILBOX_ID);
-        MailboxAssert.assertThat(mailbox1).isEqualTo(mailbox2);
+
+        assertThatThrownBy(() -> MailboxAssert.assertThat(mailbox1).isEqualTo(mailbox2))
+            .isInstanceOf(AssertionError.class);
     }
 }
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxCountersTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxCountersTest.java
index e43f2ce..b7efa25 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxCountersTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxCountersTest.java
@@ -20,14 +20,14 @@
 
 package org.apache.james.mailbox.model;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
 
-public class MailboxCountersTest {
+class MailboxCountersTest {
 
     @Test
-    public void mailboxCountersShouldRespectBeanContract() {
+    void mailboxCountersShouldRespectBeanContract() {
         EqualsVerifier.forClass(MailboxCounters.class).verify();
     }
 }
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxPathTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxPathTest.java
index d6606cc..b1817cc 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxPathTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxPathTest.java
@@ -23,20 +23,20 @@ package org.apache.james.mailbox.model;
 import static org.assertj.core.api.Assertions.assertThat;
 
 import org.apache.james.mailbox.DefaultMailboxes;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
 
-public class MailboxPathTest {
+class MailboxPathTest {
 
     @Test
-    public void shouldMatchBeanContract() {
+    void shouldMatchBeanContract() {
         EqualsVerifier.forClass(MailboxPath.class)
             .verify();
     }
 
     @Test
-    public void getHierarchyLevelsShouldBeOrdered() {
+    void getHierarchyLevelsShouldBeOrdered() {
         assertThat(MailboxPath.forUser("user", "inbox.folder.subfolder")
             .getHierarchyLevels('.'))
             .containsExactly(
@@ -46,7 +46,7 @@ public class MailboxPathTest {
     }
 
     @Test
-    public void getHierarchyLevelsShouldReturnPathWhenOneLevel() {
+    void getHierarchyLevelsShouldReturnPathWhenOneLevel() {
         assertThat(MailboxPath.forUser("user", "inbox")
             .getHierarchyLevels('.'))
             .containsExactly(
@@ -54,7 +54,7 @@ public class MailboxPathTest {
     }
 
     @Test
-    public void getHierarchyLevelsShouldReturnPathWhenEmptyName() {
+    void getHierarchyLevelsShouldReturnPathWhenEmptyName() {
         assertThat(MailboxPath.forUser("user", "")
             .getHierarchyLevels('.'))
             .containsExactly(
@@ -62,7 +62,7 @@ public class MailboxPathTest {
     }
 
     @Test
-    public void getHierarchyLevelsShouldReturnPathWhenNullName() {
+    void getHierarchyLevelsShouldReturnPathWhenNullName() {
         assertThat(MailboxPath.forUser("user", null)
             .getHierarchyLevels('.'))
             .containsExactly(
@@ -70,7 +70,7 @@ public class MailboxPathTest {
     }
 
     @Test
-    public void sanitizeShouldNotThrowOnNullMailboxName() {
+    void sanitizeShouldNotThrowOnNullMailboxName() {
         assertThat(MailboxPath.forUser("user", null)
             .sanitize('.'))
             .isEqualTo(
@@ -78,7 +78,7 @@ public class MailboxPathTest {
     }
 
     @Test
-    public void sanitizeShouldReturnEmptyWhenEmpty() {
+    void sanitizeShouldReturnEmptyWhenEmpty() {
         assertThat(MailboxPath.forUser("user", "")
             .sanitize('.'))
             .isEqualTo(
@@ -86,7 +86,7 @@ public class MailboxPathTest {
     }
 
     @Test
-    public void sanitizeShouldRemoveMaximumOneTrailingDelimiterWhenAlone() {
+    void sanitizeShouldRemoveMaximumOneTrailingDelimiterWhenAlone() {
         assertThat(MailboxPath.forUser("user", ".")
             .sanitize('.'))
             .isEqualTo(
@@ -94,7 +94,7 @@ public class MailboxPathTest {
     }
 
     @Test
-    public void sanitizeShouldPreserveHeadingDelimiter() {
+    void sanitizeShouldPreserveHeadingDelimiter() {
         assertThat(MailboxPath.forUser("user", ".a")
             .sanitize('.'))
             .isEqualTo(
@@ -102,7 +102,7 @@ public class MailboxPathTest {
     }
 
     @Test
-    public void sanitizeShouldRemoveTrailingDelimiter() {
+    void sanitizeShouldRemoveTrailingDelimiter() {
         assertThat(MailboxPath.forUser("user", "a.")
             .sanitize('.'))
             .isEqualTo(
@@ -110,7 +110,7 @@ public class MailboxPathTest {
     }
 
     @Test
-    public void sanitizeShouldRemoveMaximumOneTrailingDelimiter() {
+    void sanitizeShouldRemoveMaximumOneTrailingDelimiter() {
         assertThat(MailboxPath.forUser("user", "a..")
             .sanitize('.'))
             .isEqualTo(
@@ -118,7 +118,7 @@ public class MailboxPathTest {
     }
 
     @Test
-    public void sanitizeShouldPreserveRedundantDelimiters() {
+    void sanitizeShouldPreserveRedundantDelimiters() {
         assertThat(MailboxPath.forUser("user", "a..a")
             .sanitize('.'))
             .isEqualTo(
@@ -126,75 +126,75 @@ public class MailboxPathTest {
     }
 
     @Test
-    public void hasEmptyNameInHierarchyShouldBeFalseIfSingleLevelPath() {
+    void hasEmptyNameInHierarchyShouldBeFalseIfSingleLevelPath() {
         assertThat(MailboxPath.forUser("user", "a")
             .hasEmptyNameInHierarchy('.'))
             .isFalse();
     }
 
     @Test
-    public void hasEmptyNameInHierarchyShouldBeFalseIfNestedLevelWithNonEmptyNames() {
+    void hasEmptyNameInHierarchyShouldBeFalseIfNestedLevelWithNonEmptyNames() {
         assertThat(MailboxPath.forUser("user", "a.b.c")
             .hasEmptyNameInHierarchy('.'))
             .isFalse();
     }
 
     @Test
-    public void hasEmptyNameInHierarchyShouldBeTrueIfEmptyPath() {
+    void hasEmptyNameInHierarchyShouldBeTrueIfEmptyPath() {
         assertThat(MailboxPath.forUser("user", "")
             .hasEmptyNameInHierarchy('.'))
             .isTrue();
     }
 
     @Test
-    public void hasEmptyNameInHierarchyShouldBeTrueIfPathWithTwoEmptyNames() {
+    void hasEmptyNameInHierarchyShouldBeTrueIfPathWithTwoEmptyNames() {
         assertThat(MailboxPath.forUser("user", ".")
             .hasEmptyNameInHierarchy('.'))
             .isTrue();
     }
 
     @Test
-    public void hasEmptyNameInHierarchyShouldBeTrueIfPathWithAnEmptyNameBetweenTwoNames() {
+    void hasEmptyNameInHierarchyShouldBeTrueIfPathWithAnEmptyNameBetweenTwoNames() {
         assertThat(MailboxPath.forUser("user", "a..b")
             .hasEmptyNameInHierarchy('.'))
             .isTrue();
     }
 
     @Test
-    public void hasEmptyNameInHierarchyShouldBeTrueIfPathWithHeadingEmptyNames() {
+    void hasEmptyNameInHierarchyShouldBeTrueIfPathWithHeadingEmptyNames() {
         assertThat(MailboxPath.forUser("user", "..a")
             .hasEmptyNameInHierarchy('.'))
             .isTrue();
     }
 
     @Test
-    public void hasEmptyNameInHierarchyShouldBeTrueIfPathWithATrailingEmptyName() {
+    void hasEmptyNameInHierarchyShouldBeTrueIfPathWithATrailingEmptyName() {
         assertThat(MailboxPath.forUser("user", "a.")
             .hasEmptyNameInHierarchy('.'))
             .isTrue();
     }
 
     @Test
-    public void hasEmptyNameInHierarchyShouldBeTrueIfPathWithTrailingEmptyNames() {
+    void hasEmptyNameInHierarchyShouldBeTrueIfPathWithTrailingEmptyNames() {
         assertThat(MailboxPath.forUser("user", "a..")
             .hasEmptyNameInHierarchy('.'))
             .isTrue();
     }
 
     @Test
-    public void isInboxShouldReturnTrueWhenINBOX() {
+    void isInboxShouldReturnTrueWhenINBOX() {
         MailboxPath mailboxPath = new MailboxPath(MailboxConstants.USER_NAMESPACE, "user", DefaultMailboxes.INBOX);
         assertThat(mailboxPath.isInbox()).isTrue();
     }
 
     @Test
-    public void isInboxShouldReturnTrueWhenINBOXWithOtherCase() {
+    void isInboxShouldReturnTrueWhenINBOXWithOtherCase() {
         MailboxPath mailboxPath = new MailboxPath(MailboxConstants.USER_NAMESPACE, "user", "InBoX");
         assertThat(mailboxPath.isInbox()).isTrue();
     }
 
     @Test
-    public void isInboxShouldReturnFalseWhenOtherThanInbox() {
+    void isInboxShouldReturnFalseWhenOtherThanInbox() {
         MailboxPath mailboxPath = new MailboxPath(MailboxConstants.USER_NAMESPACE, "user", DefaultMailboxes.ARCHIVE);
         assertThat(mailboxPath.isInbox()).isFalse();
     }
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/MessageAttachmentTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/MessageAttachmentTest.java
index 16828ae..edbc673 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/MessageAttachmentTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/MessageAttachmentTest.java
@@ -20,27 +20,30 @@
 package org.apache.james.mailbox.model;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import java.util.Optional;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-public class MessageAttachmentTest {
+class MessageAttachmentTest {
 
-    @Test(expected = IllegalStateException.class)
-    public void buildShouldThrowWhenAttachmentIsNotGiven() {
-        MessageAttachment.builder()
-            .build();
+    @Test
+    void buildShouldThrowWhenAttachmentIsNotGiven() {
+        assertThatThrownBy(() -> MessageAttachment.builder()
+                .build())
+            .isInstanceOf(IllegalStateException.class);
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void builderShouldThrowWhenAttachmentIsNull() {
-        MessageAttachment.builder()
-            .attachment(null);
+    @Test
+    void builderShouldThrowWhenAttachmentIsNull() {
+        assertThatThrownBy(() -> MessageAttachment.builder()
+                .attachment(null))
+            .isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void buildShouldWorkWhenMandatoryAttributesAreGiven() {
+    void buildShouldWorkWhenMandatoryAttributesAreGiven() {
         Attachment attachment = Attachment.builder()
                 .bytes("content".getBytes())
                 .type("type")
@@ -55,7 +58,7 @@ public class MessageAttachmentTest {
     }
 
     @Test
-    public void buildShouldAcceptIsInlineAndNoCid() {
+    void buildShouldAcceptIsInlineAndNoCid() {
         Attachment attachment = Attachment.builder()
                 .bytes("content".getBytes())
                 .type("type")
@@ -70,7 +73,7 @@ public class MessageAttachmentTest {
     }
 
     @Test
-    public void buildShouldSetAttributesWhenAllAreGiven() {
+    void buildShouldSetAttributesWhenAllAreGiven() {
         Attachment attachment = Attachment.builder()
                 .bytes("content".getBytes())
                 .type("type")
@@ -88,7 +91,7 @@ public class MessageAttachmentTest {
     }
 
     @Test
-    public void isInlinedWithCidShouldReturnTrueWhenIsInlineAndHasCid() throws Exception {
+    void isInlinedWithCidShouldReturnTrueWhenIsInlineAndHasCid() throws Exception {
         Attachment attachment = Attachment.builder()
             .bytes("content".getBytes())
             .type("type")
@@ -105,7 +108,7 @@ public class MessageAttachmentTest {
     }
 
     @Test
-    public void isInlinedWithCidShouldReturnFalseWhenIsNotInline() throws Exception {
+    void isInlinedWithCidShouldReturnFalseWhenIsNotInline() throws Exception {
         Attachment attachment = Attachment.builder()
             .bytes("content".getBytes())
             .type("type")
@@ -122,7 +125,7 @@ public class MessageAttachmentTest {
     }
 
     @Test
-    public void isInlinedWithCidShouldReturnFalseWhenIsInlineButNoCid() throws Exception {
+    void isInlinedWithCidShouldReturnFalseWhenIsInlineButNoCid() throws Exception {
         Attachment attachment = Attachment.builder()
             .bytes("content".getBytes())
             .type("type")
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/MessageIdDtoTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/MessageIdDtoTest.java
index 0c7e74d..e55022b 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/MessageIdDtoTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/MessageIdDtoTest.java
@@ -21,11 +21,11 @@ package org.apache.james.mailbox.model;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
 
-public class MessageIdDtoTest {
+class MessageIdDtoTest {
 
     private static final TestMessageId.Factory factory = new TestMessageId.Factory();
     private static final Long SAMPLE_ID_VALUE = 42L;
@@ -33,37 +33,38 @@ public class MessageIdDtoTest {
     private static final TestMessageId SAMPLE_ID = TestMessageId.of(SAMPLE_ID_VALUE);
 
     @Test
-    public void shouldRespectJavaBeanContract() {
+    void shouldRespectJavaBeanContract() {
         EqualsVerifier.forClass(MessageIdDto.class).verify();
     }
 
     @Test
-    public void shouldAcceptStringAndGiveItBack() {
+    void shouldAcceptStringAndGiveItBack() {
         assertThat(new MessageIdDto(SAMPLE_ID_STRING).asString())
             .isEqualTo(SAMPLE_ID_STRING);
     }
 
     @Test
-    public void shouldAcceptMessageIdAndGiveTheRightString() {
+    void shouldAcceptMessageIdAndGiveTheRightString() {
         assertThat(new MessageIdDto(SAMPLE_ID).asString())
             .isEqualTo(SAMPLE_ID_STRING);
     }
 
     @Test
-    public void shouldAcceptMessageIdAndGiveItBack() {
+    void shouldAcceptMessageIdAndGiveItBack() {
         assertThat(new MessageIdDto(SAMPLE_ID).instantiate(factory))
             .isEqualTo(SAMPLE_ID);
     }
 
     @Test
-    public void shouldAcceptStringAndGiveAnInstantiatedMessageId() {
+    void shouldAcceptStringAndGiveAnInstantiatedMessageId() {
         assertThat(new MessageIdDto(SAMPLE_ID_STRING).instantiate(factory))
             .isEqualTo(SAMPLE_ID);
     }
 
     @Test
-    public void shouldThrowAnExceptionOnWronglyFormattedString() {
+    void shouldThrowAnExceptionOnWronglyFormattedString() {
         MessageIdDto messageIdDto = new MessageIdDto("Definitively not a number");
+
         assertThatThrownBy(() -> messageIdDto.instantiate(factory))
             .isInstanceOf(Exception.class);
     }
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/MessageRangeTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/MessageRangeTest.java
index 58e07d3..ab10eb0 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/MessageRangeTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/MessageRangeTest.java
@@ -1,155 +1,154 @@
-/****************************************************************
- * 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.model;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.james.mailbox.MessageUid;
-import org.apache.james.mailbox.model.MessageRange;
-import org.junit.Test;
-
-public class MessageRangeTest {
-
-    @Test
-    public void givenSomeNumbersToRangeShouldReturnThreeRanges() {
-        List<MessageRange> ranges = MessageRange.toRanges(
-                Arrays.asList(
-                        MessageUid.of(1L),
-                        MessageUid.of(2L),
-                        MessageUid.of(3L),
-                        MessageUid.of(5L),
-                        MessageUid.of(6L),
-                        MessageUid.of(9L)));
-        assertThat(ranges).containsExactly(
-                MessageRange.range(MessageUid.of(1), MessageUid.of(3)), 
-                MessageRange.range(MessageUid.of(5), MessageUid.of(6)), 
-                MessageUid.of(9).toRange());
-    }
-    
-    @Test
-    public void givenASingleNumberToRangeShouldReturnOneRange() {
-        List<MessageRange> ranges = MessageRange.toRanges(Arrays.asList(MessageUid.of(1L)));
-        assertThat(ranges).containsExactly(MessageUid.of(1).toRange());
-    }
-    
-    // Test for MAILBOX-56
-    @Test
-    public void testTwoSeqUidToRange() {
-        List<MessageRange> ranges = MessageRange.toRanges(Arrays.asList(MessageUid.of(1L), MessageUid.of(2L)));
-        assertThat(ranges).containsExactly(MessageRange.range(MessageUid.of(1), MessageUid.of(2)));
-    }
-    
-    @Test
-    public void splitASingletonRangeShouldReturnASingleRange() {
-        MessageRange one = MessageUid.of(1).toRange();
-        List<MessageRange> ranges = one.split(2);
-        assertThat(ranges).containsExactly(MessageUid.of(1).toRange());
-    }
-
-    @Test
-    public void splitUnboundedRangeShouldReturnTheSameRange() {
-        MessageRange from = MessageRange.from(MessageUid.of(1));
-        List<MessageRange> ranges = from.split(2);
-        assertThat(ranges).containsExactly(MessageRange.from(MessageUid.of(1)));
-    }
-    
-    @Test
-    public void splitTenElementsRangeShouldReturn4Ranges() {
-        MessageRange range = MessageRange.range(MessageUid.of(1),MessageUid.of(10));
-        List<MessageRange> ranges = range.split(3);
-        assertThat(ranges).containsExactly(
-                MessageRange.range(MessageUid.of(1), MessageUid.of(3)), 
-                MessageRange.range(MessageUid.of(4), MessageUid.of(6)), 
-                MessageRange.range(MessageUid.of(7), MessageUid.of(9)), 
-                MessageUid.of(10).toRange());
-    }
-
-    @Test
-    public void includeShouldBeTrueWhenAfterFrom() {
-        MessageRange range = MessageRange.from(MessageUid.of(3));
-        boolean actual = range.includes(MessageUid.of(5));
-        assertThat(actual).isTrue();
-    }
-
-    @Test
-    public void includeShouldBeFalseWhenBeforeFrom() {
-        MessageRange range = MessageRange.from(MessageUid.of(3));
-        boolean actual = range.includes(MessageUid.of(1));
-        assertThat(actual).isFalse();
-    }
-
-    @Test
-    public void includeShouldBeTrueWhenEqualsFrom() {
-        MessageRange range = MessageRange.from(MessageUid.of(3));
-        boolean actual = range.includes(MessageUid.of(3));
-        assertThat(actual).isTrue();
-    }
-
-    @Test
-    public void includeShouldBeFalseWhenDifferentOne() {
-        MessageRange range = MessageUid.of(3).toRange();
-        boolean actual = range.includes(MessageUid.of(1));
-        assertThat(actual).isFalse();
-    }
-
-    @Test
-    public void includeShouldBeTrueWhenEqualsOne() {
-        MessageRange range = MessageUid.of(3).toRange();
-        boolean actual = range.includes(MessageUid.of(3));
-        assertThat(actual).isTrue();
-    }
-
-    @Test
-    public void includeShouldBeFalseWhenBeforeRange() {
-        MessageRange range = MessageRange.range(MessageUid.of(3), MessageUid.of(6));
-        boolean actual = range.includes(MessageUid.of(1));
-        assertThat(actual).isFalse();
-    }
-
-    @Test
-    public void includeShouldBeTrueWhenEqualsFromRange() {
-        MessageRange range = MessageRange.range(MessageUid.of(3), MessageUid.of(6));
-        boolean actual = range.includes(MessageUid.of(3));
-        assertThat(actual).isTrue();
-    }
-
-    @Test
-    public void includeShouldBeTrueWhenInRange() {
-        MessageRange range = MessageRange.range(MessageUid.of(3), MessageUid.of(6));
-        boolean actual = range.includes(MessageUid.of(4));
-        assertThat(actual).isTrue();
-    }
-
-    @Test
-    public void includeShouldBeTrueWhenEqualsToRange() {
-        MessageRange range = MessageRange.range(MessageUid.of(3), MessageUid.of(6));
-        boolean actual = range.includes(MessageUid.of(6));
-        assertThat(actual).isTrue();
-    }
-
-    @Test
-    public void includeShouldBeFalseWhenAfterRange() {
-        MessageRange range = MessageRange.range(MessageUid.of(3), MessageUid.of(6));
-        boolean actual = range.includes(MessageUid.of(7));
-        assertThat(actual).isFalse();
-    }
-}
+/****************************************************************
+ * 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.model;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.james.mailbox.MessageUid;
+import org.junit.jupiter.api.Test;
+
+class MessageRangeTest {
+
+    @Test
+    void givenSomeNumbersToRangeShouldReturnThreeRanges() {
+        List<MessageRange> ranges = MessageRange.toRanges(
+                Arrays.asList(
+                        MessageUid.of(1L),
+                        MessageUid.of(2L),
+                        MessageUid.of(3L),
+                        MessageUid.of(5L),
+                        MessageUid.of(6L),
+                        MessageUid.of(9L)));
+        assertThat(ranges).containsExactly(
+                MessageRange.range(MessageUid.of(1), MessageUid.of(3)), 
+                MessageRange.range(MessageUid.of(5), MessageUid.of(6)), 
+                MessageUid.of(9).toRange());
+    }
+    
+    @Test
+    void givenASingleNumberToRangeShouldReturnOneRange() {
+        List<MessageRange> ranges = MessageRange.toRanges(Arrays.asList(MessageUid.of(1L)));
+        assertThat(ranges).containsExactly(MessageUid.of(1).toRange());
+    }
+    
+    // Test for MAILBOX-56
+    @Test
+    void testTwoSeqUidToRange() {
+        List<MessageRange> ranges = MessageRange.toRanges(Arrays.asList(MessageUid.of(1L), MessageUid.of(2L)));
+        assertThat(ranges).containsExactly(MessageRange.range(MessageUid.of(1), MessageUid.of(2)));
+    }
+    
+    @Test
+    void splitASingletonRangeShouldReturnASingleRange() {
+        MessageRange one = MessageUid.of(1).toRange();
+        List<MessageRange> ranges = one.split(2);
+        assertThat(ranges).containsExactly(MessageUid.of(1).toRange());
+    }
+
+    @Test
+    void splitUnboundedRangeShouldReturnTheSameRange() {
+        MessageRange from = MessageRange.from(MessageUid.of(1));
+        List<MessageRange> ranges = from.split(2);
+        assertThat(ranges).containsExactly(MessageRange.from(MessageUid.of(1)));
+    }
+    
+    @Test
+    void splitTenElementsRangeShouldReturn4Ranges() {
+        MessageRange range = MessageRange.range(MessageUid.of(1),MessageUid.of(10));
+        List<MessageRange> ranges = range.split(3);
+        assertThat(ranges).containsExactly(
+                MessageRange.range(MessageUid.of(1), MessageUid.of(3)), 
+                MessageRange.range(MessageUid.of(4), MessageUid.of(6)), 
+                MessageRange.range(MessageUid.of(7), MessageUid.of(9)), 
+                MessageUid.of(10).toRange());
+    }
+
+    @Test
+    void includeShouldBeTrueWhenAfterFrom() {
+        MessageRange range = MessageRange.from(MessageUid.of(3));
+        boolean actual = range.includes(MessageUid.of(5));
+        assertThat(actual).isTrue();
+    }
+
+    @Test
+    void includeShouldBeFalseWhenBeforeFrom() {
+        MessageRange range = MessageRange.from(MessageUid.of(3));
+        boolean actual = range.includes(MessageUid.of(1));
+        assertThat(actual).isFalse();
+    }
+
+    @Test
+    void includeShouldBeTrueWhenEqualsFrom() {
+        MessageRange range = MessageRange.from(MessageUid.of(3));
+        boolean actual = range.includes(MessageUid.of(3));
+        assertThat(actual).isTrue();
+    }
+
+    @Test
+    void includeShouldBeFalseWhenDifferentOne() {
+        MessageRange range = MessageUid.of(3).toRange();
+        boolean actual = range.includes(MessageUid.of(1));
+        assertThat(actual).isFalse();
+    }
+
+    @Test
+    void includeShouldBeTrueWhenEqualsOne() {
+        MessageRange range = MessageUid.of(3).toRange();
+        boolean actual = range.includes(MessageUid.of(3));
+        assertThat(actual).isTrue();
+    }
+
+    @Test
+    void includeShouldBeFalseWhenBeforeRange() {
+        MessageRange range = MessageRange.range(MessageUid.of(3), MessageUid.of(6));
+        boolean actual = range.includes(MessageUid.of(1));
+        assertThat(actual).isFalse();
+    }
+
+    @Test
+    void includeShouldBeTrueWhenEqualsFromRange() {
+        MessageRange range = MessageRange.range(MessageUid.of(3), MessageUid.of(6));
+        boolean actual = range.includes(MessageUid.of(3));
+        assertThat(actual).isTrue();
+    }
+
+    @Test
+    void includeShouldBeTrueWhenInRange() {
+        MessageRange range = MessageRange.range(MessageUid.of(3), MessageUid.of(6));
+        boolean actual = range.includes(MessageUid.of(4));
+        assertThat(actual).isTrue();
+    }
+
+    @Test
+    void includeShouldBeTrueWhenEqualsToRange() {
+        MessageRange range = MessageRange.range(MessageUid.of(3), MessageUid.of(6));
+        boolean actual = range.includes(MessageUid.of(6));
+        assertThat(actual).isTrue();
+    }
+
+    @Test
+    void includeShouldBeFalseWhenAfterRange() {
+        MessageRange range = MessageRange.range(MessageUid.of(3), MessageUid.of(6));
+        boolean actual = range.includes(MessageUid.of(7));
+        assertThat(actual).isFalse();
+    }
+}
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/MultimailboxesSearchQueryTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/MultimailboxesSearchQueryTest.java
index 8430f08..9f08817 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/MultimailboxesSearchQueryTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/MultimailboxesSearchQueryTest.java
@@ -19,76 +19,84 @@
 package org.apache.james.mailbox.model;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import com.google.common.collect.ImmutableSet;
 
-public class MultimailboxesSearchQueryTest {
+class MultimailboxesSearchQueryTest {
 
     private static final SearchQuery EMPTY_QUERY = new SearchQuery();
     private static final TestId.Factory FACTORY = new TestId.Factory();
     private static final MailboxId ID_1 = FACTORY.fromString("1");
     private static final MailboxId ID_2 = FACTORY.fromString("2");
 
-    @Test(expected = NullPointerException.class)
-    public void buildShouldThrowWhenQueryIsNull() {
-        MultimailboxesSearchQuery.from(null);
+    @Test
+    void buildShouldThrowWhenQueryIsNull() {
+        assertThatThrownBy(() -> MultimailboxesSearchQuery.from(null))
+            .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void buildShouldBuildWheninMailboxes() {
+    void buildShouldBuildWheninMailboxes() {
         ImmutableSet<MailboxId> inMailboxes = ImmutableSet.of();
         ImmutableSet<MailboxId> notInMailboxes = ImmutableSet.of();
         MultimailboxesSearchQuery expected = new MultimailboxesSearchQuery(EMPTY_QUERY, inMailboxes, notInMailboxes);
         MultimailboxesSearchQuery actual = MultimailboxesSearchQuery.from(EMPTY_QUERY).build();
+
         assertThat(actual).isEqualToComparingFieldByField(expected);
     }
 
     @Test
-    public void buildShouldBuildWhenEmptyMailboxes() {
+    void buildShouldBuildWhenEmptyMailboxes() {
         ImmutableSet<MailboxId> inMailboxes = ImmutableSet.of();
         ImmutableSet<MailboxId> notInMailboxes = ImmutableSet.of();
         MultimailboxesSearchQuery expected = new MultimailboxesSearchQuery(EMPTY_QUERY, inMailboxes, notInMailboxes);
         MultimailboxesSearchQuery actual = MultimailboxesSearchQuery.from(EMPTY_QUERY).inMailboxes().build();
+
         assertThat(actual).isEqualToComparingFieldByField(expected);
     }
 
     @Test
-    public void buildShouldBuildWhenEmptyNotInMailboxes() {
+    void buildShouldBuildWhenEmptyNotInMailboxes() {
         ImmutableSet<MailboxId> inMailboxes = ImmutableSet.of();
         ImmutableSet<MailboxId> notInMailboxes = ImmutableSet.of();
         MultimailboxesSearchQuery expected = new MultimailboxesSearchQuery(EMPTY_QUERY, inMailboxes, notInMailboxes);
         MultimailboxesSearchQuery actual = MultimailboxesSearchQuery.from(EMPTY_QUERY).notInMailboxes().build();
+
         assertThat(actual).isEqualToComparingFieldByField(expected);
     }
 
     
     @Test
-    public void buildShouldBuildWhenOneMailbox() {
+    void buildShouldBuildWhenOneMailbox() {
         ImmutableSet<MailboxId> inMailboxes = ImmutableSet.of(ID_1);
         ImmutableSet<MailboxId> notInMailboxes = ImmutableSet.of();
         MultimailboxesSearchQuery expected = new MultimailboxesSearchQuery(EMPTY_QUERY, inMailboxes, notInMailboxes);
         MultimailboxesSearchQuery actual = MultimailboxesSearchQuery.from(EMPTY_QUERY).inMailboxes(ID_1).build();
+
         assertThat(actual).isEqualToComparingFieldByField(expected);
     }
 
     @Test
-    public void buildShouldBuildWhenOneNotInMailbox() {
+    void buildShouldBuildWhenOneNotInMailbox() {
         ImmutableSet<MailboxId> inMailboxes = ImmutableSet.of();
         ImmutableSet<MailboxId> notInMailboxes = ImmutableSet.of(ID_1);
         MultimailboxesSearchQuery expected = new MultimailboxesSearchQuery(EMPTY_QUERY, inMailboxes, notInMailboxes);
         MultimailboxesSearchQuery actual = MultimailboxesSearchQuery.from(EMPTY_QUERY).notInMailboxes(ID_1).build();
+
         assertThat(actual).isEqualToComparingFieldByField(expected);
     }
 
     
     @Test
-    public void buildShouldBuildWhenAllDefined() {
+    void buildShouldBuildWhenAllDefined() {
         ImmutableSet<MailboxId> inMailboxes = ImmutableSet.of(ID_1);
         ImmutableSet<MailboxId> notInMailboxes = ImmutableSet.of(ID_2);
         MultimailboxesSearchQuery expected = new MultimailboxesSearchQuery(EMPTY_QUERY, inMailboxes, notInMailboxes);
         MultimailboxesSearchQuery actual = MultimailboxesSearchQuery.from(EMPTY_QUERY).inMailboxes(ID_1).notInMailboxes(ID_2).build();
+        
         assertThat(actual).isEqualToComparingFieldByField(expected);
     }
 
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/QuotaTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/QuotaTest.java
index e11ebdc..f1633bc 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/QuotaTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/QuotaTest.java
@@ -24,69 +24,69 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import org.apache.james.core.quota.QuotaCount;
 import org.apache.james.core.quota.QuotaSize;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-public class QuotaTest {
+class QuotaTest {
 
 
     @Test
-    public void isOverQuotaShouldReturnFalseWhenQuotaIsNotExceeded() {
+    void isOverQuotaShouldReturnFalseWhenQuotaIsNotExceeded() {
         Quota<QuotaCount> quota = Quota.<QuotaCount>builder().used(QuotaCount.count(36)).computedLimit(QuotaCount.count(360)).build();
         assertThat(quota.isOverQuota()).isFalse();
     }
 
     @Test
-    public void isOverQuotaShouldReturnFalseWhenMaxValueIsUnlimited() {
+    void isOverQuotaShouldReturnFalseWhenMaxValueIsUnlimited() {
         Quota<QuotaCount> quota = Quota.<QuotaCount>builder().used(QuotaCount.count(36)).computedLimit(QuotaCount.unlimited()).build();
         assertThat(quota.isOverQuota()).isFalse();
     }
 
     @Test
-    public void isOverQuotaShouldReturnTrueWhenQuotaIsExceeded() {
+    void isOverQuotaShouldReturnTrueWhenQuotaIsExceeded() {
         Quota<QuotaCount> quota = Quota.<QuotaCount>builder().used(QuotaCount.count(360)).computedLimit(QuotaCount.count(36)).build();
         assertThat(quota.isOverQuota()).isTrue();
     }
 
     @Test
-    public void isOverQuotaWithAdditionalValueShouldReturnTrueWhenOverLimit() {
+    void isOverQuotaWithAdditionalValueShouldReturnTrueWhenOverLimit() {
         Quota<QuotaCount> quota = Quota.<QuotaCount>builder().used(QuotaCount.count(36)).computedLimit(QuotaCount.count(36)).build();
         assertThat(quota.isOverQuotaWithAdditionalValue(1)).isTrue();
     }
 
     @Test
-    public void isOverQuotaWithAdditionalValueShouldReturnTrueWhenUnderLimit() {
+    void isOverQuotaWithAdditionalValueShouldReturnTrueWhenUnderLimit() {
         Quota<QuotaCount> quota = Quota.<QuotaCount>builder().used(QuotaCount.count(34)).computedLimit(QuotaCount.count(36)).build();
         assertThat(quota.isOverQuotaWithAdditionalValue(1)).isFalse();
     }
 
     @Test
-    public void isOverQuotaWithAdditionalValueShouldReturnFalseWhenAtLimit() {
+    void isOverQuotaWithAdditionalValueShouldReturnFalseWhenAtLimit() {
         Quota<QuotaCount> quota = Quota.<QuotaCount>builder().used(QuotaCount.count(36)).computedLimit(QuotaCount.count(36)).build();
         assertThat(quota.isOverQuotaWithAdditionalValue(0)).isFalse();
     }
 
     @Test
-    public void isOverQuotaWithAdditionalValueShouldThrowOnNegativeValue() {
+    void isOverQuotaWithAdditionalValueShouldThrowOnNegativeValue() {
         Quota<QuotaCount> quota = Quota.<QuotaCount>builder().used(QuotaCount.count(25)).computedLimit(QuotaCount.count(36)).build();
         assertThatThrownBy(() -> quota.isOverQuotaWithAdditionalValue(-1)).isInstanceOf(IllegalArgumentException.class);
     }
 
     @Test
-    public void buildShouldThrowOnMissingUsedValue() {
+    void buildShouldThrowOnMissingUsedValue() {
         assertThatThrownBy(
             () -> Quota.<QuotaCount>builder().computedLimit(QuotaCount.count(1)).build())
             .isInstanceOf(IllegalStateException.class);
     }
 
     @Test
-    public void buildShouldThrowOnMissingComputedLimitValue() {
+    void buildShouldThrowOnMissingComputedLimitValue() {
         assertThatThrownBy(
             () -> Quota.<QuotaCount>builder().used(QuotaCount.count(1)).build())
             .isInstanceOf(IllegalStateException.class);
     }
 
     @Test
-    public void buildShouldCreateValidObjectGivenMandatoryFields() {
+    void buildShouldCreateValidObjectGivenMandatoryFields() {
         Quota<QuotaCount> actual = Quota.<QuotaCount>builder()
             .used(QuotaCount.count(1))
             .computedLimit(QuotaCount.count(2))
@@ -95,7 +95,7 @@ public class QuotaTest {
     }
 
     @Test
-    public void getRatioShouldReturnUsedDividedByLimit() {
+    void getRatioShouldReturnUsedDividedByLimit() {
         assertThat(
             Quota.<QuotaSize>builder()
                 .used(QuotaSize.size(15))
@@ -106,7 +106,7 @@ public class QuotaTest {
     }
 
     @Test
-    public void getRatioShouldReturnZeroWhenUnlimited() {
+    void getRatioShouldReturnZeroWhenUnlimited() {
         assertThat(
             Quota.<QuotaSize>builder()
                 .used(QuotaSize.size(15))
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/Rfc4314RightsTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/Rfc4314RightsTest.java
index 46c069c..8f54432 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/Rfc4314RightsTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/Rfc4314RightsTest.java
@@ -36,10 +36,10 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import org.apache.james.mailbox.exception.UnsupportedRightException;
 import org.apache.james.mailbox.model.MailboxACL.Rfc4314Rights;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-public class Rfc4314RightsTest {
+class Rfc4314RightsTest {
     
     private Rfc4314Rights aeik;
     private Rfc4314Rights lprs;
@@ -47,8 +47,8 @@ public class Rfc4314RightsTest {
     private Rfc4314Rights full;
     private Rfc4314Rights none;
     
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    void setUp() throws Exception {
         aeik = Rfc4314Rights.fromSerializedRfc4314Rights("aeik");
         lprs = Rfc4314Rights.fromSerializedRfc4314Rights("lprs");
         twx = Rfc4314Rights.fromSerializedRfc4314Rights("twx");
@@ -56,55 +56,56 @@ public class Rfc4314RightsTest {
         none = MailboxACL.NO_RIGHTS;
     }
     
-    @Test(expected = NullPointerException.class)
-    public void newInstanceShouldThrowWhenNullString() throws UnsupportedRightException {
-        Rfc4314Rights.fromSerializedRfc4314Rights((String) null);
+    @Test
+    void newInstanceShouldThrowWhenNullString() throws UnsupportedRightException {
+        assertThatThrownBy(() -> Rfc4314Rights.fromSerializedRfc4314Rights((String) null))
+            .isInstanceOf(NullPointerException.class);
     }
     
     @Test
-    public void newInstanceShouldHaveNoRightsWhenEmptyString() throws UnsupportedRightException {
+    void newInstanceShouldHaveNoRightsWhenEmptyString() throws UnsupportedRightException {
         Rfc4314Rights rights = Rfc4314Rights.fromSerializedRfc4314Rights("");
         assertThat(rights.list()).isEmpty();
     }
     
     @Test
-    public void containsShouldReturnFalseWhenNotMatching() throws UnsupportedRightException {
+    void containsShouldReturnFalseWhenNotMatching() throws UnsupportedRightException {
         assertThat(aeik.contains('x')).isFalse();
     }
     
     @Test
-    public void containsShouldReturnTrueWhenMatching() throws UnsupportedRightException {
+    void containsShouldReturnTrueWhenMatching() throws UnsupportedRightException {
         assertThat(aeik.contains('e')).isTrue();
     }
     
     @Test
-    public void exceptShouldRemoveAllWhenChaining() throws UnsupportedRightException {
+    void exceptShouldRemoveAllWhenChaining() throws UnsupportedRightException {
         assertThat(full.except(aeik).except(lprs).except(twx)).isEqualTo(none);
     }
     
     @Test
-    public void exceptShouldReturnOriginWhenExceptingNull() throws UnsupportedRightException {
+    void exceptShouldReturnOriginWhenExceptingNull() throws UnsupportedRightException {
         assertThat(aeik.except(null)).isEqualTo(aeik);
     }
     
     @Test
-    public void exceptShouldReturnOriginWhenExceptingNonExistent() throws UnsupportedRightException {
+    void exceptShouldReturnOriginWhenExceptingNonExistent() throws UnsupportedRightException {
         assertThat(aeik.except(lprs)).isEqualTo(aeik);
     }
 
     @Test
-    public void rfc4314RightsShouldThrowWhenUnknownFlag() throws UnsupportedRightException {
+    void rfc4314RightsShouldThrowWhenUnknownFlag() {
         assertThatThrownBy(() -> Rfc4314Rights.fromSerializedRfc4314Rights("z"))
             .isInstanceOf(UnsupportedRightException.class);
     }
     
     @Test
-    public void exceptShouldReturnOriginWhenExceptingEmpty() throws UnsupportedRightException {
+    void exceptShouldReturnOriginWhenExceptingEmpty() throws UnsupportedRightException {
         assertThat(aeik.except(none)).isEqualTo(aeik);
     }
     
     @Test
-    public void fullRightsShouldContainsAllRights() {
+    void fullRightsShouldContainsAllRights() {
         assertThat(full.list()).containsOnly(
             Administer,
             PerformExpunge,
@@ -120,12 +121,12 @@ public class Rfc4314RightsTest {
     }
     
     @Test
-    public void noneRightsShouldContainsNoRights() {
+    void noneRightsShouldContainsNoRights() {
         assertThat(none.list()).isEmpty();
     }
     
     @Test
-    public void rightsShouldContainsSpecificRightsWhenAEIK() {
+    void rightsShouldContainsSpecificRightsWhenAEIK() {
         assertThat(aeik.list()).containsOnly(
             Administer,
             PerformExpunge,
@@ -134,7 +135,7 @@ public class Rfc4314RightsTest {
     }
     
     @Test
-    public void rightsShouldContainsSpecificRightsWhenLPRS() {
+    void rightsShouldContainsSpecificRightsWhenLPRS() {
         assertThat(lprs.list()).containsOnly(
             Lookup,
             Post,
@@ -143,7 +144,7 @@ public class Rfc4314RightsTest {
     }
     
     @Test
-    public void rightsShouldContainsSpecificRightsWhenTWX() {
+    void rightsShouldContainsSpecificRightsWhenTWX() {
         assertThat(twx.list()).containsOnly(
             DeleteMessages,
             Write,
@@ -151,92 +152,92 @@ public class Rfc4314RightsTest {
     }
 
     @Test
-    public void getValueShouldReturnSigmaWhenAeik() throws UnsupportedRightException {
+    void getValueShouldReturnSigmaWhenAeik() {
         assertThat(aeik.list()).containsExactly(Administer, PerformExpunge, Insert, CreateMailbox);
     }
 
     @Test
-    public void getValueShouldReturnSigmaWhenLprs() throws UnsupportedRightException {
+    void getValueShouldReturnSigmaWhenLprs() {
         assertThat(lprs.list()).containsExactly(Lookup, Post, Read, WriteSeenFlag);
     }
 
     @Test
-    public void getValueShouldReturnSigmaWhenTwx() throws UnsupportedRightException {
+    void getValueShouldReturnSigmaWhenTwx() {
         assertThat(twx.list()).containsExactly(DeleteMessages, Write, DeleteMailbox);
     }
 
     @Test
-    public void getValueShouldReturnEmptyWhenNone() throws UnsupportedRightException {
+    void getValueShouldReturnEmptyWhenNone() throws UnsupportedRightException {
         assertThat(Rfc4314Rights.fromSerializedRfc4314Rights("").list()).isEmpty();
     }
 
     @Test
-    public void serializeShouldReturnStringWhenAeik() throws UnsupportedRightException {
+    void serializeShouldReturnStringWhenAeik() {
         assertThat(aeik.serialize()).isEqualTo("aeik");
     }
 
     @Test
-    public void serializeShouldReturnStringWhenLprs() throws UnsupportedRightException {
+    void serializeShouldReturnStringWhenLprs() {
         assertThat(lprs.serialize()).isEqualTo("lprs");
     }
 
     @Test
-    public void serializeShouldReturnStringWhenTwx() throws UnsupportedRightException {
+    void serializeShouldReturnStringWhenTwx() {
         assertThat(twx.serialize()).isEqualTo("twx");
     }
     
     @Test
-    public void serializeShouldReturnStringWhenAeiklprstwx() throws UnsupportedRightException {
+    void serializeShouldReturnStringWhenAeiklprstwx() {
         assertThat(full.serialize()).isEqualTo("aeiklprstwx");
     }
 
     @Test
-    public void serializeShouldReturnEmptyStringWhenEmpty() throws UnsupportedRightException {
+    void serializeShouldReturnEmptyStringWhenEmpty() {
         assertThat(none.serialize()).isEmpty();
     }
     
     @Test
-    public void unionShouldReturnFullWhenChaining() throws UnsupportedRightException {
+    void unionShouldReturnFullWhenChaining() throws UnsupportedRightException {
         assertThat(aeik.union(lprs).union(twx)).isEqualTo(full);
     }
     
     @Test
-    public void unionShouldReturnOriginWhenAppliedWithEmpty() throws UnsupportedRightException {
+    void unionShouldReturnOriginWhenAppliedWithEmpty() throws UnsupportedRightException {
         assertThat(lprs.union(none)).isEqualTo(lprs);
     }
     
     @Test
-    public void unionShouldThrowWhenAppliedWithNull() throws UnsupportedRightException {
+    void unionShouldThrowWhenAppliedWithNull() {
         assertThatThrownBy(() -> lprs.union(null)).isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void containsShouldReturnFalseWhenRightNotPresent() throws UnsupportedRightException {
+    void containsShouldReturnFalseWhenRightNotPresent() {
         assertThat(lprs.contains(Write)).isFalse();
     }
 
     @Test
-    public void containsShouldReturnFalseWhenAtLeastOneRightNotPresent() throws UnsupportedRightException {
+    void containsShouldReturnFalseWhenAtLeastOneRightNotPresent() {
         assertThat(lprs.contains(Lookup, Write)).isFalse();
     }
 
     @Test
-    public void containsShouldReturnTrueWhenAllRightsPresent() throws UnsupportedRightException {
+    void containsShouldReturnTrueWhenAllRightsPresent() {
         assertThat(lprs.contains(Lookup, Post)).isTrue();
     }
 
     @Test
-    public void containsShouldReturnTrueWhenNonRightsPresent() throws UnsupportedRightException {
+    void containsShouldReturnTrueWhenNonRightsPresent() {
         assertThat(lprs.contains()).isTrue();
     }
 
     @Test
-    public void allExceptShouldReturnFullWhenProvidedEmpty() throws UnsupportedRightException {
+    void allExceptShouldReturnFullWhenProvidedEmpty() throws UnsupportedRightException {
         assertThat(Rfc4314Rights.allExcept()).isEqualTo(MailboxACL.FULL_RIGHTS);
     }
 
     @Test
-    public void allExceptShouldReturnAllButProvidedRight() throws UnsupportedRightException {
+    void allExceptShouldReturnAllButProvidedRight() throws UnsupportedRightException {
         assertThat(Rfc4314Rights.allExcept(Lookup))
             .isEqualTo(new Rfc4314Rights(
                 DeleteMessages,
@@ -252,7 +253,7 @@ public class Rfc4314RightsTest {
     }
 
     @Test
-    public void allExceptShouldReturnAllButProvidedRights() throws UnsupportedRightException {
+    void allExceptShouldReturnAllButProvidedRights() throws UnsupportedRightException {
         assertThat(Rfc4314Rights.allExcept(Lookup, Read))
             .isEqualTo(new Rfc4314Rights(
                 DeleteMessages,
@@ -267,7 +268,7 @@ public class Rfc4314RightsTest {
     }
 
     @Test
-    public void allExceptShouldReturnEmptyWhenProvidedAllRights() throws UnsupportedRightException {
+    void allExceptShouldReturnEmptyWhenProvidedAllRights() throws UnsupportedRightException {
         assertThat(
             Rfc4314Rights.allExcept(
                 Lookup,
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/SearchQueryTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/SearchQueryTest.java
index b5725a6..2011617 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/SearchQueryTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/SearchQueryTest.java
@@ -22,21 +22,21 @@ package org.apache.james.mailbox.model;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
 
-public class SearchQueryTest {
+class SearchQueryTest {
 
     @Test
-    public void searchQueryShouldRespectBeanContract() {
+    void searchQueryShouldRespectBeanContract() {
         EqualsVerifier.forClass(SearchQuery.class)
             .withOnlyTheseFields("criterias")
             .verify();
     }
 
     @Test
-    public void equalsShouldCompareCriteria() {
+    void equalsShouldCompareCriteria() {
         SearchQuery searchQuery1 = new SearchQuery();
         SearchQuery searchQuery2 = new SearchQuery();
         searchQuery1.andCriteria(SearchQuery.all());
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/UpdatedFlagsTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/UpdatedFlagsTest.java
index e79e566..1c81a4d 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/UpdatedFlagsTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/UpdatedFlagsTest.java
@@ -24,24 +24,24 @@ import static org.assertj.core.api.Assertions.assertThat;
 import javax.mail.Flags;
 
 import org.apache.james.mailbox.MessageUid;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
 
-public class UpdatedFlagsTest {
+class UpdatedFlagsTest {
 
     public static final MessageUid UID = MessageUid.of(45L);
     public static final long MOD_SEQ = 47L;
 
     @Test
-    public void shouldMatchBeanContract() {
+    void shouldMatchBeanContract() {
         EqualsVerifier.forClass(UpdatedFlags.class)
             .withIgnoredFields("modifiedFlags")
             .verify();
     }
 
     @Test
-    public void isModifiedToSetShouldReturnTrueWhenFlagOnlyInNewFlag() {
+    void isModifiedToSetShouldReturnTrueWhenFlagOnlyInNewFlag() {
         UpdatedFlags updatedFlags = UpdatedFlags.builder()
             .newFlags(new Flags(Flags.Flag.RECENT))
             .oldFlags(new Flags())
@@ -53,7 +53,7 @@ public class UpdatedFlagsTest {
     }
 
     @Test
-    public void isModifiedToSetShouldReturnFalseWhenFlagOnlyInOldFlag() {
+    void isModifiedToSetShouldReturnFalseWhenFlagOnlyInOldFlag() {
         UpdatedFlags updatedFlags = UpdatedFlags.builder()
             .newFlags(new Flags())
             .oldFlags(new Flags(Flags.Flag.RECENT))
@@ -65,7 +65,7 @@ public class UpdatedFlagsTest {
     }
 
     @Test
-    public void isModifiedToSetShouldReturnFalseWhenFlagIsOnNone() {
+    void isModifiedToSetShouldReturnFalseWhenFlagIsOnNone() {
         UpdatedFlags updatedFlags = UpdatedFlags.builder()
             .newFlags(new Flags())
             .oldFlags(new Flags())
@@ -77,7 +77,7 @@ public class UpdatedFlagsTest {
     }
 
     @Test
-    public void isModifiedToSetShouldReturnFalseWhenFlagIsOnBoth() {
+    void isModifiedToSetShouldReturnFalseWhenFlagIsOnBoth() {
         UpdatedFlags updatedFlags = UpdatedFlags.builder()
             .newFlags(new Flags(Flags.Flag.RECENT))
             .oldFlags(new Flags(Flags.Flag.RECENT))
@@ -89,7 +89,7 @@ public class UpdatedFlagsTest {
     }
 
     @Test
-    public void isModifiedToUnsetShouldReturnFalseWhenFlagOnlyInNewFlag() {
+    void isModifiedToUnsetShouldReturnFalseWhenFlagOnlyInNewFlag() {
         UpdatedFlags updatedFlags = UpdatedFlags.builder()
             .newFlags(new Flags(Flags.Flag.RECENT))
             .oldFlags(new Flags())
@@ -101,7 +101,7 @@ public class UpdatedFlagsTest {
     }
 
     @Test
-    public void isModifiedToUnsetShouldReturnTrueWhenFlagOnlyInOldFlag() {
+    void isModifiedToUnsetShouldReturnTrueWhenFlagOnlyInOldFlag() {
         UpdatedFlags updatedFlags = UpdatedFlags.builder()
             .newFlags(new Flags())
             .oldFlags(new Flags(Flags.Flag.RECENT))
@@ -113,7 +113,7 @@ public class UpdatedFlagsTest {
     }
 
     @Test
-    public void isModifiedToUnsetShouldReturnFalseWhenFlagIsOnNone() {
+    void isModifiedToUnsetShouldReturnFalseWhenFlagIsOnNone() {
         UpdatedFlags updatedFlags = UpdatedFlags.builder()
             .newFlags(new Flags())
             .oldFlags(new Flags())
@@ -125,7 +125,7 @@ public class UpdatedFlagsTest {
     }
 
     @Test
-    public void isModifiedToUnsetShouldReturnFalseWhenFlagIsOnBoth() {
+    void isModifiedToUnsetShouldReturnFalseWhenFlagIsOnBoth() {
         UpdatedFlags updatedFlags = UpdatedFlags.builder()
             .newFlags(new Flags(Flags.Flag.RECENT))
             .oldFlags(new Flags(Flags.Flag.RECENT))
@@ -137,7 +137,7 @@ public class UpdatedFlagsTest {
     }
 
     @Test
-    public void isUnchangedShouldReturnFalseWhenFlagOnlyInNewFlag() {
+    void isUnchangedShouldReturnFalseWhenFlagOnlyInNewFlag() {
         UpdatedFlags updatedFlags = UpdatedFlags.builder()
             .newFlags(new Flags(Flags.Flag.RECENT))
             .oldFlags(new Flags())
@@ -149,7 +149,7 @@ public class UpdatedFlagsTest {
     }
 
     @Test
-    public void isUnchangedShouldReturnFalseWhenFlagOnlyInOldFlag() {
+    void isUnchangedShouldReturnFalseWhenFlagOnlyInOldFlag() {
         UpdatedFlags updatedFlags = UpdatedFlags.builder()
             .newFlags(new Flags())
             .oldFlags(new Flags(Flags.Flag.RECENT))
@@ -161,7 +161,7 @@ public class UpdatedFlagsTest {
     }
 
     @Test
-    public void isUnchangedShouldReturnTrueWhenFlagIsOnNone() {
+    void isUnchangedShouldReturnTrueWhenFlagIsOnNone() {
         UpdatedFlags updatedFlags = UpdatedFlags.builder()
             .newFlags(new Flags())
             .oldFlags(new Flags())
@@ -173,7 +173,7 @@ public class UpdatedFlagsTest {
     }
 
     @Test
-    public void isUnchangedShouldReturnTrueWhenFlagIsOnBoth() {
+    void isUnchangedShouldReturnTrueWhenFlagIsOnBoth() {
         UpdatedFlags updatedFlags = UpdatedFlags.builder()
             .newFlags(new Flags(Flags.Flag.RECENT))
             .oldFlags(new Flags(Flags.Flag.RECENT))


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


[james-project] 21/30: MAILBOX-392 Rework slightly UserMailboxesService

Posted by bt...@apache.org.
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 c0c2cde5bafb0878893d81968246b2482505334b
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Tue Nov 12 12:04:58 2019 +0700

    MAILBOX-392 Rework slightly UserMailboxesService
---
 .../apache/james/webadmin/service/UserMailboxesService.java    | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/UserMailboxesService.java b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/UserMailboxesService.java
index 35e1860..a8f1904 100644
--- a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/UserMailboxesService.java
+++ b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/UserMailboxesService.java
@@ -63,7 +63,7 @@ public class UserMailboxesService {
         MailboxSession mailboxSession = mailboxManager.createSystemSession(username);
         try {
             mailboxManager.createMailbox(
-                convertToMailboxPath(username, mailboxName.asString(), mailboxSession),
+                convertToMailboxPath(username, mailboxName),
                 mailboxSession);
         } catch (MailboxExistsException e) {
             LOGGER.info("Attempt to create mailbox {} for user {} that already exists", mailboxName, username);
@@ -90,14 +90,14 @@ public class UserMailboxesService {
         usernamePreconditions(username);
         MailboxSession mailboxSession = mailboxManager.createSystemSession(username);
         return mailboxManager.mailboxExists(
-            convertToMailboxPath(username, mailboxName.asString(), mailboxSession),
+            convertToMailboxPath(username, mailboxName),
             mailboxSession);
     }
 
     public void deleteMailbox(String username, MailboxName mailboxName) throws MailboxException, UsersRepositoryException, MailboxHaveChildrenException {
         usernamePreconditions(username);
         MailboxSession mailboxSession = mailboxManager.createSystemSession(username);
-        MailboxPath mailboxPath = convertToMailboxPath(username, mailboxName.asString(), mailboxSession);
+        MailboxPath mailboxPath = convertToMailboxPath(username, mailboxName);
         listChildren(mailboxPath, mailboxSession)
             .forEach(Throwing.consumer(path -> deleteMailbox(mailboxSession, path)));
     }
@@ -121,8 +121,8 @@ public class UserMailboxesService {
         Preconditions.checkState(usersRepository.contains(username));
     }
 
-    private MailboxPath convertToMailboxPath(String username, String mailboxName, MailboxSession mailboxSession) {
-        return MailboxPath.forUser(username, mailboxName);
+    private MailboxPath convertToMailboxPath(String username, MailboxName mailboxName) {
+        return MailboxPath.forUser(username, mailboxName.asString());
     }
 
     private Stream<MailboxMetaData> listUserMailboxes(MailboxSession mailboxSession) throws MailboxException {


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


[james-project] 29/30: [Refactoring] Remove some unused methods in mailbox-store

Posted by bt...@apache.org.
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 08a36f0743b7416952ed5e20d2256e980b67a16b
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Wed Nov 13 09:21:35 2019 +0700

    [Refactoring] Remove some unused methods in mailbox-store
---
 .../cassandra/CassandraMailboxManagerProvider.java |  2 +-
 .../cassandra/mail/CassandraMapperProvider.java    |  6 -----
 .../james/mailbox/jpa/mail/JPAMapperProvider.java  |  6 -----
 .../inmemory/InMemoryMessageManagerTestSystem.java | 28 ----------------------
 .../inmemory/mail/InMemoryMapperProvider.java      |  6 -----
 .../manager/InMemoryIntegrationResources.java      |  2 +-
 .../src/main/resources/META-INF/spring/quota.xml   |  1 -
 .../james/mailbox/store/FakeAuthenticator.java     |  4 ----
 .../james/mailbox/store/StoreMessageIdManager.java |  8 -------
 .../james/mailbox/store/StoreMessageManager.java   | 11 ---------
 .../model/MailboxIdDeserialisationException.java   |  3 ---
 .../mail/model/impl/SimpleMailboxMessage.java      | 12 ----------
 .../store/mail/model/impl/SimpleMessage.java       |  6 -----
 .../mailbox/store/quota/FixedMaxQuotaManager.java  |  4 ----
 .../james/mailbox/store/quota/QuotaComponents.java | 11 ++-------
 .../store/streaming/LimitingFileInputStream.java   | 13 ----------
 .../apache/james/mailbox/store/MessageBuilder.java |  1 -
 .../mailbox/store/MessageManagerTestSystem.java    |  1 -
 .../mailbox/store/SimpleMailboxMembership.java     |  5 ----
 .../mailbox/store/mail/model/MapperProvider.java   |  2 --
 .../cassandra/host/CassandraHostSystem.java        |  2 +-
 .../mpt/imapmailbox/jpa/host/JPAHostSystem.java    |  2 +-
 22 files changed, 6 insertions(+), 130 deletions(-)

diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMailboxManagerProvider.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMailboxManagerProvider.java
index 79b703d..fbf3791 100644
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMailboxManagerProvider.java
+++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMailboxManagerProvider.java
@@ -86,7 +86,7 @@ public class CassandraMailboxManagerProvider {
         StoreQuotaManager storeQuotaManager = new StoreQuotaManager(currentQuotaUpdater, maxQuotaManager);
         QuotaRootResolver quotaRootResolver = new DefaultUserQuotaRootResolver(sessionProvider, mapperFactory);
         ListeningCurrentQuotaUpdater quotaUpdater = new ListeningCurrentQuotaUpdater(currentQuotaUpdater, quotaRootResolver, eventBus, storeQuotaManager);
-        QuotaComponents quotaComponents = new QuotaComponents(maxQuotaManager, storeQuotaManager, quotaRootResolver, quotaUpdater);
+        QuotaComponents quotaComponents = new QuotaComponents(maxQuotaManager, storeQuotaManager, quotaRootResolver);
 
         MessageSearchIndex index = new SimpleMessageSearchIndex(mapperFactory, mapperFactory, new DefaultTextExtractor());
 
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMapperProvider.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMapperProvider.java
index a45094a..d1934fd 100644
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMapperProvider.java
+++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMapperProvider.java
@@ -33,7 +33,6 @@ import org.apache.james.mailbox.cassandra.ids.CassandraMessageId.Factory;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.model.Mailbox;
 import org.apache.james.mailbox.model.MessageId;
-import org.apache.james.mailbox.store.mail.AnnotationMapper;
 import org.apache.james.mailbox.store.mail.AttachmentMapper;
 import org.apache.james.mailbox.store.mail.MailboxMapper;
 import org.apache.james.mailbox.store.mail.MessageIdMapper;
@@ -102,11 +101,6 @@ public class CassandraMapperProvider implements MapperProvider {
     }
 
     @Override
-    public AnnotationMapper createAnnotationMapper() throws MailboxException {
-        return mapperFactory.getAnnotationMapper(mailboxSession);
-    }
-
-    @Override
     public List<Capabilities> getSupportedCapabilities() {
         return ImmutableList.copyOf(Capabilities.values());
     }
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 0d4b58f..775dfc1 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
@@ -34,7 +34,6 @@ import org.apache.james.mailbox.model.Mailbox;
 import org.apache.james.mailbox.model.MailboxId;
 import org.apache.james.mailbox.model.MessageId;
 import org.apache.james.mailbox.store.JVMMailboxPathLocker;
-import org.apache.james.mailbox.store.mail.AnnotationMapper;
 import org.apache.james.mailbox.store.mail.AttachmentMapper;
 import org.apache.james.mailbox.store.mail.MailboxMapper;
 import org.apache.james.mailbox.store.mail.MessageIdMapper;
@@ -76,11 +75,6 @@ public class JPAMapperProvider implements MapperProvider {
     }
 
     @Override
-    public AnnotationMapper createAnnotationMapper() throws MailboxException {
-        return new TransactionalAnnotationMapper(new JPAAnnotationMapper(jpaTestCluster.getEntityManagerFactory()));
-    }
-
-    @Override
     public MailboxId generateId() {
         return JPAId.of(Math.abs(ThreadLocalRandom.current().nextInt()));
     }
diff --git a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/InMemoryMessageManagerTestSystem.java b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/InMemoryMessageManagerTestSystem.java
index 80a704f..a6cbe0d 100644
--- a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/InMemoryMessageManagerTestSystem.java
+++ b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/InMemoryMessageManagerTestSystem.java
@@ -18,18 +18,12 @@
  ****************************************************************/
 package org.apache.james.mailbox.inmemory;
 
-import java.util.Optional;
-
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.MessageManager;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.model.Mailbox;
-import org.apache.james.mailbox.model.MailboxId;
-import org.apache.james.mailbox.model.MailboxMetaData;
 import org.apache.james.mailbox.model.MailboxPath;
-import org.apache.james.mailbox.model.search.MailboxQuery;
-import org.apache.james.mailbox.model.search.Wildcard;
 import org.apache.james.mailbox.store.MessageManagerTestSystem;
 
 public class InMemoryMessageManagerTestSystem extends MessageManagerTestSystem {
@@ -49,26 +43,4 @@ public class InMemoryMessageManagerTestSystem extends MessageManagerTestSystem {
         MessageManager messageManager = mailboxManager.getMailbox(mailboxPath, mailboxSession);
         return new Mailbox(mailboxPath, UID_VALIDITY, messageManager.getId());
     }
-
-    @Override
-    public void deleteMailbox(final MailboxId mailboxId, MailboxSession session) {
-        try {
-            Optional<MailboxMetaData> mailbox = retrieveMailbox(mailboxId, session);
-            if (mailbox.isPresent()) {
-                mailboxManager.deleteMailbox(mailbox.get().getPath(), session);
-            }
-        } catch (MailboxException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    private Optional<MailboxMetaData> retrieveMailbox(final MailboxId mailboxId, MailboxSession mailboxSession) throws MailboxException {
-        MailboxQuery userMailboxesQuery = MailboxQuery.privateMailboxesBuilder(mailboxSession)
-            .expression(Wildcard.INSTANCE)
-            .build();
-        return mailboxManager.search(userMailboxesQuery, mailboxSession)
-            .stream()
-            .filter(mailboxMetaData -> mailboxMetaData.getId().equals(mailboxId))
-            .findFirst();
-    }
 }
diff --git a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/mail/InMemoryMapperProvider.java b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/mail/InMemoryMapperProvider.java
index 3162d91..765751c 100644
--- a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/mail/InMemoryMapperProvider.java
+++ b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/mail/InMemoryMapperProvider.java
@@ -31,7 +31,6 @@ import org.apache.james.mailbox.inmemory.InMemoryMailboxSessionMapperFactory;
 import org.apache.james.mailbox.inmemory.InMemoryMessageId;
 import org.apache.james.mailbox.model.Mailbox;
 import org.apache.james.mailbox.model.MessageId;
-import org.apache.james.mailbox.store.mail.AnnotationMapper;
 import org.apache.james.mailbox.store.mail.AttachmentMapper;
 import org.apache.james.mailbox.store.mail.MailboxMapper;
 import org.apache.james.mailbox.store.mail.MessageIdMapper;
@@ -92,11 +91,6 @@ public class InMemoryMapperProvider implements MapperProvider {
     public boolean supportPartialAttachmentFetch() {
         return false;
     }
-
-    @Override
-    public AnnotationMapper createAnnotationMapper() throws MailboxException {
-        return inMemoryMailboxSessionMapperFactory.createAnnotationMapper(MAILBOX_SESSION);
-    }
     
     @Override
     public MessageId generateMessageId() {
diff --git a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/manager/InMemoryIntegrationResources.java b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/manager/InMemoryIntegrationResources.java
index 4d03fec..29c4ae3 100644
--- a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/manager/InMemoryIntegrationResources.java
+++ b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/manager/InMemoryIntegrationResources.java
@@ -303,7 +303,7 @@ public class InMemoryIntegrationResources implements IntegrationResources<StoreM
             InMemoryCurrentQuotaManager currentQuotaManager = new InMemoryCurrentQuotaManager(new CurrentQuotaCalculator(mailboxSessionMapperFactory, quotaRootResolver), sessionProvider);
             QuotaManager quotaManager = this.quotaManager.get().apply(new BaseQuotaComponentsStage(maxQuotaManager, currentQuotaManager));
             ListeningCurrentQuotaUpdater listeningCurrentQuotaUpdater = new ListeningCurrentQuotaUpdater(currentQuotaManager, quotaRootResolver, eventBus, quotaManager);
-            QuotaComponents quotaComponents = new QuotaComponents(maxQuotaManager, quotaManager, quotaRootResolver, listeningCurrentQuotaUpdater);
+            QuotaComponents quotaComponents = new QuotaComponents(maxQuotaManager, quotaManager, quotaRootResolver);
 
             MailboxManagerPreInstanciationStage preInstanciationStage = new MailboxManagerPreInstanciationStage(mailboxSessionMapperFactory, sessionProvider);
             MessageSearchIndex index = searchIndexFactory.get().apply(preInstanciationStage);
diff --git a/mailbox/spring/src/main/resources/META-INF/spring/quota.xml b/mailbox/spring/src/main/resources/META-INF/spring/quota.xml
index c9e1ae7..3ac5094 100644
--- a/mailbox/spring/src/main/resources/META-INF/spring/quota.xml
+++ b/mailbox/spring/src/main/resources/META-INF/spring/quota.xml
@@ -62,7 +62,6 @@
         <constructor-arg index="0" ref="maxQuotaManager"/>
         <constructor-arg index="1" ref="quotaManager"/>
         <constructor-arg index="2" ref="quotaRootResolver"/>
-        <constructor-arg index="3" ref="quotaUpdater"/>
     </bean>
 
 </beans>
\ No newline at end of file
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/FakeAuthenticator.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/FakeAuthenticator.java
index d58fdfc..79224c5 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/FakeAuthenticator.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/FakeAuthenticator.java
@@ -37,8 +37,4 @@ public class FakeAuthenticator implements Authenticator {
     public void addUser(String user, String password) {
         users.put(user, password);
     }
-
-    public void clear() {
-        users.clear();
-    }
 }
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageIdManager.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageIdManager.java
index 20a5b0f..c440924 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageIdManager.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageIdManager.java
@@ -20,7 +20,6 @@
 package org.apache.james.mailbox.store;
 
 import java.util.Collection;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -30,7 +29,6 @@ import java.util.function.Predicate;
 
 import javax.inject.Inject;
 import javax.mail.Flags;
-import javax.mail.internet.SharedInputStream;
 
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxSession;
@@ -47,7 +45,6 @@ import org.apache.james.mailbox.model.DeleteResult;
 import org.apache.james.mailbox.model.Mailbox;
 import org.apache.james.mailbox.model.MailboxACL.Right;
 import org.apache.james.mailbox.model.MailboxId;
-import org.apache.james.mailbox.model.MessageAttachment;
 import org.apache.james.mailbox.model.MessageId;
 import org.apache.james.mailbox.model.MessageMetaData;
 import org.apache.james.mailbox.model.MessageMoves;
@@ -64,7 +61,6 @@ import org.apache.james.mailbox.store.mail.model.FlagsFactory;
 import org.apache.james.mailbox.store.mail.model.FlagsFilter;
 import org.apache.james.mailbox.store.mail.model.MailboxMessage;
 import org.apache.james.mailbox.store.mail.model.Message;
-import org.apache.james.mailbox.store.mail.model.impl.PropertyBuilder;
 import org.apache.james.mailbox.store.mail.model.impl.SimpleMailboxMessage;
 import org.apache.james.mailbox.store.quota.QuotaChecker;
 import org.slf4j.Logger;
@@ -320,10 +316,6 @@ public class StoreMessageIdManager implements MessageIdManager {
             .block();
         }
     }
-
-    protected MailboxMessage createMessage(Date internalDate, int size, int bodyStartOctet, SharedInputStream content, Flags flags, PropertyBuilder propertyBuilder, List<MessageAttachment> attachments, MailboxId mailboxId) {
-        return new SimpleMailboxMessage(messageIdFactory.generate(), internalDate, size, bodyStartOctet, content, flags, propertyBuilder, mailboxId, attachments);
-    }
     
     private void dispatchFlagsChange(MailboxSession mailboxSession, MailboxId mailboxId, UpdatedFlags updatedFlags) throws MailboxException {
         if (updatedFlags.flagsChanged()) {
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
index e52b2b7..e46ebce 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
@@ -185,17 +185,6 @@ public class StoreMessageManager implements MessageManager {
         this.preDeletionHooks = preDeletionHooks;
     }
 
-    protected Factory getMessageIdFactory() {
-        return messageIdFactory;
-    }
-    
-    /**
-     * Return the {@link MailboxPathLocker}
-     */
-    protected MailboxPathLocker getLocker() {
-        return locker;
-    }
-
     /**
      * Return the underlying {@link Mailbox}
      */
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/MailboxIdDeserialisationException.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/MailboxIdDeserialisationException.java
index 8deea45..556011b 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/MailboxIdDeserialisationException.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/MailboxIdDeserialisationException.java
@@ -23,9 +23,6 @@ import org.apache.james.mailbox.exception.MailboxException;
 
 public class MailboxIdDeserialisationException extends MailboxException {
 
-    public MailboxIdDeserialisationException() {
-    }
-
     public MailboxIdDeserialisationException(String message) {
         super(message);
     }
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/SimpleMailboxMessage.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/SimpleMailboxMessage.java
index 34b3b5c..4adfb49 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/SimpleMailboxMessage.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/SimpleMailboxMessage.java
@@ -38,8 +38,6 @@ import org.apache.james.mailbox.model.MailboxId;
 import org.apache.james.mailbox.model.MessageAttachment;
 import org.apache.james.mailbox.model.MessageId;
 import org.apache.james.mailbox.store.mail.model.DelegatingMailboxMessage;
-import org.apache.james.mailbox.store.mail.model.FlagsFactory;
-import org.apache.james.mailbox.store.mail.model.FlagsFilter;
 import org.apache.james.mailbox.store.mail.model.MailboxMessage;
 
 import com.google.common.base.MoreObjects;
@@ -297,16 +295,6 @@ public class SimpleMailboxMessage extends DelegatingMailboxMessage {
         userFlags = flags.getUserFlags();
     }
 
-    public SimpleMailboxMessage filterFlags(FlagsFilter filter) throws MailboxException {
-        Flags flags = FlagsFactory
-            .builder()
-            .flags(createFlags())
-            .addUserFlags(createUserFlags())
-            .filteringFlags(filter)
-            .build();
-        return from(this).flags(flags).build();
-    }
-
     @Override
     public int hashCode() {
         return Objects.hashCode(uid);
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/SimpleMessage.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/SimpleMessage.java
index 4141cdc..69d3d85 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/SimpleMessage.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/SimpleMessage.java
@@ -30,8 +30,6 @@ import org.apache.james.mailbox.model.MessageId;
 import org.apache.james.mailbox.store.mail.model.Message;
 import org.apache.james.mailbox.store.mail.model.Property;
 
-import com.google.common.collect.ImmutableList;
-
 public class SimpleMessage implements Message {
 
     private final MessageId messageId;
@@ -58,10 +56,6 @@ public class SimpleMessage implements Message {
         this.attachments = attachments;
     }
 
-    public SimpleMessage(MessageId messageId, SharedInputStream content, long size, Date internalDate, String subType, String mediaType, int bodyStartOctet, Long textualLineCount, List<Property> properties) {
-        this(messageId, content, size, internalDate, subType, mediaType, bodyStartOctet, textualLineCount, properties, ImmutableList.<MessageAttachment>of());
-    }
-
     @Override
     public MessageId getMessageId() {
         return messageId;
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/FixedMaxQuotaManager.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/FixedMaxQuotaManager.java
index 0cab231..63847a9 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/FixedMaxQuotaManager.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/FixedMaxQuotaManager.java
@@ -108,10 +108,6 @@ public class FixedMaxQuotaManager implements MaxQuotaManager {
         return Optional.empty();
     }
 
-    public Optional<QuotaCount> getMaxMessage() {
-        return Optional.empty();
-    }
-
     @Override
     public void removeDomainMaxMessage(Domain domain) throws UnsupportedOperationException {
         throw new UnsupportedOperationException("Can not modify domain specific upper limit for FixedMaxQuotaManager");
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/QuotaComponents.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/QuotaComponents.java
index 340b153..4d39c30 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/QuotaComponents.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/QuotaComponents.java
@@ -32,21 +32,18 @@ public class QuotaComponents {
         return new QuotaComponents(
             new NoMaxQuotaManager(),
             new NoQuotaManager(),
-            new DefaultUserQuotaRootResolver(sessionProvider, mailboxSessionMapperFactory),
-            new NoQuotaUpdater());
+            new DefaultUserQuotaRootResolver(sessionProvider, mailboxSessionMapperFactory));
     }
 
     private final MaxQuotaManager maxQuotaManager;
     private final QuotaManager quotaManager;
     private final QuotaRootResolver quotaRootResolver;
-    private final QuotaUpdater quotaUpdater;
 
     @Inject
-    public QuotaComponents(MaxQuotaManager maxQuotaManager, QuotaManager quotaManager, QuotaRootResolver quotaRootResolver, QuotaUpdater quotaUpdater) {
+    public QuotaComponents(MaxQuotaManager maxQuotaManager, QuotaManager quotaManager, QuotaRootResolver quotaRootResolver) {
         this.maxQuotaManager = maxQuotaManager;
         this.quotaManager = quotaManager;
         this.quotaRootResolver = quotaRootResolver;
-        this.quotaUpdater = quotaUpdater;
     }
 
     public MaxQuotaManager getMaxQuotaManager() {
@@ -60,8 +57,4 @@ public class QuotaComponents {
     public QuotaRootResolver getQuotaRootResolver() {
         return quotaRootResolver;
     }
-
-    public QuotaUpdater getQuotaUpdater() {
-        return quotaUpdater;
-    }
 }
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/streaming/LimitingFileInputStream.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/streaming/LimitingFileInputStream.java
index ff2243e..1c7b738 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/streaming/LimitingFileInputStream.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/streaming/LimitingFileInputStream.java
@@ -19,7 +19,6 @@
 package org.apache.james.mailbox.store.streaming;
 
 import java.io.File;
-import java.io.FileDescriptor;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
@@ -39,18 +38,6 @@ public class LimitingFileInputStream extends FileInputStream {
         this.limit = limit;
     }
 
-    public LimitingFileInputStream(FileDescriptor fdObj, long limit) {
-        super(fdObj);
-        this.limit = limit;
-
-    }
-
-    public LimitingFileInputStream(String name, long limit) throws FileNotFoundException {
-        super(name);
-        this.limit = limit;
-
-    }
-
     @Override
     public int read() throws IOException {
         if (pos >= limit) {
diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/MessageBuilder.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/MessageBuilder.java
index 9476326..3d45777 100644
--- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/MessageBuilder.java
+++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/MessageBuilder.java
@@ -39,7 +39,6 @@ public class MessageBuilder {
     public Flags flags = new Flags();
     public byte[] body = {};
     public final Map<String, String> headers = new HashMap<>();
-    public int lineNumber = 0;
     
     public MailboxMessage build() throws Exception {
         return build(new DefaultMessageId());
diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/MessageManagerTestSystem.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/MessageManagerTestSystem.java
index d8cb9a2..5b655ec 100644
--- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/MessageManagerTestSystem.java
+++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/MessageManagerTestSystem.java
@@ -40,5 +40,4 @@ public abstract class MessageManagerTestSystem {
 
     public abstract Mailbox createMailbox(MailboxPath mailboxPath, MailboxSession session) throws MailboxException;
 
-    public abstract void deleteMailbox(MailboxId mailboxId, MailboxSession session);
 }
diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/SimpleMailboxMembership.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/SimpleMailboxMembership.java
index 322f87a..a0118ee 100644
--- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/SimpleMailboxMembership.java
+++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/SimpleMailboxMembership.java
@@ -27,7 +27,6 @@ import java.io.SequenceInputStream;
 import java.io.Writer;
 import java.util.Date;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -136,10 +135,6 @@ public class SimpleMailboxMembership implements MailboxMessage {
         return seen;
     }
 
-    public void unsetRecent() {
-        recent = false;
-    }
-
     @Override
     public long getHeaderOctets() {
         return size - body.length;
diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MapperProvider.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MapperProvider.java
index 6e2ab1b..6e5c670 100644
--- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MapperProvider.java
+++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MapperProvider.java
@@ -55,8 +55,6 @@ public interface MapperProvider {
 
     AttachmentMapper createAttachmentMapper() throws MailboxException;
 
-    AnnotationMapper createAnnotationMapper() throws MailboxException;
-
     MailboxId generateId();
 
     MessageUid generateMessageUid();
diff --git a/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/host/CassandraHostSystem.java b/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/host/CassandraHostSystem.java
index 993f7ed..bee7d68 100644
--- a/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/host/CassandraHostSystem.java
+++ b/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/host/CassandraHostSystem.java
@@ -107,7 +107,7 @@ public class CassandraHostSystem extends JamesImapHostSystem {
         CassandraCurrentQuotaManager currentQuotaManager = new CassandraCurrentQuotaManager(session);
         StoreQuotaManager quotaManager = new StoreQuotaManager(currentQuotaManager, perUserMaxQuotaManager);
         ListeningCurrentQuotaUpdater quotaUpdater = new ListeningCurrentQuotaUpdater(currentQuotaManager, quotaRootResolver, eventBus, quotaManager);
-        QuotaComponents quotaComponents = new QuotaComponents(perUserMaxQuotaManager, quotaManager, quotaRootResolver, quotaUpdater);
+        QuotaComponents quotaComponents = new QuotaComponents(perUserMaxQuotaManager, quotaManager, quotaRootResolver);
 
         MessageSearchIndex index = new SimpleMessageSearchIndex(mapperFactory, mapperFactory, new DefaultTextExtractor());
 
diff --git a/mpt/impl/imap-mailbox/jpa/src/test/java/org/apache/james/mpt/imapmailbox/jpa/host/JPAHostSystem.java b/mpt/impl/imap-mailbox/jpa/src/test/java/org/apache/james/mpt/imapmailbox/jpa/host/JPAHostSystem.java
index 2f4b58b..80541b4 100644
--- a/mpt/impl/imap-mailbox/jpa/src/test/java/org/apache/james/mpt/imapmailbox/jpa/host/JPAHostSystem.java
+++ b/mpt/impl/imap-mailbox/jpa/src/test/java/org/apache/james/mpt/imapmailbox/jpa/host/JPAHostSystem.java
@@ -112,7 +112,7 @@ public class JPAHostSystem extends JamesImapHostSystem {
         maxQuotaManager = new JPAPerUserMaxQuotaManager(new JPAPerUserMaxQuotaDAO(entityManagerFactory));
         StoreQuotaManager storeQuotaManager = new StoreQuotaManager(currentQuotaManager, maxQuotaManager);
         ListeningCurrentQuotaUpdater quotaUpdater = new ListeningCurrentQuotaUpdater(currentQuotaManager, quotaRootResolver, eventBus, storeQuotaManager);
-        QuotaComponents quotaComponents = new QuotaComponents(maxQuotaManager, storeQuotaManager, quotaRootResolver, quotaUpdater);
+        QuotaComponents quotaComponents = new QuotaComponents(maxQuotaManager, storeQuotaManager, quotaRootResolver);
         MessageSearchIndex index = new SimpleMessageSearchIndex(mapperFactory, mapperFactory, new DefaultTextExtractor());
 
         mailboxManager = new OpenJPAMailboxManager(mapperFactory, sessionProvider, messageParser, new DefaultMessageId.Factory(),


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


[james-project] 20/30: [Refactoring] Fix softly assertions coding style on backend-cassandra module

Posted by bt...@apache.org.
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 c21d5f8cf86edeb4b5b57757a5da69f76f0ea7cd
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Tue Nov 12 17:00:42 2019 +0700

    [Refactoring] Fix softly assertions coding style on backend-cassandra module
---
 .../cassandra/init/CassandraConfigurationTest.java | 29 +++++++++++-----------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/init/CassandraConfigurationTest.java b/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/init/CassandraConfigurationTest.java
index a97e852..678b7f7 100644
--- a/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/init/CassandraConfigurationTest.java
+++ b/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/init/CassandraConfigurationTest.java
@@ -23,15 +23,12 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import org.apache.james.backends.cassandra.init.configuration.CassandraConfiguration;
-import org.assertj.core.api.JUnitJupiterSoftAssertions;
+import org.assertj.core.api.SoftAssertions;
 import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
 
 class CassandraConfigurationTest {
-    @RegisterExtension
-    JUnitJupiterSoftAssertions softly = new JUnitJupiterSoftAssertions();
 
     @Test
     void cassandraConfigurationShouldRespectBeanContract() {
@@ -213,17 +210,19 @@ class CassandraConfigurationTest {
             .messageAttachmentIdsReadTimeout(messageAttachmentIdReadTimeout)
             .build();
 
-        softly.assertThat(configuration.getAclMaxRetry()).isEqualTo(aclMaxRetry);
-        softly.assertThat(configuration.getModSeqMaxRetry()).isEqualTo(modSeqMaxRetry);
-        softly.assertThat(configuration.getUidMaxRetry()).isEqualTo(uidMaxRetry);
-        softly.assertThat(configuration.getFetchNextPageInAdvanceRow()).isEqualTo(fetchNextPageInAdvanceRow);
-        softly.assertThat(configuration.getFlagsUpdateMessageMaxRetry()).isEqualTo(flagsUpdateMessageMaxRetry);
-        softly.assertThat(configuration.getFlagsUpdateMessageIdMaxRetry()).isEqualTo(flagsUpdateMessageIdMaxRetry);
-        softly.assertThat(configuration.getMessageReadChunkSize()).isEqualTo(messageReadChunkSize);
-        softly.assertThat(configuration.getExpungeChunkSize()).isEqualTo(expungeChunkSize);
-        softly.assertThat(configuration.getBlobPartSize()).isEqualTo(blobPartSize);
-        softly.assertThat(configuration.getAttachmentV2MigrationReadTimeout()).isEqualTo(attachmentV2MigrationReadTimeout);
-        softly.assertThat(configuration.getMessageAttachmentIdsReadTimeout()).isEqualTo(messageAttachmentIdReadTimeout);
+        SoftAssertions.assertSoftly(softly -> {
+            softly.assertThat(configuration.getAclMaxRetry()).isEqualTo(aclMaxRetry);
+            softly.assertThat(configuration.getModSeqMaxRetry()).isEqualTo(modSeqMaxRetry);
+            softly.assertThat(configuration.getUidMaxRetry()).isEqualTo(uidMaxRetry);
+            softly.assertThat(configuration.getFetchNextPageInAdvanceRow()).isEqualTo(fetchNextPageInAdvanceRow);
+            softly.assertThat(configuration.getFlagsUpdateMessageMaxRetry()).isEqualTo(flagsUpdateMessageMaxRetry);
+            softly.assertThat(configuration.getFlagsUpdateMessageIdMaxRetry()).isEqualTo(flagsUpdateMessageIdMaxRetry);
+            softly.assertThat(configuration.getMessageReadChunkSize()).isEqualTo(messageReadChunkSize);
+            softly.assertThat(configuration.getExpungeChunkSize()).isEqualTo(expungeChunkSize);
+            softly.assertThat(configuration.getBlobPartSize()).isEqualTo(blobPartSize);
+            softly.assertThat(configuration.getAttachmentV2MigrationReadTimeout()).isEqualTo(attachmentV2MigrationReadTimeout);
+            softly.assertThat(configuration.getMessageAttachmentIdsReadTimeout()).isEqualTo(messageAttachmentIdReadTimeout);
+        });
     }
 
 }


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


[james-project] 16/30: [Refactoring] Moving tests in mailbox.manager to JUnit 5

Posted by bt...@apache.org.
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 03af48a71fc5a74d19509270bcda097b80e721ff
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Mon Nov 11 16:22:28 2019 +0700

    [Refactoring] Moving tests in mailbox.manager to JUnit 5
---
 .../mailbox/manager/QuotaMessageManagerTest.java   | 66 +++++++++++++---------
 1 file changed, 40 insertions(+), 26 deletions(-)

diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/manager/QuotaMessageManagerTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/manager/QuotaMessageManagerTest.java
index a18d872..a2ce2da 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/manager/QuotaMessageManagerTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/manager/QuotaMessageManagerTest.java
@@ -19,6 +19,9 @@
 
 package org.apache.james.mailbox.manager;
 
+import static org.assertj.core.api.Assertions.assertThatCode;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
 import java.nio.charset.StandardCharsets;
 import java.util.List;
 
@@ -42,8 +45,8 @@ import org.apache.james.mailbox.quota.QuotaManager;
 import org.apache.james.mailbox.quota.QuotaRootResolver;
 import org.apache.james.mime4j.dom.Message;
 import org.assertj.core.api.SoftAssertions;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
 /**
  * Test for quota support upon basic Message manager operation.
@@ -67,8 +70,8 @@ public abstract class QuotaMessageManagerTest<T extends MailboxManager> {
 
     protected abstract IntegrationResources<T> createResources() throws Exception;
 
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    void setUp() throws Exception {
         IntegrationResources<T> resources = createResources();
         this.provisionner = new ManagerTestProvisionner(resources);
         this.provisionner.createMailboxes();
@@ -82,22 +85,26 @@ public abstract class QuotaMessageManagerTest<T extends MailboxManager> {
         quotaManager = resources.getQuotaManager();
     }
 
-    @Test(expected = OverQuotaException.class)
-    public void testAppendOverQuotaMessages() throws Exception {
+    @Test
+    void testAppendOverQuotaMessages() throws Exception {
         QuotaCount maxMessageCount = QuotaCount.count(8);
         maxQuotaManager.setMaxMessage(quotaRootResolver.getQuotaRoot(inbox), maxMessageCount);
-        provisionner.fillMailbox();
+
+        assertThatThrownBy(() -> provisionner.fillMailbox())
+            .isInstanceOf(OverQuotaException.class);
     }
 
-    @Test(expected = OverQuotaException.class)
-    public void testAppendOverQuotaSize() throws Exception {
+    @Test
+    void testAppendOverQuotaSize() throws Exception {
         QuotaSize maxQuotaSize = QuotaSize.size(3 * MockMail.MAIL_TEXT_PLAIN.length() + 1);
         maxQuotaManager.setMaxStorage(quotaRootResolver.getQuotaRoot(inbox), maxQuotaSize);
-        provisionner.fillMailbox();
+
+        assertThatThrownBy(() -> provisionner.fillMailbox())
+            .isInstanceOf(OverQuotaException.class);
     }
 
-    @Test(expected = OverQuotaException.class)
-    public void testCopyOverQuotaMessages() throws Exception {
+    @Test
+    void testCopyOverQuotaMessages() throws Exception {
         try {
             provisionner.fillMailbox();
         } catch (OverQuotaException overQuotaException) {
@@ -105,11 +112,13 @@ public abstract class QuotaMessageManagerTest<T extends MailboxManager> {
         }
         QuotaCount maxMessageCount = QuotaCount.count(15L);
         maxQuotaManager.setMaxMessage(quotaRootResolver.getQuotaRoot(inbox), maxMessageCount);
-        mailboxManager.copyMessages(MessageRange.all(), inbox, subFolder, session);
+
+        assertThatThrownBy(() -> mailboxManager.copyMessages(MessageRange.all(), inbox, subFolder, session))
+            .isInstanceOf(OverQuotaException.class);
     }
 
-    @Test(expected = OverQuotaException.class)
-    public void testCopyOverQuotaSize() throws Exception {
+    @Test
+    void testCopyOverQuotaSize() throws Exception {
         QuotaSize maxQuotaSize = QuotaSize.size(15L * MockMail.MAIL_TEXT_PLAIN.length());
         maxQuotaManager.setMaxStorage(quotaRootResolver.getQuotaRoot(inbox), maxQuotaSize);
         try {
@@ -117,11 +126,12 @@ public abstract class QuotaMessageManagerTest<T extends MailboxManager> {
         } catch (OverQuotaException overQuotaException) {
             // Silent these exception as we don't want it to disturb the test
         }
-        mailboxManager.copyMessages(MessageRange.all(), inbox, subFolder, session);
+        assertThatThrownBy(() -> mailboxManager.copyMessages(MessageRange.all(), inbox, subFolder, session))
+            .isInstanceOf(OverQuotaException.class);
     }
 
     @Test
-    public void testRetrievalOverMaxMessageAfterExpunge() throws Exception {
+    void testRetrievalOverMaxMessageAfterExpunge() throws Exception {
         QuotaCount maxMessageCount = QuotaCount.count(15L);
         maxQuotaManager.setMaxMessage(quotaRootResolver.getQuotaRoot(inbox), maxMessageCount);
         try {
@@ -131,11 +141,12 @@ public abstract class QuotaMessageManagerTest<T extends MailboxManager> {
         }
         messageManager.expunge(MessageRange.all(), session);
         // We have suppressed at list one message. Ensure we can add an other message. If is impossible, an exception will be thrown.
-        provisionner.appendMessage(messageManager, session, new FlagsBuilder().add(Flags.Flag.SEEN).build());
+        assertThatCode(() -> provisionner.appendMessage(messageManager, session, new FlagsBuilder().add(Flags.Flag.SEEN).build()))
+            .doesNotThrowAnyException();
     }
 
     @Test
-    public void testRetrievalOverMaxStorageAfterExpunge() throws Exception {
+    void testRetrievalOverMaxStorageAfterExpunge() throws Exception {
         QuotaSize maxQuotaSize = QuotaSize.size(15 * MockMail.MAIL_TEXT_PLAIN.getBytes(StandardCharsets.UTF_8).length + 1);
         maxQuotaManager.setMaxStorage(quotaRootResolver.getQuotaRoot(inbox), maxQuotaSize);
         try {
@@ -145,11 +156,12 @@ public abstract class QuotaMessageManagerTest<T extends MailboxManager> {
         }
         messageManager.expunge(MessageRange.all(), session);
         // We have suppressed at list one message. Ensure we can add an other message. If is impossible, an exception will be thrown.
-        provisionner.appendMessage(messageManager, session, new FlagsBuilder().add(Flags.Flag.SEEN).build());
+        assertThatCode(() -> provisionner.appendMessage(messageManager, session, new FlagsBuilder().add(Flags.Flag.SEEN).build()))
+            .doesNotThrowAnyException();
     }
 
     @Test
-    public void testRetrievalOverMaxMessageAfterDelete() throws Exception {
+    void testRetrievalOverMaxMessageAfterDelete() throws Exception {
         QuotaCount maxMessageCount = QuotaCount.count(15L);
         maxQuotaManager.setMaxMessage(quotaRootResolver.getQuotaRoot(inbox), maxMessageCount);
         try {
@@ -161,11 +173,12 @@ public abstract class QuotaMessageManagerTest<T extends MailboxManager> {
         List<MessageUid> uids = messageManager.getMetaData(true, session, MessageManager.MetaData.FetchGroup.UNSEEN_COUNT).getRecent();
         messageManager.delete(uids, session);
         // We have suppressed at list one message. Ensure we can add an other message. If is impossible, an exception will be thrown.
-        provisionner.appendMessage(messageManager, session, new FlagsBuilder().add(Flags.Flag.SEEN).build());
+        assertThatCode(() -> provisionner.appendMessage(messageManager, session, new FlagsBuilder().add(Flags.Flag.SEEN).build()))
+            .doesNotThrowAnyException();
     }
 
     @Test
-    public void testRetrievalOverMaxStorageAfterDelete() throws Exception {
+    void testRetrievalOverMaxStorageAfterDelete() throws Exception {
         QuotaSize maxQuotaSize = QuotaSize.size(15 * MockMail.MAIL_TEXT_PLAIN.getBytes(StandardCharsets.UTF_8).length + 1);
         maxQuotaManager.setMaxStorage(quotaRootResolver.getQuotaRoot(inbox), maxQuotaSize);
         try {
@@ -177,11 +190,12 @@ public abstract class QuotaMessageManagerTest<T extends MailboxManager> {
         List<MessageUid> uids = messageManager.getMetaData(true, session, MessageManager.MetaData.FetchGroup.UNSEEN_COUNT).getRecent();
         messageManager.delete(uids, session);
         // We have suppressed at list one message. Ensure we can add an other message. If is impossible, an exception will be thrown.
-        provisionner.appendMessage(messageManager, session, new FlagsBuilder().add(Flags.Flag.SEEN).build());
+        assertThatCode(() -> provisionner.appendMessage(messageManager, session, new FlagsBuilder().add(Flags.Flag.SEEN).build()))
+            .doesNotThrowAnyException();
     }
 
     @Test
-    public void deletingAMailboxShouldDecreaseCurrentQuota() throws Exception {
+    void deletingAMailboxShouldDecreaseCurrentQuota() throws Exception {
         provisionner.fillMailbox();
 
         mailboxManager.deleteMailbox(inbox, session);
@@ -196,7 +210,7 @@ public abstract class QuotaMessageManagerTest<T extends MailboxManager> {
     }
 
     @Test
-    public void deletingAMailboxShouldPreserveQuotaOfOtherMailboxes() throws Exception {
+    void deletingAMailboxShouldPreserveQuotaOfOtherMailboxes() throws Exception {
         provisionner.fillMailbox();
 
         mailboxManager.getMailbox(subFolder, session)


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


[james-project] 03/30: JAMES-2704 RandomStoringTest should have a per method lifecycle

Posted by bt...@apache.org.
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 21fd5931dcfac92d5ca50335189fc7caeb9c75e8
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Wed Nov 6 16:38:16 2019 +0700

    JAMES-2704 RandomStoringTest should have a per method lifecycle
    
    Also IMAP connections were not closed upon failure
---
 .../apache/james/smtp/SmtpRandomStoringTest.java   | 42 ++++++++++------------
 1 file changed, 19 insertions(+), 23 deletions(-)

diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpRandomStoringTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpRandomStoringTest.java
index 4faf1e8..28287c4 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpRandomStoringTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpRandomStoringTest.java
@@ -54,9 +54,8 @@ import org.apache.james.utils.SMTPMessageSender;
 import org.apache.mailet.Mail;
 import org.awaitility.Duration;
 import org.awaitility.core.ConditionFactory;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
@@ -85,25 +84,25 @@ public class SmtpRandomStoringTest {
             .build();
 
     @Rule
-    public IMAPMessageReader imapMessageReader = new IMAPMessageReader();
-    @ClassRule
-    public static SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
-    @ClassRule
-    public static TemporaryFolder temporaryFolder = new TemporaryFolder();
+    public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN);
+    @Rule
+    public TemporaryFolder temporaryFolder = new TemporaryFolder();
 
-    private static TemporaryJamesServer jamesServer;
-    private static ImapGuiceProbe imapProbe;
+    private TemporaryJamesServer jamesServer;
+    private ImapGuiceProbe imapProbe;
+    private Collection<IMAPMessageReader> connections;
 
-    @BeforeClass
-    public static void setUp() throws Exception {
+    @Before
+    public void setUp() throws Exception {
         createJamesServer();
 
         createUsersAndMailboxes();
 
         imapProbe = jamesServer.getProbe(ImapGuiceProbe.class);
+        connections = ImmutableList.of();
     }
 
-    private static void createUsersAndMailboxes() throws Exception {
+    private void createUsersAndMailboxes() throws Exception {
         MailboxProbeImpl mailboxes = jamesServer.getProbe(MailboxProbeImpl.class);
         DataProbe dataProbe = jamesServer.getProbe(DataProbeImpl.class);
         dataProbe.addDomain(DEFAULT_DOMAIN);
@@ -130,7 +129,7 @@ public class SmtpRandomStoringTest {
         }
     }
 
-    private static void createJamesServer() throws Exception {
+    private void createJamesServer() throws Exception {
         MailetContainer.Builder mailetContainer = TemporaryJamesServer.SIMPLE_MAILET_CONTAINER_CONFIGURATION
             .putProcessor(ProcessorConfiguration.transport()
                 .addMailet(RANDOM_STORING)
@@ -142,7 +141,7 @@ public class SmtpRandomStoringTest {
             .build(temporaryFolder.newFolder());
     }
 
-    private static void sendMails() throws Exception {
+    private void sendMails() throws Exception {
         SMTPMessageSender authenticatedSmtpConnection = messageSender.connect(LOCALHOST_IP, jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort())
             .authenticate(FROM, PASSWORD);
 
@@ -152,35 +151,32 @@ public class SmtpRandomStoringTest {
                     .sendMessage(buildMail("Message " + index))).sneakyThrow());
     }
 
-    @AfterClass
-    public static void tearDown() {
+    @After
+    public void tearDown() {
+        connections.forEach(Throwing.consumer(IMAPMessageReader::close).sneakyThrow());
         jamesServer.shutdown();
     }
 
     @Test
     public void oneHundredMailsShouldHaveBeenStoredBetweenFourAndEightTimes() {
-        Collection<IMAPMessageReader> connections = USERS
+        connections = USERS
             .stream()
             .map(this::createIMAPConnection)
             .collect(Guavate.toImmutableList());
 
         awaitAtMostTenSeconds
             .untilAsserted(() -> checkNumberOfMessages(connections));
-
-        connections.forEach(Throwing.consumer(IMAPMessageReader::close).sneakyThrow());
     }
 
     @Test
     public void messagesShouldBeRandomlyAssignedToEveryMailboxesOfEveryUsers() {
-        Collection<IMAPMessageReader> connections = USERS
+        connections = USERS
             .stream()
             .map(this::createIMAPConnection)
             .collect(Guavate.toImmutableList());
 
         awaitAtMostTenSeconds
             .untilAsserted(() -> checkMailboxesHaveBeenFilled(connections));
-
-        connections.forEach(Throwing.consumer(IMAPMessageReader::close).sneakyThrow());
     }
 
     private IMAPMessageReader createIMAPConnection(String username) {


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


[james-project] 19/30: [Refactoring] Moving remaining tests in mailbox api to JUnit 5

Posted by bt...@apache.org.
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 07651c001b5efb411528f5657e3653abbae3c2f6
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Mon Nov 11 16:23:50 2019 +0700

    [Refactoring] Moving remaining tests in mailbox api to JUnit 5
    
    Except for AbstractSubscriptionManagerTest and MailboxManagerStressTest.
    Those are trickier and require quite some work with the implementation classes depending on it.
---
 .../james/mailbox/ApplicableFlagBuilderTest.java   | 68 ++++++++-------
 .../james/mailbox/ComposedMessageIdTest.java       |  6 +-
 .../apache/james/mailbox/MailboxExceptionTest.java | 96 +++++++++++-----------
 .../apache/james/mailbox/MailboxManagerTest.java   |  4 +-
 .../apache/james/mailbox/MessageMoveEventTest.java | 38 ++++-----
 .../org/apache/james/mailbox/MessageUidTest.java   | 21 ++---
 .../java/org/apache/james/mailbox/RoleTest.java    | 56 ++++++-------
 7 files changed, 146 insertions(+), 143 deletions(-)

diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/ApplicableFlagBuilderTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/ApplicableFlagBuilderTest.java
index 520e7e5..8982b18 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/ApplicableFlagBuilderTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/ApplicableFlagBuilderTest.java
@@ -22,47 +22,47 @@ import static org.assertj.core.api.Assertions.assertThat;
 
 import javax.mail.Flags;
 
-import org.assertj.core.api.JUnitSoftAssertions;
-import org.junit.Rule;
-import org.junit.Test;
+import org.assertj.core.api.SoftAssertions;
+import org.junit.jupiter.api.Test;
 
 import com.google.common.collect.ImmutableList;
 
-public class ApplicableFlagBuilderTest {
-
-    @Rule
-    public final JUnitSoftAssertions softly = new JUnitSoftAssertions();
+class ApplicableFlagBuilderTest {
 
     @Test
-    public void shouldAtLeastContainAllDefaultApplicativeFlag() {
+    void shouldAtLeastContainAllDefaultApplicativeFlag() {
         assertThat(ApplicableFlagBuilder.builder().build())
             .isEqualTo(ApplicableFlagBuilder.DEFAULT_APPLICABLE_FLAGS);
     }
 
     @Test
-    public void shouldNeverRetainRecentAndUserFlag() {
+    void shouldNeverRetainRecentAndUserFlag() {
         Flags result = ApplicableFlagBuilder.builder()
             .add(new Flags(Flags.Flag.RECENT))
             .add(new Flags(Flags.Flag.USER))
             .build();
 
-        softly.assertThat(result.contains(Flags.Flag.RECENT)).isFalse();
-        softly.assertThat(result.contains(Flags.Flag.USER)).isFalse();
+        SoftAssertions.assertSoftly(softly -> {
+            softly.assertThat(result.contains(Flags.Flag.RECENT)).isFalse();
+            softly.assertThat(result.contains(Flags.Flag.USER)).isFalse();
+        });
     }
 
     @Test
-    public void shouldAddCustomUserFlagIfProvidedToDefaultFlag() {
+    void shouldAddCustomUserFlagIfProvidedToDefaultFlag() {
         Flags result = ApplicableFlagBuilder.builder()
             .add("yolo", "vibe")
             .build();
 
-        softly.assertThat(result.contains(ApplicableFlagBuilder.DEFAULT_APPLICABLE_FLAGS)).isTrue();
-        softly.assertThat(result.contains("yolo")).isTrue();
-        softly.assertThat(result.contains("vibe")).isTrue();
+        SoftAssertions.assertSoftly(softly -> {
+            softly.assertThat(result.contains(ApplicableFlagBuilder.DEFAULT_APPLICABLE_FLAGS)).isTrue();
+            softly.assertThat(result.contains("yolo")).isTrue();
+            softly.assertThat(result.contains("vibe")).isTrue();
+        });
     }
 
     @Test
-    public void shouldAcceptUserCustomFlagInsideFlags() {
+    void shouldAcceptUserCustomFlagInsideFlags() {
         Flags result = ApplicableFlagBuilder.builder()
             .add(new Flags("yolo"))
             .build();
@@ -71,7 +71,7 @@ public class ApplicableFlagBuilderTest {
     }
 
     @Test
-    public void shouldAcceptFlagsThatContainMultipleFlag() {
+    void shouldAcceptFlagsThatContainMultipleFlag() {
         Flags flags = FlagsBuilder.builder()
             .add("yolo", "vibes")
             .build();
@@ -80,42 +80,50 @@ public class ApplicableFlagBuilderTest {
             .add(flags)
             .build();
 
-        softly.assertThat(result.contains("yolo")).isTrue();
-        softly.assertThat(result.contains("vibes")).isTrue();
+        SoftAssertions.assertSoftly(softly -> {
+            softly.assertThat(result.contains("yolo")).isTrue();
+            softly.assertThat(result.contains("vibes")).isTrue();
+        });
     }
 
     @Test
-    public void addShouldAddMultipleFlagsAtOnce() {
+    void addShouldAddMultipleFlagsAtOnce() {
         Flags flags = new Flags("cartman");
         Flags flags2 = new Flags("butters");
         Flags result = ApplicableFlagBuilder.builder()
                 .add(flags, flags2)
                 .build();
 
-        softly.assertThat(result.contains(flags)).isTrue();
-        softly.assertThat(result.contains(flags2)).isTrue();
+        SoftAssertions.assertSoftly(softly -> {
+            softly.assertThat(result.contains(flags)).isTrue();
+            softly.assertThat(result.contains(flags2)).isTrue();
+        });
     }
 
     @Test
-    public void shouldAcceptMultipleFlagAtOnce() {
+    void shouldAcceptMultipleFlagAtOnce() {
         Flags result = ApplicableFlagBuilder.builder()
             .add("cartman", "butters")
             .add("chef", "randy")
             .build();
 
-        softly.assertThat(result.contains("cartman")).isTrue();
-        softly.assertThat(result.contains("butters")).isTrue();
-        softly.assertThat(result.contains("chef")).isTrue();
-        softly.assertThat(result.contains("randy")).isTrue();
+        SoftAssertions.assertSoftly(softly -> {
+            softly.assertThat(result.contains("cartman")).isTrue();
+            softly.assertThat(result.contains("butters")).isTrue();
+            softly.assertThat(result.contains("chef")).isTrue();
+            softly.assertThat(result.contains("randy")).isTrue();
+        });
     }
 
     @Test
-    public void shouldAcceptListOfFlags() throws Exception {
+    void shouldAcceptListOfFlags() throws Exception {
         Flags result = ApplicableFlagBuilder.builder()
             .add(ImmutableList.of(new Flags("cartman"), new Flags("chef")))
             .build();
 
-        softly.assertThat(result.contains("cartman")).isTrue();
-        softly.assertThat(result.contains("chef")).isTrue();
+        SoftAssertions.assertSoftly(softly -> {
+            softly.assertThat(result.contains("cartman")).isTrue();
+            softly.assertThat(result.contains("chef")).isTrue();
+        });
     }
 }
\ No newline at end of file
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/ComposedMessageIdTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/ComposedMessageIdTest.java
index 63b3c8f..a82c5d0 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/ComposedMessageIdTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/ComposedMessageIdTest.java
@@ -20,14 +20,14 @@
 package org.apache.james.mailbox;
 
 import org.apache.james.mailbox.model.ComposedMessageId;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
 
-public class ComposedMessageIdTest {
+class ComposedMessageIdTest {
 
     @Test
-    public void composedMessageIdShouldRespectBeanContract() {
+    void composedMessageIdShouldRespectBeanContract() {
         EqualsVerifier.forClass(ComposedMessageId.class)
             .verify();
     }
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxExceptionTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxExceptionTest.java
index e90a057..878b599 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxExceptionTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxExceptionTest.java
@@ -1,48 +1,48 @@
-/****************************************************************
- * 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;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import org.apache.james.mailbox.exception.MailboxException;
-import org.junit.Test;
-
-/**
- * Ensure that {@link MailboxException} construction is correct.
- */
-public class MailboxExceptionTest {
-    
-    private static final String EXCEPTION_MESSAGE = "this is an exception message";
-    private static final String CAUSE_MESSAGE = "this is a cause";
-    private static final Exception EXCEPTION_CAUSE = new Exception(CAUSE_MESSAGE);
-    
-    @Test
-    public void testMailboxExceptionMessage() {
-        MailboxException mbe = new MailboxException(EXCEPTION_MESSAGE);
-        assertThat(mbe).hasMessage(EXCEPTION_MESSAGE);
-    }
-
-    @Test
-    public void testMailboxExceptionCause() {
-        MailboxException mbe = new MailboxException(EXCEPTION_MESSAGE, EXCEPTION_CAUSE);
-        assertThat(mbe).hasMessage(EXCEPTION_MESSAGE).hasCauseExactlyInstanceOf(Exception.class);
-        assertThat(mbe.getCause()).hasMessage(CAUSE_MESSAGE);
-    }
-
-}
+/****************************************************************
+ * 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;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.apache.james.mailbox.exception.MailboxException;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Ensure that {@link MailboxException} construction is correct.
+ */
+class MailboxExceptionTest {
+    
+    private static final String EXCEPTION_MESSAGE = "this is an exception message";
+    private static final String CAUSE_MESSAGE = "this is a cause";
+    private static final Exception EXCEPTION_CAUSE = new Exception(CAUSE_MESSAGE);
+    
+    @Test
+    void testMailboxExceptionMessage() {
+        MailboxException mbe = new MailboxException(EXCEPTION_MESSAGE);
+        assertThat(mbe).hasMessage(EXCEPTION_MESSAGE);
+    }
+
+    @Test
+    void testMailboxExceptionCause() {
+        MailboxException mbe = new MailboxException(EXCEPTION_MESSAGE, EXCEPTION_CAUSE);
+        assertThat(mbe).hasMessage(EXCEPTION_MESSAGE).hasCauseExactlyInstanceOf(Exception.class);
+        assertThat(mbe.getCause()).hasMessage(CAUSE_MESSAGE);
+    }
+
+}
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java
index 7d2863d..c68a380 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java
@@ -144,7 +144,7 @@ public abstract class MailboxManagerTest<T extends MailboxManager> {
     }
 
     @Test
-    public void creatingConcurrentlyMailboxesWithSameParentShouldNotFail() throws Exception {
+    protected void creatingConcurrentlyMailboxesWithSameParentShouldNotFail() throws Exception {
         MailboxSession session = mailboxManager.createSystemSession(USER_1);
         String mailboxName = "a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z";
 
@@ -155,7 +155,7 @@ public abstract class MailboxManagerTest<T extends MailboxManager> {
     }
 
     @Test
-    public void createMailboxShouldReturnRightId() throws Exception {
+    void createMailboxShouldReturnRightId() throws Exception {
         session = mailboxManager.createSystemSession(USER_1);
         mailboxManager.startProcessingRequest(session);
 
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/MessageMoveEventTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/MessageMoveEventTest.java
index 02688da..4a591c3 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/MessageMoveEventTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/MessageMoveEventTest.java
@@ -26,31 +26,27 @@ import org.apache.james.mailbox.events.MessageMoveEvent;
 import org.apache.james.mailbox.model.MessageMoves;
 import org.apache.james.mailbox.model.TestId;
 import org.apache.james.mailbox.model.TestMessageId;
-import org.assertj.core.api.JUnitSoftAssertions;
-import org.junit.Rule;
-import org.junit.Test;
+import org.assertj.core.api.SoftAssertions;
+import org.junit.jupiter.api.Test;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
 
-public class MessageMoveEventTest {
-
-    @Rule
-    public JUnitSoftAssertions softly = new JUnitSoftAssertions();
+class MessageMoveEventTest {
 
     @Test
-    public void shouldRespectBeanContract() {
+    void shouldRespectBeanContract() {
         EqualsVerifier.forClass(MessageMoveEvent.class).verify();
     }
 
     @Test
-    public void builderShouldThrowWhenSessionIsNull() {
+    void builderShouldThrowWhenSessionIsNull() {
         assertThatThrownBy(() -> MessageMoveEvent.builder()
                 .build())
             .isInstanceOf(NullPointerException.class);
     }
 
     @Test
-    public void builderShouldThrowWhenMessageMovesIsNull() {
+    void builderShouldThrowWhenMessageMovesIsNull() {
         assertThatThrownBy(() -> MessageMoveEvent.builder()
                 .session(MailboxSessionUtil.create("user@james.org"))
                 .build())
@@ -58,7 +54,7 @@ public class MessageMoveEventTest {
     }
 
     @Test
-    public void builderShouldReturnNoopWhenMessagesIsEmpty() {
+    void builderShouldReturnNoopWhenMessagesIsEmpty() {
         assertThat(MessageMoveEvent.builder()
                 .session(MailboxSessionUtil.create("user@james.org"))
                 .messageMoves(MessageMoves.builder()
@@ -70,7 +66,7 @@ public class MessageMoveEventTest {
     }
 
     @Test
-    public void builderShouldNotBeNoopWhenFieldsAreGiven() {
+    void builderShouldNotBeNoopWhenFieldsAreGiven() {
         MailboxSession session = MailboxSessionUtil.create("user@james.org");
         MessageMoves messageMoves = MessageMoves.builder()
             .targetMailboxIds(TestId.of(2))
@@ -87,7 +83,7 @@ public class MessageMoveEventTest {
     }
 
     @Test
-    public void builderShouldBuildWhenFieldsAreGiven() {
+    void builderShouldBuildWhenFieldsAreGiven() {
         String username = "user@james.org";
         MailboxSession session = MailboxSessionUtil.create(username);
         MessageMoves messageMoves = MessageMoves.builder()
@@ -102,13 +98,15 @@ public class MessageMoveEventTest {
             .messageId(messageId)
             .build();
 
-        softly.assertThat(event.getUsername()).isEqualTo(Username.of(username));
-        softly.assertThat(event.getMessageMoves()).isEqualTo(messageMoves);
-        softly.assertThat(event.getMessageIds()).containsExactly(messageId);
+        SoftAssertions.assertSoftly(softly -> {
+            softly.assertThat(event.getUsername()).isEqualTo(Username.of(username));
+            softly.assertThat(event.getMessageMoves()).isEqualTo(messageMoves);
+            softly.assertThat(event.getMessageIds()).containsExactly(messageId);
+        });
     }
 
     @Test
-    public void isMoveToShouldReturnFalseWhenMailboxIdIsNotInAddedMailboxIds() {
+    void isMoveToShouldReturnFalseWhenMailboxIdIsNotInAddedMailboxIds() {
         MessageMoveEvent event = MessageMoveEvent.builder()
             .session(MailboxSessionUtil.create("user@james.org"))
             .messageMoves(MessageMoves.builder()
@@ -121,7 +119,7 @@ public class MessageMoveEventTest {
     }
 
     @Test
-    public void isMoveToShouldReturnTrueWhenMailboxIdIsInAddedMailboxIds() {
+    void isMoveToShouldReturnTrueWhenMailboxIdIsInAddedMailboxIds() {
         TestId mailboxId = TestId.of(123);
         MessageMoveEvent event = MessageMoveEvent.builder()
             .session(MailboxSessionUtil.create("user@james.org"))
@@ -135,7 +133,7 @@ public class MessageMoveEventTest {
     }
 
     @Test
-    public void isMoveFromShouldReturnFalseWhenMailboxIdIsNotInRemovedMailboxIds() {
+    void isMoveFromShouldReturnFalseWhenMailboxIdIsNotInRemovedMailboxIds() {
         MessageMoveEvent event = MessageMoveEvent.builder()
             .session(MailboxSessionUtil.create("user@james.org"))
             .messageMoves(MessageMoves.builder()
@@ -148,7 +146,7 @@ public class MessageMoveEventTest {
     }
 
     @Test
-    public void isMoveFromShouldReturnTrueWhenMailboxIdIsInRemovedMailboxIds() {
+    void isMoveFromShouldReturnTrueWhenMailboxIdIsInRemovedMailboxIds() {
         TestId mailboxId = TestId.of(123);
         MessageMoveEvent event = MessageMoveEvent.builder()
             .session(MailboxSessionUtil.create("user@james.org"))
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/MessageUidTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/MessageUidTest.java
index ee3f42e..89c6cdf 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/MessageUidTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/MessageUidTest.java
@@ -19,14 +19,11 @@
 package org.apache.james.mailbox;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
 
-public class MessageUidTest {
-
-    @Rule public ExpectedException exception = ExpectedException.none();
+class MessageUidTest {
     
     private static final MessageUid _1 = MessageUid.of(1);
     private static final MessageUid _2 = MessageUid.of(2);
@@ -34,24 +31,24 @@ public class MessageUidTest {
     private static final MessageUid _4 = MessageUid.of(4);
 
     @Test
-    public void distanceShouldReturnZeroWhenSameValue() {
+    void distanceShouldReturnZeroWhenSameValue() {
         assertThat(_1.distance(_1)).isEqualTo(0);
     }
 
     @Test
-    public void distanceShouldThrowWhenNullArgument() {
-        exception.expect(NullPointerException.class);
-        _1.distance(null);
+    void distanceShouldThrowWhenNullArgument() {
+        assertThatThrownBy(() -> _1.distance(null))
+            .isInstanceOf(NullPointerException.class);
     }
 
 
     @Test
-    public void distanceShouldReturnPositiveDistanceWhenGreaterArgument() {
+    void distanceShouldReturnPositiveDistanceWhenGreaterArgument() {
         assertThat(_1.distance(_4)).isEqualTo(3);
     }
     
     @Test
-    public void distanceShouldReturnNegativeDistanceWhenSmallerArgument() {
+    void distanceShouldReturnNegativeDistanceWhenSmallerArgument() {
         assertThat(_3.distance(_2)).isEqualTo(-1);
     }
 }
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/RoleTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/RoleTest.java
index 6352a07..b612fb3 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/RoleTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/RoleTest.java
@@ -23,28 +23,28 @@ import static org.assertj.core.api.Assertions.assertThat;
 import java.util.Locale;
 import java.util.Optional;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-public class RoleTest {
+class RoleTest {
 
     @Test
-    public void fromShouldReturnEmptyWhenUnknownValue() {
+    void fromShouldReturnEmptyWhenUnknownValue() {
         assertThat(Role.from("jjjj")).isEqualTo(Optional.empty());
     }
 
     @Test
-    public void fromShouldReturnSomethingWhenXPrefixedRole() {
+    void fromShouldReturnSomethingWhenXPrefixedRole() {
         assertThat(Role.from("x-client-specific-role")).isEqualTo(Optional.of(new Role("x-client-specific-role")));
     }
 
     @Test
-    public void isSystemRoleShouldReturnFalseWhenXPrefixedRole() {
+    void isSystemRoleShouldReturnFalseWhenXPrefixedRole() {
         Role role = Role.from("x-client-specific-role").get();
         assertThat(role.isSystemRole()).isFalse();
     }
 
     @Test
-    public void fromShouldReturnInboxWhenContainsUppercaseValueInTurkish() {
+    void fromShouldReturnInboxWhenContainsUppercaseValueInTurkish() {
         Locale previousLocale = Locale.getDefault();
         Locale.setDefault(Locale.forLanguageTag("tr"));
         try {
@@ -55,124 +55,124 @@ public class RoleTest {
     }
 
     @Test
-    public void isSystemRoleShouldBeTrueWhenInbox() {
+    void isSystemRoleShouldBeTrueWhenInbox() {
         assertThat(Role.INBOX.isSystemRole()).isTrue();
     }
 
     @Test
-    public void isSystemRoleShouldBeTrueWhenArchive() {
+    void isSystemRoleShouldBeTrueWhenArchive() {
         assertThat(Role.ARCHIVE.isSystemRole()).isTrue();
     }
 
     @Test
-    public void isSystemRoleShouldBeTrueWhenDrafts() {
+    void isSystemRoleShouldBeTrueWhenDrafts() {
         assertThat(Role.DRAFTS.isSystemRole()).isTrue();
     }
 
     @Test
-    public void isSystemRoleShouldBeTrueWhenOutbox() {
+    void isSystemRoleShouldBeTrueWhenOutbox() {
         assertThat(Role.OUTBOX.isSystemRole()).isTrue();
     }
 
     @Test
-    public void isSystemRoleShouldBeTrueWhenSent() {
+    void isSystemRoleShouldBeTrueWhenSent() {
         assertThat(Role.SENT.isSystemRole()).isTrue();
     }
 
     @Test
-    public void isSystemRoleShouldBeTrueWhenTrash() {
+    void isSystemRoleShouldBeTrueWhenTrash() {
         assertThat(Role.TRASH.isSystemRole()).isTrue();
     }
 
     @Test
-    public void isSystemRoleShouldBeTrueWhenSpam() {
+    void isSystemRoleShouldBeTrueWhenSpam() {
         assertThat(Role.SPAM.isSystemRole()).isTrue();
     }
 
     @Test
-    public void isSystemRoleShouldBeTrueWhenTemplates() {
+    void isSystemRoleShouldBeTrueWhenTemplates() {
         assertThat(Role.TEMPLATES.isSystemRole()).isTrue();
     }
 
     @Test
-    public void isSystemRoleShouldBeTrueWhenRestoredMessages() {
+    void isSystemRoleShouldBeTrueWhenRestoredMessages() {
         assertThat(Role.RESTORED_MESSAGES.isSystemRole()).isTrue();
     }
 
     @Test
-    public void isSystemRoleShouldBeFalseWhenUserDefinedRole() {
+    void isSystemRoleShouldBeFalseWhenUserDefinedRole() {
         Role userRole = Role.from(Role.USER_DEFINED_ROLE_PREFIX + "myRole").get();
         assertThat(userRole.isSystemRole()).isFalse();
     }
 
     @Test
-    public void theINBOXMailboxNameShouldBeASystemMailbox() {
+    void theINBOXMailboxNameShouldBeASystemMailbox() {
         Role role = Role.from("INBOX").get();
         assertThat(role.isSystemRole()).isTrue();
     }
 
     @Test
-    public void theInBoXMailboxNameShouldBeASystemMailbox() {
+    void theInBoXMailboxNameShouldBeASystemMailbox() {
         Role role = Role.from("InBoX").get();
         assertThat(role.isSystemRole()).isTrue();
     }
 
     @Test
-    public void theDraftsMailboxNameShouldBeASystemMailbox() {
+    void theDraftsMailboxNameShouldBeASystemMailbox() {
         Role role = Role.from("Drafts").get();
         assertThat(role.isSystemRole()).isTrue();
     }
 
     @Test
-    public void theDrAfTsMailboxNameShouldNotBeASystemMailbox() {
+    void theDrAfTsMailboxNameShouldNotBeASystemMailbox() {
         Optional<Role> role = Role.from("DrAfTs");
         assertThat(role).isEmpty();
     }
 
     @Test
-    public void theOutboxMailboxNameShouldBeASystemMailbox() {
+    void theOutboxMailboxNameShouldBeASystemMailbox() {
         Role role = Role.from("Outbox").get();
         assertThat(role.isSystemRole()).isTrue();
     }
 
     @Test
-    public void theOuTbOxMailboxNameShouldNotBeASystemMailbox() {
+    void theOuTbOxMailboxNameShouldNotBeASystemMailbox() {
         Optional<Role> role = Role.from("OuTbOx");
         assertThat(role).isEmpty();
     }
 
     @Test
-    public void theSentMailboxNameShouldBeASystemMailbox() {
+    void theSentMailboxNameShouldBeASystemMailbox() {
         Role role = Role.from("Sent").get();
         assertThat(role.isSystemRole()).isTrue();
     }
 
     @Test
-    public void theSeNtMailboxNameShouldNotBeASystemMailbox() {
+    void theSeNtMailboxNameShouldNotBeASystemMailbox() {
         Optional<Role> role = Role.from("SeNt");
         assertThat(role).isEmpty();
     }
 
     @Test
-    public void theTrashMailboxNameShouldBeASystemMailbox() {
+    void theTrashMailboxNameShouldBeASystemMailbox() {
         Role role = Role.from("Trash").get();
         assertThat(role.isSystemRole()).isTrue();
     }
 
     @Test
-    public void theTrAsHMailboxNameShouldNotBeASystemMailbox() {
+    void theTrAsHMailboxNameShouldNotBeASystemMailbox() {
         Optional<Role> role = Role.from("TrAsH");
         assertThat(role).isEmpty();
     }
 
     @Test
-    public void theRestoredMessagesMailboxNameShouldBeASystemMailbox() {
+    void theRestoredMessagesMailboxNameShouldBeASystemMailbox() {
         Role role = Role.from("Restored-Messages").get();
         assertThat(role.isSystemRole()).isTrue();
     }
 
     @Test
-    public void theReStOrEdMeSsAgEsMailboxNameShouldNotBeASystemMailbox() {
+    void theReStOrEdMeSsAgEsMailboxNameShouldNotBeASystemMailbox() {
         Optional<Role> role = Role.from("ReStOrEd-MeSsAgEs");
         assertThat(role).isEmpty();
     }


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


[james-project] 15/30: [Refactoring] Moving tests in mailbox.indexer to JUnit 5

Posted by bt...@apache.org.
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 f84dd3d7ec1e14e02b60bd3cd3a05d12f86121f8
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Mon Nov 11 16:22:12 2019 +0700

    [Refactoring] Moving tests in mailbox.indexer to JUnit 5
---
 .../apache/james/mailbox/indexer/ReindexingExecutionFailuresTest.java   | 2 +-
 .../java/org/apache/james/mailbox/indexer/ReindexingFailureTest.java    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/indexer/ReindexingExecutionFailuresTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/indexer/ReindexingExecutionFailuresTest.java
index 30e60c7..884a149 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/indexer/ReindexingExecutionFailuresTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/indexer/ReindexingExecutionFailuresTest.java
@@ -22,7 +22,7 @@ import org.junit.jupiter.api.Test;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
 
-public class ReindexingExecutionFailuresTest {
+class ReindexingExecutionFailuresTest {
 
     @Test
     void shouldRespectBeanContract() {
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/indexer/ReindexingFailureTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/indexer/ReindexingFailureTest.java
index 4efb0f0..3395152 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/indexer/ReindexingFailureTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/indexer/ReindexingFailureTest.java
@@ -22,7 +22,7 @@ import org.junit.jupiter.api.Test;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
 
-public class ReindexingFailureTest {
+class ReindexingFailureTest {
 
     @Test
     void shouldRespectBeanContract() {


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


[james-project] 08/30: [Refactoring] processMessage rename

Posted by bt...@apache.org.
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 e9280839c8d65ad1df6257b23d81d27875e1b820
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Nov 11 12:23:33 2019 +0700

    [Refactoring] processMessage rename
---
 .../org/apache/james/imap/processor/AbstractMailboxProcessor.java     | 4 ++--
 .../apache/james/imap/processor/AbstractMessageRangeProcessor.java    | 2 +-
 .../org/apache/james/imap/processor/AbstractSelectionProcessor.java   | 2 +-
 .../apache/james/imap/processor/AbstractSubscriptionProcessor.java    | 2 +-
 .../main/java/org/apache/james/imap/processor/AppendProcessor.java    | 2 +-
 .../java/org/apache/james/imap/processor/AuthenticateProcessor.java   | 2 +-
 .../java/org/apache/james/imap/processor/CapabilityProcessor.java     | 2 +-
 .../src/main/java/org/apache/james/imap/processor/CheckProcessor.java | 2 +-
 .../src/main/java/org/apache/james/imap/processor/CloseProcessor.java | 2 +-
 .../main/java/org/apache/james/imap/processor/CreateProcessor.java    | 2 +-
 .../main/java/org/apache/james/imap/processor/DeleteACLProcessor.java | 2 +-
 .../main/java/org/apache/james/imap/processor/DeleteProcessor.java    | 2 +-
 .../main/java/org/apache/james/imap/processor/EnableProcessor.java    | 2 +-
 .../main/java/org/apache/james/imap/processor/ExpungeProcessor.java   | 2 +-
 .../main/java/org/apache/james/imap/processor/GetACLProcessor.java    | 2 +-
 .../java/org/apache/james/imap/processor/GetAnnotationProcessor.java  | 4 ++--
 .../main/java/org/apache/james/imap/processor/GetQuotaProcessor.java  | 2 +-
 .../java/org/apache/james/imap/processor/GetQuotaRootProcessor.java   | 2 +-
 .../src/main/java/org/apache/james/imap/processor/IdleProcessor.java  | 2 +-
 .../src/main/java/org/apache/james/imap/processor/ListProcessor.java  | 2 +-
 .../java/org/apache/james/imap/processor/ListRightsProcessor.java     | 2 +-
 .../src/main/java/org/apache/james/imap/processor/LoginProcessor.java | 2 +-
 .../main/java/org/apache/james/imap/processor/LogoutProcessor.java    | 2 +-
 .../main/java/org/apache/james/imap/processor/MyRightsProcessor.java  | 2 +-
 .../main/java/org/apache/james/imap/processor/NamespaceProcessor.java | 2 +-
 .../src/main/java/org/apache/james/imap/processor/NoopProcessor.java  | 2 +-
 .../main/java/org/apache/james/imap/processor/RenameProcessor.java    | 2 +-
 .../main/java/org/apache/james/imap/processor/SearchProcessor.java    | 2 +-
 .../main/java/org/apache/james/imap/processor/SetACLProcessor.java    | 2 +-
 .../java/org/apache/james/imap/processor/SetAnnotationProcessor.java  | 4 ++--
 .../main/java/org/apache/james/imap/processor/SetQuotaProcessor.java  | 2 +-
 .../main/java/org/apache/james/imap/processor/StatusProcessor.java    | 2 +-
 .../src/main/java/org/apache/james/imap/processor/StoreProcessor.java | 2 +-
 .../main/java/org/apache/james/imap/processor/UnselectProcessor.java  | 2 +-
 .../java/org/apache/james/imap/processor/fetch/FetchProcessor.java    | 2 +-
 .../java/org/apache/james/imap/processor/SearchProcessorTest.java     | 2 +-
 36 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
index ffd20e6..752bed3 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
@@ -109,7 +109,7 @@ public abstract class AbstractMailboxProcessor<M extends ImapRequest> extends Ab
             } else {
                 getMailboxManager().startProcessingRequest(ImapSessionUtils.getMailboxSession(session));
 
-                doProcess(message, session, tag, command, responder);
+                processMessage(message, session, tag, command, responder);
 
                 getMailboxManager().endProcessingRequest(ImapSessionUtils.getMailboxSession(session));
 
@@ -370,7 +370,7 @@ public abstract class AbstractMailboxProcessor<M extends ImapRequest> extends Ab
         responder.respond(response);
     }
 
-    protected abstract void doProcess(M message, ImapSession session, Tag tag, ImapCommand command, Responder responder);
+    protected abstract void processMessage(M message, ImapSession session, Tag tag, ImapCommand command, Responder responder);
 
     /**
      * Joins the elements of a mailboxPath together and returns them as a string
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMessageRangeProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMessageRangeProcessor.java
index c95afcf..7906815 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMessageRangeProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMessageRangeProcessor.java
@@ -62,7 +62,7 @@ public abstract class AbstractMessageRangeProcessor<M extends AbstractMessageRan
     protected abstract String getOperationName();
 
     @Override
-    protected void doProcess(M request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(M request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
         final MailboxPath targetMailbox = PathConverter.forSession(session).buildFullPath(request.getMailboxName());
         final IdRange[] idSet = request.getIdSet();
         final boolean useUids = request.isUseUids();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
index 7f23302..bebfc25 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
@@ -79,7 +79,7 @@ abstract class AbstractSelectionProcessor<M extends AbstractMailboxSelectionRequ
     }
 
     @Override
-    protected void doProcess(M request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(M request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
         final String mailboxName = request.getMailboxName();
         try {
             final MailboxPath fullMailboxPath = PathConverter.forSession(session).buildFullPath(mailboxName);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSubscriptionProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSubscriptionProcessor.java
index f105d33..4ca5ac5 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSubscriptionProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSubscriptionProcessor.java
@@ -54,7 +54,7 @@ public abstract class AbstractSubscriptionProcessor<M extends ImapRequest> exten
     }
 
     @Override
-    protected final void doProcess(M message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected final void processMessage(M message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
 
         // take care of calling the start/end processing
         MailboxSession mSession = ImapSessionUtils.getMailboxSession(session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AppendProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AppendProcessor.java
index 316ca10..179792c 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AppendProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AppendProcessor.java
@@ -64,7 +64,7 @@ public class AppendProcessor extends AbstractMailboxProcessor<AppendRequest> {
     }
 
     @Override
-    protected void doProcess(AppendRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(AppendRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
         final String mailboxName = request.getMailboxName();
         final InputStream messageIn = request.getMessage();
         final Date datetime = request.getDatetime();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AuthenticateProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AuthenticateProcessor.java
index b56fc44..5a666c0 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AuthenticateProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AuthenticateProcessor.java
@@ -57,7 +57,7 @@ public class AuthenticateProcessor extends AbstractAuthProcessor<AuthenticateReq
     }
 
     @Override
-    protected void doProcess(AuthenticateRequest request, ImapSession session, final Tag tag, final ImapCommand command, final Responder responder) {
+    protected void processMessage(AuthenticateRequest request, ImapSession session, final Tag tag, final ImapCommand command, final Responder responder) {
         final String authType = request.getAuthType();
         if (authType.equalsIgnoreCase(PLAIN)) {
             // See if AUTH=PLAIN is allowed. See IMAP-304
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java
index 3642f35..ffd2656 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java
@@ -80,7 +80,7 @@ public class CapabilityProcessor extends AbstractMailboxProcessor<CapabilityRequ
     }
 
     @Override
-    protected void doProcess(CapabilityRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(CapabilityRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
         final CapabilityResponse result = new CapabilityResponse(getSupportedCapabilities(session));        
         responder.respond(result);
         unsolicitedResponses(session, responder, false);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/CheckProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/CheckProcessor.java
index da80013..10594fd 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/CheckProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/CheckProcessor.java
@@ -39,7 +39,7 @@ public class CheckProcessor extends AbstractMailboxProcessor<CheckRequest> {
     }
 
     @Override
-    protected void doProcess(CheckRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(CheckRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
         unsolicitedResponses(session, responder, false);
         okComplete(message, responder);
     }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/CloseProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/CloseProcessor.java
index 110daf5..3c92857 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/CloseProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/CloseProcessor.java
@@ -49,7 +49,7 @@ public class CloseProcessor extends AbstractMailboxProcessor<CloseRequest> {
     }
 
     @Override
-    protected void doProcess(CloseRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(CloseRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
         try {
             MessageManager mailbox = getSelectedMailbox(session);
             final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/CreateProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/CreateProcessor.java
index c243440..964b04c 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/CreateProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/CreateProcessor.java
@@ -49,7 +49,7 @@ public class CreateProcessor extends AbstractMailboxProcessor<CreateRequest> {
     }
 
     @Override
-    protected void doProcess(CreateRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(CreateRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
         final MailboxPath mailboxPath = PathConverter.forSession(session).buildFullPath(request.getMailboxName());
         try {
             final MailboxManager mailboxManager = getMailboxManager();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java
index 8a631c2..074f67b 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java
@@ -61,7 +61,7 @@ public class DeleteACLProcessor extends AbstractMailboxProcessor<DeleteACLReques
     }
 
     @Override
-    protected void doProcess(DeleteACLRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(DeleteACLRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
 
         final MailboxManager mailboxManager = getMailboxManager();
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java
index d15eb6a..d05f4f9 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java
@@ -51,7 +51,7 @@ public class DeleteProcessor extends AbstractMailboxProcessor<DeleteRequest> {
     }
 
     @Override
-    protected void doProcess(DeleteRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(DeleteRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
         final MailboxPath mailboxPath = PathConverter.forSession(session).buildFullPath(request.getMailboxName());
         try {
             final SelectedMailbox selected = session.getSelected();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/EnableProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/EnableProcessor.java
index f653a05..2123142 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/EnableProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/EnableProcessor.java
@@ -69,7 +69,7 @@ public class EnableProcessor extends AbstractMailboxProcessor<EnableRequest> imp
 
 
     @Override
-    protected void doProcess(EnableRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(EnableRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
         try {
 
             List<String> caps = request.getCapabilities();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java
index 7d50868..07309bf 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java
@@ -62,7 +62,7 @@ public class ExpungeProcessor extends AbstractMailboxProcessor<ExpungeRequest> i
     }
 
     @Override
-    protected void doProcess(ExpungeRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(ExpungeRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
         try {
             final MessageManager mailbox = getSelectedMailbox(session);
             final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java
index ce61b5c..8f7a81b 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java
@@ -63,7 +63,7 @@ public class GetACLProcessor extends AbstractMailboxProcessor<GetACLRequest> imp
     }
 
     @Override
-    protected void doProcess(GetACLRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(GetACLRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
 
         final MailboxManager mailboxManager = getMailboxManager();
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetAnnotationProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetAnnotationProcessor.java
index 0cce69e..2d89a7a 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetAnnotationProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetAnnotationProcessor.java
@@ -70,8 +70,8 @@ public class GetAnnotationProcessor extends AbstractMailboxProcessor<GetAnnotati
     }
 
     @Override
-    protected void doProcess(GetAnnotationRequest message, ImapSession session, Tag tag, ImapCommand command,
-                             Responder responder) {
+    protected void processMessage(GetAnnotationRequest message, ImapSession session, Tag tag, ImapCommand command,
+                                  Responder responder) {
         try {
             proceed(message, session, responder);
         } catch (MailboxNotFoundException e) {
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java
index 174cdbe..f6850f4 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java
@@ -71,7 +71,7 @@ public class GetQuotaProcessor extends AbstractMailboxProcessor<GetQuotaRequest>
     }
 
     @Override
-    protected void doProcess(GetQuotaRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(GetQuotaRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
         try {
             QuotaRoot quotaRoot = quotaRootResolver.fromString(message.getQuotaRoot());
             if (hasRight(quotaRoot, session)) {
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java
index f38832d..6003eff 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java
@@ -72,7 +72,7 @@ public class GetQuotaRootProcessor extends AbstractMailboxProcessor<GetQuotaRoot
     }
 
     @Override
-    protected void doProcess(GetQuotaRootRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(GetQuotaRootRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
         final MailboxManager mailboxManager = getMailboxManager();
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/IdleProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/IdleProcessor.java
index 1c0843f..fa19b61 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/IdleProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/IdleProcessor.java
@@ -86,7 +86,7 @@ public class IdleProcessor extends AbstractMailboxProcessor<IdleRequest> impleme
     }
 
     @Override
-    protected void doProcess(IdleRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(IdleRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
         SelectedMailbox sm = session.getSelected();
         Registration registration;
         if (sm != null) {
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java
index 7f05af7..c27b98f 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java
@@ -70,7 +70,7 @@ public class ListProcessor extends AbstractMailboxProcessor<ListRequest> {
      * reference is non-rooted or is an empty string.
      */
     @Override
-    protected void doProcess(ListRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(ListRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
         String baseReferenceName = request.getBaseReferenceName();
         String mailboxPatternString = request.getMailboxPattern();
         MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java
index 8a6a5cf..8cde8ca 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java
@@ -62,7 +62,7 @@ public class ListRightsProcessor extends AbstractMailboxProcessor<ListRightsRequ
     }
 
     @Override
-    protected void doProcess(ListRightsRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(ListRightsRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
 
         final MailboxManager mailboxManager = getMailboxManager();
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/LoginProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/LoginProcessor.java
index 959fc15..adf9aef 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/LoginProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/LoginProcessor.java
@@ -49,7 +49,7 @@ public class LoginProcessor extends AbstractAuthProcessor<LoginRequest> implemen
     }
 
     @Override
-    protected void doProcess(LoginRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(LoginRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
             // check if the login is allowed with LOGIN command. See IMAP-304
             if (session.isPlainAuthDisallowed() && session.isTLSActive() == false) {
                 no(request, responder, HumanReadableText.DISABLED_LOGIN);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java
index b0bd7ce..2c15df7 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java
@@ -46,7 +46,7 @@ public class LogoutProcessor extends AbstractMailboxProcessor<LogoutRequest> {
     }
 
     @Override
-    protected void doProcess(LogoutRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(LogoutRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
         try {
             getMailboxManager().logout(mailboxSession, false);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java
index 01ecf51..64ba139 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java
@@ -60,7 +60,7 @@ public class MyRightsProcessor extends AbstractMailboxProcessor<MyRightsRequest>
     }
 
     @Override
-    protected void doProcess(MyRightsRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(MyRightsRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
 
         final MailboxManager mailboxManager = getMailboxManager();
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/NamespaceProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/NamespaceProcessor.java
index 6c6457a..e34990e 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/NamespaceProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/NamespaceProcessor.java
@@ -53,7 +53,7 @@ public class NamespaceProcessor extends AbstractMailboxProcessor<NamespaceReques
     }
 
     @Override
-    protected void doProcess(NamespaceRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(NamespaceRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
         final List<NamespaceResponse.Namespace> personalNamespaces = buildPersonalNamespaces(mailboxSession, session);
         final List<NamespaceResponse.Namespace> otherUsersNamespaces = buildOtherUsersSpaces(mailboxSession, session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/NoopProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/NoopProcessor.java
index b5e4ad4..c1b3375 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/NoopProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/NoopProcessor.java
@@ -39,7 +39,7 @@ public class NoopProcessor extends AbstractMailboxProcessor<NoopRequest> {
     }
 
     @Override
-    protected void doProcess(NoopRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(NoopRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
         // So, unsolicated responses are returned to check for new mail
         unsolicitedResponses(session, responder, false);
         okComplete(message, responder);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/RenameProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/RenameProcessor.java
index 7b41df6..b099c07 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/RenameProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/RenameProcessor.java
@@ -52,7 +52,7 @@ public class RenameProcessor extends AbstractMailboxProcessor<RenameRequest> {
     }
 
     @Override
-    protected void doProcess(RenameRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(RenameRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
         PathConverter pathConverter = PathConverter.forSession(session);
         MailboxPath existingPath = pathConverter.buildFullPath(request.getExistingName());
         MailboxPath newPath = pathConverter.buildFullPath(request.getNewName());
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/SearchProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/SearchProcessor.java
index 134218e..f047482 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/SearchProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/SearchProcessor.java
@@ -83,7 +83,7 @@ public class SearchProcessor extends AbstractMailboxProcessor<SearchRequest> imp
     }
 
     @Override
-    protected void doProcess(SearchRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(SearchRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
         final SearchOperation operation = request.getSearchOperation();
         final SearchKey searchKey = operation.getSearchKey();
         final boolean useUids = request.isUseUids();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java
index b135f7f..3dd4a14 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java
@@ -62,7 +62,7 @@ public class SetACLProcessor extends AbstractMailboxProcessor<SetACLRequest> imp
     }
 
     @Override
-    protected void doProcess(SetACLRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(SetACLRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
 
         final MailboxManager mailboxManager = getMailboxManager();
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetAnnotationProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetAnnotationProcessor.java
index 6c64145..848e906 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetAnnotationProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetAnnotationProcessor.java
@@ -60,8 +60,8 @@ public class SetAnnotationProcessor extends AbstractMailboxProcessor<SetAnnotati
     }
 
     @Override
-    protected void doProcess(SetAnnotationRequest message, ImapSession session, Tag tag, ImapCommand command,
-                             Responder responder) {
+    protected void processMessage(SetAnnotationRequest message, ImapSession session, Tag tag, ImapCommand command,
+                                  Responder responder) {
         final MailboxManager mailboxManager = getMailboxManager();
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
         final String mailboxName = message.getMailboxName();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetQuotaProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetQuotaProcessor.java
index f8beffb..0a4b1f2 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetQuotaProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetQuotaProcessor.java
@@ -52,7 +52,7 @@ public class SetQuotaProcessor extends AbstractMailboxProcessor<SetQuotaRequest>
     }
 
     @Override
-    protected void doProcess(SetQuotaRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(SetQuotaRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
         Object[] params = new Object[]{
             "Full admin rights",
             command.getName(),
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/StatusProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/StatusProcessor.java
index 6191d2c..d16e911 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/StatusProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/StatusProcessor.java
@@ -52,7 +52,7 @@ public class StatusProcessor extends AbstractMailboxProcessor<StatusRequest> {
     }
 
     @Override
-    protected void doProcess(StatusRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(StatusRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
         MailboxPath mailboxPath = PathConverter.forSession(session).buildFullPath(request.getMailboxName());
         StatusDataItems statusDataItems = request.getStatusDataItems();
         MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/StoreProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/StoreProcessor.java
index 86c9af3..ef95fa1 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/StoreProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/StoreProcessor.java
@@ -76,7 +76,7 @@ public class StoreProcessor extends AbstractMailboxProcessor<StoreRequest> {
     }
 
     @Override
-    protected void doProcess(StoreRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(StoreRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
         final IdRange[] idSet = request.getIdSet();
         final boolean useUids = request.isUseUids();
         final long unchangedSince = request.getUnchangedSince();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/UnselectProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/UnselectProcessor.java
index 0edf0e7..7f34734 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/UnselectProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/UnselectProcessor.java
@@ -49,7 +49,7 @@ public class UnselectProcessor extends AbstractMailboxProcessor<UnselectRequest>
     }
 
     @Override
-    protected void doProcess(UnselectRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(UnselectRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
         if (session.getSelected() != null) {
             session.deselect();
             okComplete(message, responder);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java
index 7aeb44d..76e34f2 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java
@@ -65,7 +65,7 @@ public class FetchProcessor extends AbstractMailboxProcessor<FetchRequest> {
     }
 
     @Override
-    protected void doProcess(FetchRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void processMessage(FetchRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
         final boolean useUids = request.isUseUids();
         final IdRange[] idSet = request.getIdSet();
         final FetchData fetch = request.getFetch();
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/processor/SearchProcessorTest.java b/protocols/imap/src/test/java/org/apache/james/imap/processor/SearchProcessorTest.java
index e0b8cc0..15d2f90 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/processor/SearchProcessorTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/processor/SearchProcessorTest.java
@@ -473,7 +473,7 @@ public class SearchProcessorTest {
         when(selectedMailbox.hasNewApplicableFlags()).thenReturn(false);
 
         SearchRequest message = new SearchRequest(command, new SearchOperation(key, new ArrayList<>()), false, TAG);
-        processor.doProcess(message, session, TAG, command, responder);
+        processor.processMessage(message, session, TAG, command, responder);
     }
 
     private void expectOk() {


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


[james-project] 11/30: [Refactoring] processMessage rename

Posted by bt...@apache.org.
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 8f14db3604f56d623aca28cdbc4ab4d8b3e96ebd
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Tue Nov 12 17:27:26 2019 +0700

    [Refactoring] processMessage rename
---
 .../org/apache/james/imap/processor/AbstractMailboxProcessor.java     | 4 ++--
 .../apache/james/imap/processor/AbstractMessageRangeProcessor.java    | 2 +-
 .../org/apache/james/imap/processor/AbstractSelectionProcessor.java   | 2 +-
 .../apache/james/imap/processor/AbstractSubscriptionProcessor.java    | 2 +-
 .../main/java/org/apache/james/imap/processor/AppendProcessor.java    | 2 +-
 .../java/org/apache/james/imap/processor/AuthenticateProcessor.java   | 2 +-
 .../java/org/apache/james/imap/processor/CapabilityProcessor.java     | 2 +-
 .../src/main/java/org/apache/james/imap/processor/CheckProcessor.java | 2 +-
 .../src/main/java/org/apache/james/imap/processor/CloseProcessor.java | 2 +-
 .../main/java/org/apache/james/imap/processor/CreateProcessor.java    | 2 +-
 .../main/java/org/apache/james/imap/processor/DeleteACLProcessor.java | 2 +-
 .../main/java/org/apache/james/imap/processor/DeleteProcessor.java    | 2 +-
 .../main/java/org/apache/james/imap/processor/EnableProcessor.java    | 2 +-
 .../main/java/org/apache/james/imap/processor/ExpungeProcessor.java   | 2 +-
 .../main/java/org/apache/james/imap/processor/GetACLProcessor.java    | 2 +-
 .../java/org/apache/james/imap/processor/GetAnnotationProcessor.java  | 2 +-
 .../main/java/org/apache/james/imap/processor/GetQuotaProcessor.java  | 2 +-
 .../java/org/apache/james/imap/processor/GetQuotaRootProcessor.java   | 2 +-
 .../src/main/java/org/apache/james/imap/processor/IdleProcessor.java  | 2 +-
 .../src/main/java/org/apache/james/imap/processor/ListProcessor.java  | 2 +-
 .../java/org/apache/james/imap/processor/ListRightsProcessor.java     | 2 +-
 .../src/main/java/org/apache/james/imap/processor/LoginProcessor.java | 2 +-
 .../main/java/org/apache/james/imap/processor/LogoutProcessor.java    | 2 +-
 .../main/java/org/apache/james/imap/processor/MyRightsProcessor.java  | 2 +-
 .../main/java/org/apache/james/imap/processor/NamespaceProcessor.java | 2 +-
 .../src/main/java/org/apache/james/imap/processor/NoopProcessor.java  | 2 +-
 .../main/java/org/apache/james/imap/processor/RenameProcessor.java    | 2 +-
 .../main/java/org/apache/james/imap/processor/SearchProcessor.java    | 2 +-
 .../main/java/org/apache/james/imap/processor/SetACLProcessor.java    | 2 +-
 .../java/org/apache/james/imap/processor/SetAnnotationProcessor.java  | 2 +-
 .../main/java/org/apache/james/imap/processor/SetQuotaProcessor.java  | 2 +-
 .../main/java/org/apache/james/imap/processor/StatusProcessor.java    | 2 +-
 .../src/main/java/org/apache/james/imap/processor/StoreProcessor.java | 2 +-
 .../main/java/org/apache/james/imap/processor/UnselectProcessor.java  | 2 +-
 .../java/org/apache/james/imap/processor/fetch/FetchProcessor.java    | 2 +-
 .../java/org/apache/james/imap/processor/SearchProcessorTest.java     | 2 +-
 36 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
index e212b26..99d9382 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
@@ -95,7 +95,7 @@ public abstract class AbstractMailboxProcessor<M extends ImapRequest> extends Ab
             } else {
                 getMailboxManager().startProcessingRequest(ImapSessionUtils.getMailboxSession(session));
 
-                processMessage(acceptableMessage, session, responder);
+                processRequest(acceptableMessage, session, responder);
 
                 getMailboxManager().endProcessingRequest(ImapSessionUtils.getMailboxSession(session));
             }
@@ -355,7 +355,7 @@ public abstract class AbstractMailboxProcessor<M extends ImapRequest> extends Ab
         responder.respond(response);
     }
 
-    protected abstract void processMessage(M message, ImapSession session, Responder responder);
+    protected abstract void processRequest(M message, ImapSession session, Responder responder);
 
     /**
      * Joins the elements of a mailboxPath together and returns them as a string
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMessageRangeProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMessageRangeProcessor.java
index 2a61822..cc56604 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMessageRangeProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMessageRangeProcessor.java
@@ -60,7 +60,7 @@ public abstract class AbstractMessageRangeProcessor<M extends AbstractMessageRan
     protected abstract String getOperationName();
 
     @Override
-    protected void processMessage(M request, ImapSession session, Responder responder) {
+    protected void processRequest(M request, ImapSession session, Responder responder) {
         final MailboxPath targetMailbox = PathConverter.forSession(session).buildFullPath(request.getMailboxName());
         final IdRange[] idSet = request.getIdSet();
         final boolean useUids = request.isUseUids();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
index 8d20313..08923e5 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
@@ -77,7 +77,7 @@ abstract class AbstractSelectionProcessor<M extends AbstractMailboxSelectionRequ
     }
 
     @Override
-    protected void processMessage(M request, ImapSession session, Responder responder) {
+    protected void processRequest(M request, ImapSession session, Responder responder) {
         final String mailboxName = request.getMailboxName();
         try {
             final MailboxPath fullMailboxPath = PathConverter.forSession(session).buildFullPath(mailboxName);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSubscriptionProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSubscriptionProcessor.java
index 929a5c3..6bcac42 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSubscriptionProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSubscriptionProcessor.java
@@ -52,7 +52,7 @@ public abstract class AbstractSubscriptionProcessor<M extends ImapRequest> exten
     }
 
     @Override
-    protected final void processMessage(M message, ImapSession session, Responder responder) {
+    protected final void processRequest(M message, ImapSession session, Responder responder) {
 
         // take care of calling the start/end processing
         MailboxSession mSession = ImapSessionUtils.getMailboxSession(session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AppendProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AppendProcessor.java
index 0a8282e..6cd15dc 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AppendProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AppendProcessor.java
@@ -62,7 +62,7 @@ public class AppendProcessor extends AbstractMailboxProcessor<AppendRequest> {
     }
 
     @Override
-    protected void processMessage(AppendRequest request, ImapSession session, Responder responder) {
+    protected void processRequest(AppendRequest request, ImapSession session, Responder responder) {
         final String mailboxName = request.getMailboxName();
         final InputStream messageIn = request.getMessage();
         final Date datetime = request.getDatetime();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AuthenticateProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AuthenticateProcessor.java
index 33b82e3..43f65d5 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AuthenticateProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AuthenticateProcessor.java
@@ -55,7 +55,7 @@ public class AuthenticateProcessor extends AbstractAuthProcessor<AuthenticateReq
     }
 
     @Override
-    protected void processMessage(AuthenticateRequest request, ImapSession session, final Responder responder) {
+    protected void processRequest(AuthenticateRequest request, ImapSession session, final Responder responder) {
         final String authType = request.getAuthType();
         if (authType.equalsIgnoreCase(PLAIN)) {
             // See if AUTH=PLAIN is allowed. See IMAP-304
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java
index aed50c8..925f40f 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java
@@ -78,7 +78,7 @@ public class CapabilityProcessor extends AbstractMailboxProcessor<CapabilityRequ
     }
 
     @Override
-    protected void processMessage(CapabilityRequest request, ImapSession session, Responder responder) {
+    protected void processRequest(CapabilityRequest request, ImapSession session, Responder responder) {
         final CapabilityResponse result = new CapabilityResponse(getSupportedCapabilities(session));        
         responder.respond(result);
         unsolicitedResponses(session, responder, false);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/CheckProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/CheckProcessor.java
index ccb4de8..feeca69 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/CheckProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/CheckProcessor.java
@@ -37,7 +37,7 @@ public class CheckProcessor extends AbstractMailboxProcessor<CheckRequest> {
     }
 
     @Override
-    protected void processMessage(CheckRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(CheckRequest message, ImapSession session, Responder responder) {
         unsolicitedResponses(session, responder, false);
         okComplete(message, responder);
     }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/CloseProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/CloseProcessor.java
index 2d06c12..c870ce8 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/CloseProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/CloseProcessor.java
@@ -47,7 +47,7 @@ public class CloseProcessor extends AbstractMailboxProcessor<CloseRequest> {
     }
 
     @Override
-    protected void processMessage(CloseRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(CloseRequest message, ImapSession session, Responder responder) {
         try {
             MessageManager mailbox = getSelectedMailbox(session);
             final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/CreateProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/CreateProcessor.java
index 09cd9c1..c2ddf7f 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/CreateProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/CreateProcessor.java
@@ -47,7 +47,7 @@ public class CreateProcessor extends AbstractMailboxProcessor<CreateRequest> {
     }
 
     @Override
-    protected void processMessage(CreateRequest request, ImapSession session, Responder responder) {
+    protected void processRequest(CreateRequest request, ImapSession session, Responder responder) {
         final MailboxPath mailboxPath = PathConverter.forSession(session).buildFullPath(request.getMailboxName());
         try {
             final MailboxManager mailboxManager = getMailboxManager();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java
index 26a3a4a..93b6fc5 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java
@@ -59,7 +59,7 @@ public class DeleteACLProcessor extends AbstractMailboxProcessor<DeleteACLReques
     }
 
     @Override
-    protected void processMessage(DeleteACLRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(DeleteACLRequest message, ImapSession session, Responder responder) {
 
         final MailboxManager mailboxManager = getMailboxManager();
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java
index ebcb4a9..55f18ff 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java
@@ -49,7 +49,7 @@ public class DeleteProcessor extends AbstractMailboxProcessor<DeleteRequest> {
     }
 
     @Override
-    protected void processMessage(DeleteRequest request, ImapSession session, Responder responder) {
+    protected void processRequest(DeleteRequest request, ImapSession session, Responder responder) {
         final MailboxPath mailboxPath = PathConverter.forSession(session).buildFullPath(request.getMailboxName());
         try {
             final SelectedMailbox selected = session.getSelected();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/EnableProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/EnableProcessor.java
index 01920f5..92841d0 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/EnableProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/EnableProcessor.java
@@ -67,7 +67,7 @@ public class EnableProcessor extends AbstractMailboxProcessor<EnableRequest> imp
 
 
     @Override
-    protected void processMessage(EnableRequest request, ImapSession session, Responder responder) {
+    protected void processRequest(EnableRequest request, ImapSession session, Responder responder) {
         try {
 
             List<String> caps = request.getCapabilities();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java
index e2dedaf..dac509c 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java
@@ -60,7 +60,7 @@ public class ExpungeProcessor extends AbstractMailboxProcessor<ExpungeRequest> i
     }
 
     @Override
-    protected void processMessage(ExpungeRequest request, ImapSession session, Responder responder) {
+    protected void processRequest(ExpungeRequest request, ImapSession session, Responder responder) {
         try {
             final MessageManager mailbox = getSelectedMailbox(session);
             final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java
index a06ef57..980e567 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java
@@ -61,7 +61,7 @@ public class GetACLProcessor extends AbstractMailboxProcessor<GetACLRequest> imp
     }
 
     @Override
-    protected void processMessage(GetACLRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(GetACLRequest message, ImapSession session, Responder responder) {
 
         final MailboxManager mailboxManager = getMailboxManager();
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetAnnotationProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetAnnotationProcessor.java
index 672655e..09fb510 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetAnnotationProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetAnnotationProcessor.java
@@ -68,7 +68,7 @@ public class GetAnnotationProcessor extends AbstractMailboxProcessor<GetAnnotati
     }
 
     @Override
-    protected void processMessage(GetAnnotationRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(GetAnnotationRequest message, ImapSession session, Responder responder) {
         try {
             proceed(message, session, responder);
         } catch (MailboxNotFoundException e) {
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java
index f16cd43..fb74eeb 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java
@@ -69,7 +69,7 @@ public class GetQuotaProcessor extends AbstractMailboxProcessor<GetQuotaRequest>
     }
 
     @Override
-    protected void processMessage(GetQuotaRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(GetQuotaRequest message, ImapSession session, Responder responder) {
         try {
             QuotaRoot quotaRoot = quotaRootResolver.fromString(message.getQuotaRoot());
             if (hasRight(quotaRoot, session)) {
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java
index 7f1fc41..293174f 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java
@@ -70,7 +70,7 @@ public class GetQuotaRootProcessor extends AbstractMailboxProcessor<GetQuotaRoot
     }
 
     @Override
-    protected void processMessage(GetQuotaRootRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(GetQuotaRootRequest message, ImapSession session, Responder responder) {
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
         final MailboxManager mailboxManager = getMailboxManager();
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/IdleProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/IdleProcessor.java
index 42903c0..ad19a73 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/IdleProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/IdleProcessor.java
@@ -84,7 +84,7 @@ public class IdleProcessor extends AbstractMailboxProcessor<IdleRequest> impleme
     }
 
     @Override
-    protected void processMessage(IdleRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(IdleRequest message, ImapSession session, Responder responder) {
         SelectedMailbox sm = session.getSelected();
         Registration registration;
         if (sm != null) {
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java
index a535273..e62f61b 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java
@@ -68,7 +68,7 @@ public class ListProcessor extends AbstractMailboxProcessor<ListRequest> {
      * reference is non-rooted or is an empty string.
      */
     @Override
-    protected void processMessage(ListRequest request, ImapSession session, Responder responder) {
+    protected void processRequest(ListRequest request, ImapSession session, Responder responder) {
         String baseReferenceName = request.getBaseReferenceName();
         String mailboxPatternString = request.getMailboxPattern();
         MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java
index 9cfc43f..70dfeb8 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java
@@ -60,7 +60,7 @@ public class ListRightsProcessor extends AbstractMailboxProcessor<ListRightsRequ
     }
 
     @Override
-    protected void processMessage(ListRightsRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(ListRightsRequest message, ImapSession session, Responder responder) {
 
         final MailboxManager mailboxManager = getMailboxManager();
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/LoginProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/LoginProcessor.java
index 87f4b00..f6593b8 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/LoginProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/LoginProcessor.java
@@ -47,7 +47,7 @@ public class LoginProcessor extends AbstractAuthProcessor<LoginRequest> implemen
     }
 
     @Override
-    protected void processMessage(LoginRequest request, ImapSession session, Responder responder) {
+    protected void processRequest(LoginRequest request, ImapSession session, Responder responder) {
             // check if the login is allowed with LOGIN command. See IMAP-304
             if (session.isPlainAuthDisallowed() && session.isTLSActive() == false) {
                 no(request, responder, HumanReadableText.DISABLED_LOGIN);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java
index 17204f9..4710f5e 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java
@@ -44,7 +44,7 @@ public class LogoutProcessor extends AbstractMailboxProcessor<LogoutRequest> {
     }
 
     @Override
-    protected void processMessage(LogoutRequest request, ImapSession session, Responder responder) {
+    protected void processRequest(LogoutRequest request, ImapSession session, Responder responder) {
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
         try {
             getMailboxManager().logout(mailboxSession, false);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java
index e904805..f7c488a 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java
@@ -58,7 +58,7 @@ public class MyRightsProcessor extends AbstractMailboxProcessor<MyRightsRequest>
     }
 
     @Override
-    protected void processMessage(MyRightsRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(MyRightsRequest message, ImapSession session, Responder responder) {
 
         final MailboxManager mailboxManager = getMailboxManager();
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/NamespaceProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/NamespaceProcessor.java
index c6ba459..eed4a6b 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/NamespaceProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/NamespaceProcessor.java
@@ -51,7 +51,7 @@ public class NamespaceProcessor extends AbstractMailboxProcessor<NamespaceReques
     }
 
     @Override
-    protected void processMessage(NamespaceRequest request, ImapSession session, Responder responder) {
+    protected void processRequest(NamespaceRequest request, ImapSession session, Responder responder) {
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
         final List<NamespaceResponse.Namespace> personalNamespaces = buildPersonalNamespaces(mailboxSession, session);
         final List<NamespaceResponse.Namespace> otherUsersNamespaces = buildOtherUsersSpaces(mailboxSession, session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/NoopProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/NoopProcessor.java
index 9dd7e24..35a59e9 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/NoopProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/NoopProcessor.java
@@ -37,7 +37,7 @@ public class NoopProcessor extends AbstractMailboxProcessor<NoopRequest> {
     }
 
     @Override
-    protected void processMessage(NoopRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(NoopRequest message, ImapSession session, Responder responder) {
         // So, unsolicated responses are returned to check for new mail
         unsolicitedResponses(session, responder, false);
         okComplete(message, responder);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/RenameProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/RenameProcessor.java
index b418fae..0721035 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/RenameProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/RenameProcessor.java
@@ -50,7 +50,7 @@ public class RenameProcessor extends AbstractMailboxProcessor<RenameRequest> {
     }
 
     @Override
-    protected void processMessage(RenameRequest request, ImapSession session, Responder responder) {
+    protected void processRequest(RenameRequest request, ImapSession session, Responder responder) {
         PathConverter pathConverter = PathConverter.forSession(session);
         MailboxPath existingPath = pathConverter.buildFullPath(request.getExistingName());
         MailboxPath newPath = pathConverter.buildFullPath(request.getNewName());
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/SearchProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/SearchProcessor.java
index c2752a9..2953148 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/SearchProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/SearchProcessor.java
@@ -81,7 +81,7 @@ public class SearchProcessor extends AbstractMailboxProcessor<SearchRequest> imp
     }
 
     @Override
-    protected void processMessage(SearchRequest request, ImapSession session, Responder responder) {
+    protected void processRequest(SearchRequest request, ImapSession session, Responder responder) {
         final SearchOperation operation = request.getSearchOperation();
         final SearchKey searchKey = operation.getSearchKey();
         final boolean useUids = request.isUseUids();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java
index 97bb3aa..e34f96b 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java
@@ -60,7 +60,7 @@ public class SetACLProcessor extends AbstractMailboxProcessor<SetACLRequest> imp
     }
 
     @Override
-    protected void processMessage(SetACLRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(SetACLRequest message, ImapSession session, Responder responder) {
 
         final MailboxManager mailboxManager = getMailboxManager();
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetAnnotationProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetAnnotationProcessor.java
index ca9e773..e812b71 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetAnnotationProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetAnnotationProcessor.java
@@ -58,7 +58,7 @@ public class SetAnnotationProcessor extends AbstractMailboxProcessor<SetAnnotati
     }
 
     @Override
-    protected void processMessage(SetAnnotationRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(SetAnnotationRequest message, ImapSession session, Responder responder) {
         final MailboxManager mailboxManager = getMailboxManager();
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
         final String mailboxName = message.getMailboxName();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetQuotaProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetQuotaProcessor.java
index 69a56e6..f99acb7 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetQuotaProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetQuotaProcessor.java
@@ -50,7 +50,7 @@ public class SetQuotaProcessor extends AbstractMailboxProcessor<SetQuotaRequest>
     }
 
     @Override
-    protected void processMessage(SetQuotaRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(SetQuotaRequest message, ImapSession session, Responder responder) {
         Object[] params = new Object[]{
             "Full admin rights",
             message.getCommand().getName(),
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/StatusProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/StatusProcessor.java
index 7620d54..4752e4d 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/StatusProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/StatusProcessor.java
@@ -50,7 +50,7 @@ public class StatusProcessor extends AbstractMailboxProcessor<StatusRequest> {
     }
 
     @Override
-    protected void processMessage(StatusRequest request, ImapSession session, Responder responder) {
+    protected void processRequest(StatusRequest request, ImapSession session, Responder responder) {
         MailboxPath mailboxPath = PathConverter.forSession(session).buildFullPath(request.getMailboxName());
         StatusDataItems statusDataItems = request.getStatusDataItems();
         MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/StoreProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/StoreProcessor.java
index 8f8b876..05692ea 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/StoreProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/StoreProcessor.java
@@ -75,7 +75,7 @@ public class StoreProcessor extends AbstractMailboxProcessor<StoreRequest> {
     }
 
     @Override
-    protected void processMessage(StoreRequest request, ImapSession session, Responder responder) {
+    protected void processRequest(StoreRequest request, ImapSession session, Responder responder) {
         final IdRange[] idSet = request.getIdSet();
         final boolean useUids = request.isUseUids();
         final long unchangedSince = request.getUnchangedSince();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/UnselectProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/UnselectProcessor.java
index cac3095..ac80507 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/UnselectProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/UnselectProcessor.java
@@ -47,7 +47,7 @@ public class UnselectProcessor extends AbstractMailboxProcessor<UnselectRequest>
     }
 
     @Override
-    protected void processMessage(UnselectRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(UnselectRequest message, ImapSession session, Responder responder) {
         if (session.getSelected() != null) {
             session.deselect();
             okComplete(message, responder);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java
index 2cf8481..f257580 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java
@@ -63,7 +63,7 @@ public class FetchProcessor extends AbstractMailboxProcessor<FetchRequest> {
     }
 
     @Override
-    protected void processMessage(FetchRequest request, ImapSession session, Responder responder) {
+    protected void processRequest(FetchRequest request, ImapSession session, Responder responder) {
         final boolean useUids = request.isUseUids();
         final IdRange[] idSet = request.getIdSet();
         final FetchData fetch = request.getFetch();
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/processor/SearchProcessorTest.java b/protocols/imap/src/test/java/org/apache/james/imap/processor/SearchProcessorTest.java
index 00f6b9c..f4689bf 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/processor/SearchProcessorTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/processor/SearchProcessorTest.java
@@ -473,7 +473,7 @@ public class SearchProcessorTest {
         when(selectedMailbox.hasNewApplicableFlags()).thenReturn(false);
 
         SearchRequest message = new SearchRequest(command, new SearchOperation(key, new ArrayList<>()), false, TAG);
-        processor.processMessage(message, session, responder);
+        processor.processRequest(message, session, responder);
     }
 
     private void expectOk() {


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


[james-project] 25/30: [Refactoring] update variable is always true

Posted by bt...@apache.org.
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 e2d41e3e2323d71c189b2cc67082a206caf673fa
Author: Matthieu Baechler <ma...@apache.org>
AuthorDate: Wed Nov 13 16:23:39 2019 +0100

    [Refactoring] update variable is always true
---
 .../org/apache/james/mailrepository/file/FileMailRepository.java    | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java b/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java
index 2472531..c818b65 100644
--- a/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java
+++ b/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java
@@ -236,7 +236,6 @@ public class FileMailRepository implements MailRepository, Configurable, Initial
             keys.add(key);
         }
         boolean saveStream = true;
-        boolean update = true;
 
         MimeMessage message = mc.getMessage();
         // if the message is a Copy on Write proxy we check the wrapped message
@@ -263,15 +262,12 @@ public class FileMailRepository implements MailRepository, Configurable, Initial
                     // retrying to retrieve from a file we'll be overwriting.
                     saveStream = false;
                 }
-
-                // its an update
-                update = true;
             }
         }
         if (saveStream) {
             OutputStream out = null;
             try {
-                if (update && message instanceof MimeMessageWrapper) {
+                if (message instanceof MimeMessageWrapper) {
                     // we need to force the loading of the message from the
                     // stream as we want to override the old message
                     ((MimeMessageWrapper) message).loadMessage();


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


[james-project] 06/30: JAMES-2704 close smtp connection in tests

Posted by bt...@apache.org.
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 49ad1cb6b8298ae5939f88582286f361fc8c0f29
Author: Rémi KOWALSKI <rk...@linagora.com>
AuthorDate: Fri Nov 8 11:59:48 2019 +0100

    JAMES-2704 close smtp connection in tests
---
 .../java/org/apache/james/smtp/SmtpRandomStoringTest.java  | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpRandomStoringTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpRandomStoringTest.java
index 28287c4..3b032e6 100644
--- a/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpRandomStoringTest.java
+++ b/server/mailet/integration-testing/src/test/java/org/apache/james/smtp/SmtpRandomStoringTest.java
@@ -142,13 +142,15 @@ public class SmtpRandomStoringTest {
     }
 
     private void sendMails() throws Exception {
-        SMTPMessageSender authenticatedSmtpConnection = messageSender.connect(LOCALHOST_IP, jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort())
-            .authenticate(FROM, PASSWORD);
+        try (SMTPMessageSender authenticatedSmtpConnection = messageSender.connect(LOCALHOST_IP, jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort())) {
 
-        IntStream.range(0, NUMBER_OF_MAILS)
-            .forEach(Throwing.intConsumer(index ->
-                authenticatedSmtpConnection
-                    .sendMessage(buildMail("Message " + index))).sneakyThrow());
+            authenticatedSmtpConnection.authenticate(FROM, PASSWORD);
+
+            IntStream.range(0, NUMBER_OF_MAILS)
+                .forEach(Throwing.intConsumer(index ->
+                    authenticatedSmtpConnection
+                        .sendMessage(buildMail("Message " + index))).sneakyThrow());
+        }
     }
 
     @After


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


[james-project] 30/30: [Refactoring] Move remaining abstract test classes in mailbox api and their implementations to JUnit 5

Posted by bt...@apache.org.
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 fa6f51b019754cddda90d2a9c85b21bd383b3282
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Thu Nov 14 10:02:05 2019 +0700

    [Refactoring] Move remaining abstract test classes in mailbox api and their implementations to JUnit 5
---
 .../mailbox/AbstractSubscriptionManagerTest.java   | 20 ++++++-------
 .../james/mailbox/MailboxManagerStressTest.java    |  6 ++--
 .../CassandraMailboxManagerStressTest.java         | 33 +++++++++------------
 .../CassandraSubscriptionManagerTest.java          | 34 ++++++++++------------
 .../mailbox/jpa/JPASubscriptionManagerTest.java    | 18 +++++-------
 .../mailbox/jpa/JpaMailboxManagerStressTest.java   | 15 +++++-----
 .../DomainUserMaildirMailboxManagerStressTest.java | 20 ++++++-------
 .../FullUserMaildirMailboxManagerStressTest.java   | 20 ++++++-------
 .../maildir/MaildirSubscriptionManagerTest.java    | 19 ++++++------
 .../UserMaildirMailboxManagerStressTest.java       | 20 ++++++-------
 .../inmemory/MemoryMailboxManagerStressTest.java   | 11 ++++---
 11 files changed, 103 insertions(+), 113 deletions(-)

diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/AbstractSubscriptionManagerTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/AbstractSubscriptionManagerTest.java
index d482116..8d76f06 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/AbstractSubscriptionManagerTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/AbstractSubscriptionManagerTest.java
@@ -21,7 +21,7 @@ package org.apache.james.mailbox;
 import static org.assertj.core.api.Assertions.assertThat;
 
 import org.apache.james.mailbox.exception.SubscriptionException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 /**
  * Abstract base class to test {@link SubscriptionManager} implementations
@@ -36,35 +36,35 @@ public abstract class AbstractSubscriptionManagerTest {
     private SubscriptionManager manager;
     private MailboxSession session;
 
-    public abstract SubscriptionManager createSubscriptionManager();
+    protected abstract SubscriptionManager createSubscriptionManager();
 
-    public void setup() {
+    protected void setup() {
         manager = createSubscriptionManager();
         session = MailboxSessionUtil.create(USER1);
         manager.startProcessingRequest(session);
     }
     
-    public void teardown() throws SubscriptionException {
+    protected void teardown() throws SubscriptionException {
         manager.unsubscribe(session, MAILBOX1);
         manager.unsubscribe(session, MAILBOX2);
         manager.endProcessingRequest(session);
     }
     
     @Test
-    public void user1ShouldNotHaveAnySubscriptionByDefault() throws SubscriptionException {
+    void user1ShouldNotHaveAnySubscriptionByDefault() throws SubscriptionException {
         assertThat(manager.subscriptions(session)).isEmpty();
     }
     
     
     @Test
-    public void user1ShouldBeAbleToSubscribeOneMailbox() throws SubscriptionException {
+    void user1ShouldBeAbleToSubscribeOneMailbox() throws SubscriptionException {
         manager.subscribe(session, MAILBOX1);
 
         assertThat(manager.subscriptions(session)).containsExactly(MAILBOX1);
     }
 
     @Test
-    public void subscribeShouldBeIdempotent() throws SubscriptionException {
+    void subscribeShouldBeIdempotent() throws SubscriptionException {
         manager.subscribe(session, MAILBOX1);
         manager.subscribe(session, MAILBOX1);
         
@@ -72,7 +72,7 @@ public abstract class AbstractSubscriptionManagerTest {
     }
     
     @Test
-    public void user1ShouldBeAbleToSubscribeTwoMailbox() throws SubscriptionException {
+    void user1ShouldBeAbleToSubscribeTwoMailbox() throws SubscriptionException {
         manager.subscribe(session, MAILBOX1);
         manager.subscribe(session, MAILBOX2);
         
@@ -80,7 +80,7 @@ public abstract class AbstractSubscriptionManagerTest {
     }
     
     @Test
-    public void user1ShouldBeAbleToUnsubscribeOneMailbox() throws SubscriptionException {
+    void user1ShouldBeAbleToUnsubscribeOneMailbox() throws SubscriptionException {
         manager.subscribe(session, MAILBOX1);
         manager.subscribe(session, MAILBOX2);
 
@@ -90,7 +90,7 @@ public abstract class AbstractSubscriptionManagerTest {
     }
     
     @Test
-    public void unsubscribeShouldBeIdempotent() throws SubscriptionException {
+    void unsubscribeShouldBeIdempotent() throws SubscriptionException {
         manager.subscribe(session, MAILBOX1);
         manager.subscribe(session, MAILBOX2);
         manager.unsubscribe(session, MAILBOX1);
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerStressTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerStressTest.java
index 608fa24..92041e2 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerStressTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerStressTest.java
@@ -40,7 +40,7 @@ import org.apache.james.mailbox.model.MailboxId;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mime4j.dom.Message;
 import org.apache.james.util.concurrent.NamedThreadFactory;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import com.google.common.collect.ImmutableSet;
 
@@ -54,12 +54,12 @@ public abstract class MailboxManagerStressTest<T extends MailboxManager> {
 
     protected abstract EventBus retrieveEventBus(T mailboxManager);
     
-    public void setUp() throws Exception {
+    protected void setUp() throws Exception {
         this.mailboxManager = provideManager();
     }
 
     @Test
-    public void testStressTest() throws InterruptedException, MailboxException {
+    void testStressTest() throws InterruptedException, MailboxException {
         ThreadFactory threadFactory = NamedThreadFactory.withClassName(getClass());
 
         CountDownLatch latch = new CountDownLatch(APPEND_OPERATIONS);
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMailboxManagerStressTest.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMailboxManagerStressTest.java
index 22aa276..677c0b5 100644
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMailboxManagerStressTest.java
+++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMailboxManagerStressTest.java
@@ -19,41 +19,36 @@
 
 package org.apache.james.mailbox.cassandra;
 
-import org.apache.james.backends.cassandra.CassandraCluster;
-import org.apache.james.backends.cassandra.DockerCassandraRule;
+import org.apache.james.backends.cassandra.CassandraClusterExtension;
+import org.apache.james.backends.cassandra.CassandraRestartExtension;
 import org.apache.james.mailbox.MailboxManagerStressTest;
 import org.apache.james.mailbox.cassandra.mail.MailboxAggregateModule;
 import org.apache.james.mailbox.events.EventBus;
 import org.apache.james.mailbox.store.PreDeletionHooks;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
-public class CassandraMailboxManagerStressTest extends MailboxManagerStressTest<CassandraMailboxManager> {
-    
-    @Rule public DockerCassandraRule cassandraServer = new DockerCassandraRule().allowRestart();
+@ExtendWith(CassandraRestartExtension.class)
+class CassandraMailboxManagerStressTest extends MailboxManagerStressTest<CassandraMailboxManager> {
 
-    private CassandraCluster cassandra;
+    @RegisterExtension
+    static CassandraClusterExtension cassandra = new CassandraClusterExtension(MailboxAggregateModule.MODULE_WITH_QUOTA);
     
-    @Before
-    public void setup() throws Exception {
-        cassandra = CassandraCluster.create(MailboxAggregateModule.MODULE_WITH_QUOTA, cassandraServer.getHost());
+    @BeforeEach
+    void setup() throws Exception {
         super.setUp();
     }
     
     @Override
     protected CassandraMailboxManager provideManager() {
-        return CassandraMailboxManagerProvider.provideMailboxManager(cassandra.getConf(), cassandra.getTypesProvider(), PreDeletionHooks.NO_PRE_DELETION_HOOK);
+        return CassandraMailboxManagerProvider.provideMailboxManager(cassandra.getCassandraCluster().getConf(),
+            cassandra.getCassandraCluster().getTypesProvider(),
+            PreDeletionHooks.NO_PRE_DELETION_HOOK);
     }
 
     @Override
     protected EventBus retrieveEventBus(CassandraMailboxManager mailboxManager) {
         return mailboxManager.getEventBus();
     }
-
-    @After
-    public void tearDown() {
-        cassandra.clearTables();
-        cassandra.closeCluster();
-    }
 }
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraSubscriptionManagerTest.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraSubscriptionManagerTest.java
index 94ae036..e1120db 100644
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraSubscriptionManagerTest.java
+++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraSubscriptionManagerTest.java
@@ -19,8 +19,8 @@
 
 package org.apache.james.mailbox.cassandra;
 
-import org.apache.james.backends.cassandra.CassandraCluster;
-import org.apache.james.backends.cassandra.DockerCassandraRule;
+import org.apache.james.backends.cassandra.CassandraClusterExtension;
+import org.apache.james.backends.cassandra.CassandraRestartExtension;
 import org.apache.james.backends.cassandra.init.configuration.CassandraConfiguration;
 import org.apache.james.backends.cassandra.utils.CassandraUtils;
 import org.apache.james.blob.api.BlobStore;
@@ -47,34 +47,32 @@ import org.apache.james.mailbox.cassandra.mail.CassandraUidProvider;
 import org.apache.james.mailbox.cassandra.mail.CassandraUserMailboxRightsDAO;
 import org.apache.james.mailbox.cassandra.modules.CassandraSubscriptionModule;
 import org.apache.james.mailbox.exception.SubscriptionException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.api.extension.RegisterExtension;
 
 /**
  * Test Cassandra subscription against some general purpose written code.
  */
-public class CassandraSubscriptionManagerTest extends AbstractSubscriptionManagerTest {
+@ExtendWith(CassandraRestartExtension.class)
+class CassandraSubscriptionManagerTest extends AbstractSubscriptionManagerTest {
 
-    @Rule public DockerCassandraRule cassandraServer = new DockerCassandraRule().allowRestart();
+    @RegisterExtension
+    static CassandraClusterExtension cassandraCluster = new CassandraClusterExtension(CassandraSubscriptionModule.MODULE);
 
-    private CassandraCluster cassandra;
-
-    @Before
-    public void init() {
-        cassandra = CassandraCluster.create(CassandraSubscriptionModule.MODULE, cassandraServer.getHost());
+    @BeforeEach
+    void init() {
         super.setup();
     }
 
-    @After
-    public void close() throws SubscriptionException {
+    @AfterEach
+    void close() throws SubscriptionException {
         super.teardown();
-        cassandra.clearTables();
-        cassandra.closeCluster();
     }
 
     @Override
-    public SubscriptionManager createSubscriptionManager() {
+    protected SubscriptionManager createSubscriptionManager() {
         CassandraMessageIdToImapUidDAO imapUidDAO = null;
         CassandraMessageDAO messageDAO = null;
         CassandraMessageIdDAO messageIdDAO = null;
@@ -99,7 +97,7 @@ public class CassandraSubscriptionManagerTest extends AbstractSubscriptionManage
             new CassandraMailboxSessionMapperFactory(
                 uidProvider,
                 modSeqProvider,
-                cassandra.getConf(),
+                cassandraCluster.getCassandraCluster().getConf(),
                 messageDAO,
                 messageIdDAO,
                 imapUidDAO,
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 cc6947f..f19d237 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
@@ -23,24 +23,23 @@ import javax.persistence.EntityManagerFactory;
 import org.apache.james.backends.jpa.JpaTestCluster;
 import org.apache.james.mailbox.AbstractSubscriptionManagerTest;
 import org.apache.james.mailbox.SubscriptionManager;
-import org.apache.james.mailbox.exception.SubscriptionException;
 import org.apache.james.mailbox.jpa.mail.JPAModSeqProvider;
 import org.apache.james.mailbox.jpa.mail.JPAUidProvider;
 import org.apache.james.mailbox.store.JVMMailboxPathLocker;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
 
-public class JPASubscriptionManagerTest extends AbstractSubscriptionManagerTest {
+class JPASubscriptionManagerTest extends AbstractSubscriptionManagerTest {
 
     private static final JpaTestCluster JPA_TEST_CLUSTER = JpaTestCluster.create(JPAMailboxFixture.MAILBOX_PERSISTANCE_CLASSES);
     
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    void init() {
         super.setup();
     }
     
     @Override
-    public SubscriptionManager createSubscriptionManager() {
+    protected SubscriptionManager createSubscriptionManager() {
         JVMMailboxPathLocker locker = new JVMMailboxPathLocker();
 
         EntityManagerFactory entityManagerFactory = JPA_TEST_CLUSTER.getEntityManagerFactory();
@@ -51,9 +50,8 @@ public class JPASubscriptionManagerTest extends AbstractSubscriptionManagerTest
         return new JPASubscriptionManager(mf);
     }
 
-    @Override
-    @After
-    public void teardown() throws SubscriptionException {
+    @AfterEach
+    void close() {
         JPA_TEST_CLUSTER.clear(JPAMailboxFixture.MAILBOX_TABLE_NAMES);
     }
 }
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 f3a262a..3316f03 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
@@ -25,17 +25,16 @@ import org.apache.james.backends.jpa.JpaTestCluster;
 import org.apache.james.mailbox.MailboxManagerStressTest;
 import org.apache.james.mailbox.events.EventBus;
 import org.apache.james.mailbox.jpa.openjpa.OpenJPAMailboxManager;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
 
-public class JpaMailboxManagerStressTest extends MailboxManagerStressTest<OpenJPAMailboxManager> {
+class JpaMailboxManagerStressTest extends MailboxManagerStressTest<OpenJPAMailboxManager> {
 
     private static final JpaTestCluster JPA_TEST_CLUSTER = JpaTestCluster.create(JPAMailboxFixture.MAILBOX_PERSISTANCE_CLASSES);
     private Optional<OpenJPAMailboxManager> openJPAMailboxManager = Optional.empty();
 
-    @Override
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    void setup() throws Exception {
         super.setUp();
     }
     
@@ -52,8 +51,8 @@ public class JpaMailboxManagerStressTest extends MailboxManagerStressTest<OpenJP
         return mailboxManager.getEventBus();
     }
 
-    @After
-    public void tearDown() {
+    @AfterEach
+    void tearDown() {
         JPA_TEST_CLUSTER.clear(JPAMailboxFixture.MAILBOX_TABLE_NAMES);
     }
 }
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 aaa895c..c1eb8b3 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
@@ -19,20 +19,20 @@
 
 package org.apache.james.mailbox.maildir;
 
+import java.io.File;
+
 import org.apache.james.mailbox.MailboxManagerStressTest;
 import org.apache.james.mailbox.events.EventBus;
 import org.apache.james.mailbox.store.StoreMailboxManager;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.io.TempDir;
 
-public class DomainUserMaildirMailboxManagerStressTest extends MailboxManagerStressTest<StoreMailboxManager> {
-    @Rule
-    public TemporaryFolder tmpFolder = new TemporaryFolder();
-    
-    @Override
-    @Before
-    public void setUp() throws Exception {
+class DomainUserMaildirMailboxManagerStressTest extends MailboxManagerStressTest<StoreMailboxManager> {
+    @TempDir
+    File tmpFolder;
+
+    @BeforeEach
+    void setup() throws Exception {
         super.setUp();
     }
     
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 5eacedc..07664d7 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
@@ -19,20 +19,20 @@
 
 package org.apache.james.mailbox.maildir;
 
+import java.io.File;
+
 import org.apache.james.mailbox.MailboxManagerStressTest;
 import org.apache.james.mailbox.events.EventBus;
 import org.apache.james.mailbox.store.StoreMailboxManager;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.io.TempDir;
 
-public class FullUserMaildirMailboxManagerStressTest extends MailboxManagerStressTest<StoreMailboxManager> {
-    @Rule
-    public TemporaryFolder tmpFolder = new TemporaryFolder();
-    
-    @Override
-    @Before
-    public void setUp() throws Exception {
+class FullUserMaildirMailboxManagerStressTest extends MailboxManagerStressTest<StoreMailboxManager> {
+    @TempDir
+    File tmpFolder;
+
+    @BeforeEach
+    void setup() throws Exception {
         super.setUp();
     }
     
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 6c37bba..b458a9a 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
@@ -18,26 +18,27 @@
  ****************************************************************/
 package org.apache.james.mailbox.maildir;
 
+import java.io.File;
+
 import org.apache.james.mailbox.AbstractSubscriptionManagerTest;
 import org.apache.james.mailbox.SubscriptionManager;
 import org.apache.james.mailbox.store.JVMMailboxPathLocker;
 import org.apache.james.mailbox.store.StoreSubscriptionManager;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.io.TempDir;
 
-public class MaildirSubscriptionManagerTest extends AbstractSubscriptionManagerTest {
+class MaildirSubscriptionManagerTest extends AbstractSubscriptionManagerTest {
 
-    @Rule
-    public TemporaryFolder tmpFolder = new TemporaryFolder();
+    @TempDir
+    File tmpFolder;
     
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    void setUp() {
         super.setup();
     }
     
     @Override
-    public SubscriptionManager createSubscriptionManager() {
+    protected SubscriptionManager createSubscriptionManager() {
         MaildirStore store = new MaildirStore(tmpFolder + "/Maildir/%domain/%user", new JVMMailboxPathLocker());
         MaildirMailboxSessionMapperFactory factory = new MaildirMailboxSessionMapperFactory(store);
         return new StoreSubscriptionManager(factory);
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 457f12d..f64648c 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
@@ -19,20 +19,20 @@
 
 package org.apache.james.mailbox.maildir;
 
+import java.io.File;
+
 import org.apache.james.mailbox.MailboxManagerStressTest;
 import org.apache.james.mailbox.events.EventBus;
 import org.apache.james.mailbox.store.StoreMailboxManager;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.rules.TemporaryFolder;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.io.TempDir;
 
-public class UserMaildirMailboxManagerStressTest extends MailboxManagerStressTest<StoreMailboxManager> {
-    @Rule
-    public TemporaryFolder tmpFolder = new TemporaryFolder();
-    
-    @Override
-    @Before
-    public void setUp() throws Exception {
+class UserMaildirMailboxManagerStressTest extends MailboxManagerStressTest<StoreMailboxManager> {
+    @TempDir
+    File tmpFolder;
+
+    @BeforeEach
+    void setup() throws Exception {
         super.setUp();
     }
     
diff --git a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/MemoryMailboxManagerStressTest.java b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/MemoryMailboxManagerStressTest.java
index a9e572e..1f8db72 100644
--- a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/MemoryMailboxManagerStressTest.java
+++ b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/MemoryMailboxManagerStressTest.java
@@ -22,13 +22,12 @@ package org.apache.james.mailbox.inmemory;
 import org.apache.james.mailbox.MailboxManagerStressTest;
 import org.apache.james.mailbox.events.EventBus;
 import org.apache.james.mailbox.extension.PreDeletionHook;
-import org.junit.Before;
+import org.junit.jupiter.api.BeforeEach;
 
-public class MemoryMailboxManagerStressTest extends MailboxManagerStressTest<InMemoryMailboxManager> {
-    
-    @Override
-    @Before
-    public void setUp() throws Exception {
+class MemoryMailboxManagerStressTest extends MailboxManagerStressTest<InMemoryMailboxManager> {
+
+    @BeforeEach
+    void setup() throws Exception {
         super.setUp();
     }
     


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


[james-project] 04/30: JAMES-2704 RandomStoring should use james Iterators util for stream conversion

Posted by bt...@apache.org.
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 463f11ab77ff8407d9a520ed011e5f22ceb018c9
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Wed Nov 6 17:01:06 2019 +0700

    JAMES-2704 RandomStoring should use james Iterators util for stream conversion
---
 .../main/java/org/apache/james/transport/mailets/RandomStoring.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RandomStoring.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RandomStoring.java
index 2c56f6f..58e816c 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RandomStoring.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RandomStoring.java
@@ -38,6 +38,7 @@ import org.apache.james.mailbox.model.search.MailboxQuery;
 import org.apache.james.transport.mailets.delivery.MailStore;
 import org.apache.james.user.api.UsersRepository;
 import org.apache.james.user.api.UsersRepositoryException;
+import org.apache.james.util.streams.Iterators;
 import org.apache.mailet.Attribute;
 import org.apache.mailet.Mail;
 import org.apache.mailet.base.GenericMailet;
@@ -45,7 +46,6 @@ import org.apache.mailet.base.GenericMailet;
 import com.github.fge.lambdas.Throwing;
 import com.github.steveash.guavate.Guavate;
 import com.google.common.base.MoreObjects;
-import com.google.common.collect.Streams;
 
 import reactor.core.publisher.Mono;
 
@@ -107,7 +107,7 @@ public class RandomStoring extends GenericMailet {
     }
 
     private List<ReroutingInfos> retrieveReroutingInfos() throws UsersRepositoryException {
-        return Streams.stream(usersRepository.list())
+        return Iterators.toStream(usersRepository.list())
             .map(Username::of)
             .flatMap(this::buildReRoutingInfos)
             .collect(Guavate.toImmutableList());


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


[james-project] 12/30: [Refactoring] Rename Message to Request in IMAP processor

Posted by bt...@apache.org.
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 e7188da2ebfc011eb4d8bf1390d176ab7158302b
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Wed Nov 13 10:49:16 2019 +0700

    [Refactoring] Rename Message to Request in IMAP processor
---
 .../imap/processor/AbstractAuthProcessor.java      |  6 ++--
 .../imap/processor/AbstractMailboxProcessor.java   | 10 +++----
 .../processor/AbstractMessageRangeProcessor.java   |  8 +++---
 .../imap/processor/AbstractSelectionProcessor.java |  6 ++--
 .../processor/AbstractSubscriptionProcessor.java   | 14 +++++-----
 .../james/imap/processor/AppendProcessor.java      |  4 +--
 .../imap/processor/AuthenticateProcessor.java      |  4 +--
 .../james/imap/processor/CapabilityProcessor.java  |  2 +-
 .../james/imap/processor/CheckProcessor.java       |  6 ++--
 .../james/imap/processor/CloseProcessor.java       |  8 +++---
 .../apache/james/imap/processor/CopyProcessor.java |  8 +++---
 .../james/imap/processor/CreateProcessor.java      |  4 +--
 .../james/imap/processor/DeleteACLProcessor.java   | 28 +++++++++----------
 .../james/imap/processor/DeleteProcessor.java      |  4 +--
 .../james/imap/processor/EnableProcessor.java      |  4 +--
 .../james/imap/processor/ExamineProcessor.java     | 16 +++++------
 .../james/imap/processor/ExpungeProcessor.java     |  4 +--
 .../james/imap/processor/GetACLProcessor.java      | 22 +++++++--------
 .../imap/processor/GetAnnotationProcessor.java     | 22 +++++++--------
 .../james/imap/processor/GetQuotaProcessor.java    | 16 +++++------
 .../imap/processor/GetQuotaRootProcessor.java      | 20 +++++++-------
 .../apache/james/imap/processor/IdleProcessor.java |  6 ++--
 .../apache/james/imap/processor/LSubProcessor.java |  6 ++--
 .../apache/james/imap/processor/ListProcessor.java |  6 ++--
 .../james/imap/processor/ListRightsProcessor.java  | 26 +++++++++---------
 .../james/imap/processor/LoginProcessor.java       |  4 +--
 .../james/imap/processor/LogoutProcessor.java      |  2 +-
 .../apache/james/imap/processor/MoveProcessor.java |  8 +++---
 .../james/imap/processor/MyRightsProcessor.java    | 18 ++++++------
 .../james/imap/processor/NamespaceProcessor.java   |  2 +-
 .../apache/james/imap/processor/NoopProcessor.java |  4 +--
 .../james/imap/processor/RenameProcessor.java      |  6 ++--
 .../james/imap/processor/SearchProcessor.java      |  6 ++--
 .../james/imap/processor/SetACLProcessor.java      | 32 +++++++++++-----------
 .../imap/processor/SetAnnotationProcessor.java     | 26 +++++++++---------
 .../james/imap/processor/SetQuotaProcessor.java    | 12 ++++----
 .../james/imap/processor/StatusProcessor.java      |  6 ++--
 .../james/imap/processor/UnselectProcessor.java    |  8 +++---
 .../james/imap/processor/fetch/FetchProcessor.java |  8 +++---
 39 files changed, 201 insertions(+), 201 deletions(-)

diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractAuthProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractAuthProcessor.java
index 94ccf20..7d8ba6a 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractAuthProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractAuthProcessor.java
@@ -44,7 +44,7 @@ import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Preconditions;
 
-public abstract class AbstractAuthProcessor<M extends ImapRequest> extends AbstractMailboxProcessor<M> {
+public abstract class AbstractAuthProcessor<R extends ImapRequest> extends AbstractMailboxProcessor<R> {
     private static final Logger LOGGER = LoggerFactory.getLogger(AbstractAuthProcessor.class);
 
     private static final String ATTRIBUTE_NUMBER_OF_FAILURES = "org.apache.james.imap.processor.imap4rev1.NUMBER_OF_FAILURES";
@@ -52,8 +52,8 @@ public abstract class AbstractAuthProcessor<M extends ImapRequest> extends Abstr
     // TODO: this should be configurable
     private static final int MAX_FAILURES = 3;
     
-    public AbstractAuthProcessor(Class<M> acceptableClass, ImapProcessor next, MailboxManager mailboxManager, StatusResponseFactory factory,
-            MetricFactory metricFactory) {
+    public AbstractAuthProcessor(Class<R> acceptableClass, ImapProcessor next, MailboxManager mailboxManager, StatusResponseFactory factory,
+                                 MetricFactory metricFactory) {
         super(acceptableClass, next, mailboxManager, factory, metricFactory);
     }
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
index 99d9382..f4d1479 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
@@ -68,7 +68,7 @@ import org.apache.james.metrics.api.TimeMetric;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public abstract class AbstractMailboxProcessor<M extends ImapRequest> extends AbstractChainedProcessor<M> {
+public abstract class AbstractMailboxProcessor<R extends ImapRequest> extends AbstractChainedProcessor<R> {
     private static final Logger LOGGER = LoggerFactory.getLogger(AbstractMailboxProcessor.class);
 
     public static final String IMAP_PREFIX = "IMAP-";
@@ -76,8 +76,8 @@ public abstract class AbstractMailboxProcessor<M extends ImapRequest> extends Ab
     private final StatusResponseFactory factory;
     private final MetricFactory metricFactory;
 
-    public AbstractMailboxProcessor(Class<M> acceptableClass, ImapProcessor next, MailboxManager mailboxManager, StatusResponseFactory factory,
-            MetricFactory metricFactory) {
+    public AbstractMailboxProcessor(Class<R> acceptableClass, ImapProcessor next, MailboxManager mailboxManager, StatusResponseFactory factory,
+                                    MetricFactory metricFactory) {
         super(acceptableClass, next);
         this.mailboxManager = mailboxManager;
         this.factory = factory;
@@ -85,7 +85,7 @@ public abstract class AbstractMailboxProcessor<M extends ImapRequest> extends Ab
     }
 
     @Override
-    protected final void doProcess(M acceptableMessage, Responder responder, ImapSession session) {
+    protected final void doProcess(R acceptableMessage, Responder responder, ImapSession session) {
         TimeMetric timeMetric = metricFactory.timer(IMAP_PREFIX + acceptableMessage.getCommand().getName());
         try {
             if (!acceptableMessage.getCommand().validForState(session.getState())) {
@@ -355,7 +355,7 @@ public abstract class AbstractMailboxProcessor<M extends ImapRequest> extends Ab
         responder.respond(response);
     }
 
-    protected abstract void processRequest(M message, ImapSession session, Responder responder);
+    protected abstract void processRequest(R request, ImapSession session, Responder responder);
 
     /**
      * Joins the elements of a mailboxPath together and returns them as a string
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMessageRangeProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMessageRangeProcessor.java
index cc56604..f339d38 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMessageRangeProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMessageRangeProcessor.java
@@ -43,11 +43,11 @@ import org.apache.james.metrics.api.MetricFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public abstract class AbstractMessageRangeProcessor<M extends AbstractMessageRangeRequest> extends AbstractMailboxProcessor<M> {
+public abstract class AbstractMessageRangeProcessor<R extends AbstractMessageRangeRequest> extends AbstractMailboxProcessor<R> {
     private static final Logger LOGGER = LoggerFactory.getLogger(AbstractMessageRangeProcessor.class);
 
-    public AbstractMessageRangeProcessor(Class<M> acceptableClass, ImapProcessor next, MailboxManager mailboxManager, StatusResponseFactory factory,
-            MetricFactory metricFactory) {
+    public AbstractMessageRangeProcessor(Class<R> acceptableClass, ImapProcessor next, MailboxManager mailboxManager, StatusResponseFactory factory,
+                                         MetricFactory metricFactory) {
         super(acceptableClass, next, mailboxManager, factory, metricFactory);
     }
 
@@ -60,7 +60,7 @@ public abstract class AbstractMessageRangeProcessor<M extends AbstractMessageRan
     protected abstract String getOperationName();
 
     @Override
-    protected void processRequest(M request, ImapSession session, Responder responder) {
+    protected void processRequest(R request, ImapSession session, Responder responder) {
         final MailboxPath targetMailbox = PathConverter.forSession(session).buildFullPath(request.getMailboxName());
         final IdRange[] idSet = request.getIdSet();
         final boolean useUids = request.isUseUids();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
index 08923e5..2a03651 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
@@ -59,7 +59,7 @@ import org.slf4j.LoggerFactory;
 
 import com.google.common.collect.ImmutableList;
 
-abstract class AbstractSelectionProcessor<M extends AbstractMailboxSelectionRequest> extends AbstractMailboxProcessor<M> implements PermitEnableCapabilityProcessor {
+abstract class AbstractSelectionProcessor<R extends AbstractMailboxSelectionRequest> extends AbstractMailboxProcessor<R> implements PermitEnableCapabilityProcessor {
     private static final Logger LOGGER = LoggerFactory.getLogger(AbstractSelectionProcessor.class);
     private static final List<String> CAPS = ImmutableList.of(ImapConstants.SUPPORTS_QRESYNC, ImapConstants.SUPPORTS_CONDSTORE);
 
@@ -67,7 +67,7 @@ abstract class AbstractSelectionProcessor<M extends AbstractMailboxSelectionRequ
     private final boolean openReadOnly;
     private final EventBus eventBus;
     
-    public AbstractSelectionProcessor(Class<M> acceptableClass, ImapProcessor next, MailboxManager mailboxManager, StatusResponseFactory statusResponseFactory, boolean openReadOnly,
+    public AbstractSelectionProcessor(Class<R> acceptableClass, ImapProcessor next, MailboxManager mailboxManager, StatusResponseFactory statusResponseFactory, boolean openReadOnly,
                                       MetricFactory metricFactory, EventBus eventBus) {
         super(acceptableClass, next, mailboxManager, statusResponseFactory, metricFactory);
         this.statusResponseFactory = statusResponseFactory;
@@ -77,7 +77,7 @@ abstract class AbstractSelectionProcessor<M extends AbstractMailboxSelectionRequ
     }
 
     @Override
-    protected void processRequest(M request, ImapSession session, Responder responder) {
+    protected void processRequest(R request, ImapSession session, Responder responder) {
         final String mailboxName = request.getMailboxName();
         try {
             final MailboxPath fullMailboxPath = PathConverter.forSession(session).buildFullPath(mailboxName);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSubscriptionProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSubscriptionProcessor.java
index 6bcac42..ec3c4f2 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSubscriptionProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSubscriptionProcessor.java
@@ -32,12 +32,12 @@ import org.apache.james.metrics.api.MetricFactory;
  * Abstract base class which should be used by implementations which need to
  * access the {@link SubscriptionManager}
  */
-public abstract class AbstractSubscriptionProcessor<M extends ImapRequest> extends AbstractMailboxProcessor<M> {
+public abstract class AbstractSubscriptionProcessor<R extends ImapRequest> extends AbstractMailboxProcessor<R> {
 
     private final SubscriptionManager subscriptionManager;
 
-    public AbstractSubscriptionProcessor(Class<M> acceptableClass, ImapProcessor next, MailboxManager mailboxManager, SubscriptionManager subscriptionManager, StatusResponseFactory factory,
-            MetricFactory metricFactory) {
+    public AbstractSubscriptionProcessor(Class<R> acceptableClass, ImapProcessor next, MailboxManager mailboxManager, SubscriptionManager subscriptionManager, StatusResponseFactory factory,
+                                         MetricFactory metricFactory) {
         super(acceptableClass, next, mailboxManager, factory, metricFactory);
         this.subscriptionManager = subscriptionManager;
     }
@@ -52,22 +52,22 @@ public abstract class AbstractSubscriptionProcessor<M extends ImapRequest> exten
     }
 
     @Override
-    protected final void processRequest(M message, ImapSession session, Responder responder) {
+    protected final void processRequest(R request, ImapSession session, Responder responder) {
 
         // take care of calling the start/end processing
         MailboxSession mSession = ImapSessionUtils.getMailboxSession(session);
         getSubscriptionManager().startProcessingRequest(mSession);
-        doProcessRequest(message, session, responder);
+        doProcessRequest(request, session, responder);
         getSubscriptionManager().endProcessingRequest(mSession);
     }
 
     /**
      * Process the request
      * 
-     * @param message
+     * @param request
      * @param session
      * @param responder
      */
-    protected abstract void doProcessRequest(M message, ImapSession session, Responder responder);
+    protected abstract void doProcessRequest(R request, ImapSession session, Responder responder);
 
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AppendProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AppendProcessor.java
index 6cd15dc..983d855 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AppendProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AppendProcessor.java
@@ -153,10 +153,10 @@ public class AppendProcessor extends AbstractMailboxProcessor<AppendRequest> {
     }
 
     @Override
-    protected Closeable addContextToMDC(AppendRequest message) {
+    protected Closeable addContextToMDC(AppendRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "APPEND")
-            .addContext("mailbox", message.getMailboxName())
+            .addContext("mailbox", request.getMailboxName())
             .build();
     }
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AuthenticateProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AuthenticateProcessor.java
index 43f65d5..b44dd1a 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AuthenticateProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AuthenticateProcessor.java
@@ -146,10 +146,10 @@ public class AuthenticateProcessor extends AbstractAuthProcessor<AuthenticateReq
     }
 
     @Override
-    protected Closeable addContextToMDC(AuthenticateRequest message) {
+    protected Closeable addContextToMDC(AuthenticateRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "AUTHENTICATE")
-            .addContext("authType", message.getAuthType())
+            .addContext("authType", request.getAuthType())
             .build();
     }
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java
index 925f40f..d82f129 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java
@@ -116,7 +116,7 @@ public class CapabilityProcessor extends AbstractMailboxProcessor<CapabilityRequ
     }
 
     @Override
-    protected Closeable addContextToMDC(CapabilityRequest message) {
+    protected Closeable addContextToMDC(CapabilityRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "CAPABILITY")
             .build();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/CheckProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/CheckProcessor.java
index feeca69..57863f6 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/CheckProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/CheckProcessor.java
@@ -37,13 +37,13 @@ public class CheckProcessor extends AbstractMailboxProcessor<CheckRequest> {
     }
 
     @Override
-    protected void processRequest(CheckRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(CheckRequest request, ImapSession session, Responder responder) {
         unsolicitedResponses(session, responder, false);
-        okComplete(message, responder);
+        okComplete(request, responder);
     }
 
     @Override
-    protected Closeable addContextToMDC(CheckRequest message) {
+    protected Closeable addContextToMDC(CheckRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "CHECK")
             .build();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/CloseProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/CloseProcessor.java
index c870ce8..cc0f6b6 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/CloseProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/CloseProcessor.java
@@ -47,7 +47,7 @@ public class CloseProcessor extends AbstractMailboxProcessor<CloseRequest> {
     }
 
     @Override
-    protected void processRequest(CloseRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(CloseRequest request, ImapSession session, Responder responder) {
         try {
             MessageManager mailbox = getSelectedMailbox(session);
             final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
@@ -58,18 +58,18 @@ public class CloseProcessor extends AbstractMailboxProcessor<CloseRequest> {
                 // Don't send HIGHESTMODSEQ when close. Like correct in the ERRATA of RFC5162
                 //
                 // See http://www.rfc-editor.org/errata_search.php?rfc=5162
-                okComplete(message, responder);
+                okComplete(request, responder);
                
             }
 
         } catch (MailboxException e) {
             LOGGER.error("Close failed for mailbox {}", session.getSelected().getMailboxId(), e);
-            no(message, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
+            no(request, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
     }
 
     @Override
-    protected Closeable addContextToMDC(CloseRequest message) {
+    protected Closeable addContextToMDC(CloseRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "CLOSE")
             .build();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/CopyProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/CopyProcessor.java
index be6f59f..42b65c7 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/CopyProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/CopyProcessor.java
@@ -56,12 +56,12 @@ public class CopyProcessor extends AbstractMessageRangeProcessor<CopyRequest> {
     }
 
     @Override
-    protected Closeable addContextToMDC(CopyRequest message) {
+    protected Closeable addContextToMDC(CopyRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "COPY")
-            .addContext("targetMailbox", message.getMailboxName())
-            .addContext("uidEnabled", message.isUseUids())
-            .addContext("idSet", IdRange.toString(message.getIdSet()))
+            .addContext("targetMailbox", request.getMailboxName())
+            .addContext("uidEnabled", request.isUseUids())
+            .addContext("idSet", IdRange.toString(request.getIdSet()))
             .build();
     }
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/CreateProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/CreateProcessor.java
index c2ddf7f..ecbfc8b 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/CreateProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/CreateProcessor.java
@@ -67,10 +67,10 @@ public class CreateProcessor extends AbstractMailboxProcessor<CreateRequest> {
     }
 
     @Override
-    protected Closeable addContextToMDC(CreateRequest message) {
+    protected Closeable addContextToMDC(CreateRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "CREATE")
-            .addContext("mailbox", message.getMailboxName())
+            .addContext("mailbox", request.getMailboxName())
             .build();
     }
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java
index 93b6fc5..44a9658 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java
@@ -59,12 +59,12 @@ public class DeleteACLProcessor extends AbstractMailboxProcessor<DeleteACLReques
     }
 
     @Override
-    protected void processRequest(DeleteACLRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(DeleteACLRequest request, ImapSession session, Responder responder) {
 
         final MailboxManager mailboxManager = getMailboxManager();
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
-        final String mailboxName = message.getMailboxName();
-        final String identifier = message.getIdentifier();
+        final String mailboxName = request.getMailboxName();
+        final String identifier = request.getIdentifier();
         try {
 
             MailboxPath mailboxPath = PathConverter.forSession(session).buildFullPath(mailboxName);
@@ -81,16 +81,16 @@ public class DeleteACLProcessor extends AbstractMailboxProcessor<DeleteACLReques
              * existence information, much less the mailbox’s ACL.
              */
             if (!mailboxManager.hasRight(mailboxPath, MailboxACL.Right.Lookup, mailboxSession)) {
-                no(message, responder, HumanReadableText.MAILBOX_NOT_FOUND);
+                no(request, responder, HumanReadableText.MAILBOX_NOT_FOUND);
             } else if (!mailboxManager.hasRight(mailboxPath, MailboxACL.Right.Administer, mailboxSession)) {
                 /* RFC 4314 section 4. */
                 Object[] params = new Object[] {
                         MailboxACL.Right.Administer.toString(),
-                        message.getCommand().getName(),
+                        request.getCommand().getName(),
                         mailboxName
                 };
                 HumanReadableText text = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
-                no(message, responder, text);
+                no(request, responder, text);
             } else {
                 
                 EntryKey key = EntryKey.deserialize(identifier);
@@ -111,7 +111,7 @@ public class DeleteACLProcessor extends AbstractMailboxProcessor<DeleteACLReques
                     mailboxSession
                 );
 
-                okComplete(message, responder);
+                okComplete(request, responder);
                 // FIXME should we send unsolicited responses here?
                 // unsolicitedResponses(session, responder, false);
             }
@@ -124,12 +124,12 @@ public class DeleteACLProcessor extends AbstractMailboxProcessor<DeleteACLReques
              * */
             Object[] params = new Object[] {e.getUnsupportedRight()};
             HumanReadableText text = new HumanReadableText(HumanReadableText.UNSUPPORTED_RIGHT_KEY, HumanReadableText.UNSUPPORTED_RIGHT_DEFAULT_VALUE, params);
-            taggedBad(message, responder, text);
+            taggedBad(request, responder, text);
         } catch (MailboxNotFoundException e) {
-            no(message, responder, HumanReadableText.MAILBOX_NOT_FOUND);
+            no(request, responder, HumanReadableText.MAILBOX_NOT_FOUND);
         } catch (MailboxException e) {
-            LOGGER.error("{} failed for mailbox {}", message.getCommand().getName(), mailboxName, e);
-            no(message, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
+            LOGGER.error("{} failed for mailbox {}", request.getCommand().getName(), mailboxName, e);
+            no(request, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
 
     }
@@ -140,11 +140,11 @@ public class DeleteACLProcessor extends AbstractMailboxProcessor<DeleteACLReques
     }
 
     @Override
-    protected Closeable addContextToMDC(DeleteACLRequest message) {
+    protected Closeable addContextToMDC(DeleteACLRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "DELETE_ACL")
-            .addContext("mailbox", message.getMailboxName())
-            .addContext("identifier", message.getIdentifier())
+            .addContext("mailbox", request.getMailboxName())
+            .addContext("identifier", request.getIdentifier())
             .build();
     }
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java
index 55f18ff..dc7958b 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java
@@ -73,10 +73,10 @@ public class DeleteProcessor extends AbstractMailboxProcessor<DeleteRequest> {
     }
 
     @Override
-    protected Closeable addContextToMDC(DeleteRequest message) {
+    protected Closeable addContextToMDC(DeleteRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "DELETE")
-            .addContext("mailbox", message.getMailboxName())
+            .addContext("mailbox", request.getMailboxName())
             .build();
     }
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/EnableProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/EnableProcessor.java
index 92841d0..74b8982 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/EnableProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/EnableProcessor.java
@@ -127,10 +127,10 @@ public class EnableProcessor extends AbstractMailboxProcessor<EnableRequest> imp
     }
 
     @Override
-    protected Closeable addContextToMDC(EnableRequest message) {
+    protected Closeable addContextToMDC(EnableRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "ENABLE")
-            .addContext("capabilities", ImmutableList.copyOf(message.getCapabilities()))
+            .addContext("capabilities", ImmutableList.copyOf(request.getCapabilities()))
             .build();
     }
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/ExamineProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/ExamineProcessor.java
index eaed119..5486524 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/ExamineProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/ExamineProcessor.java
@@ -39,16 +39,16 @@ public class ExamineProcessor extends AbstractSelectionProcessor<ExamineRequest>
     }
 
     @Override
-    protected Closeable addContextToMDC(ExamineRequest message) {
+    protected Closeable addContextToMDC(ExamineRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "EXAMINE")
-            .addContext("mailbox", message.getMailboxName())
-            .addContext("condstore", Boolean.toString(message.getCondstore()))
-            .addContext("knownModseq", message.getKnownModSeq())
-            .addContext("knownUids", UidRange.toString(message.getKnownUidSet()))
-            .addContext("knownIdRange", IdRange.toString(message.getKnownSequenceSet()))
-            .addContext("lastKnownUidValidity", message.getLastKnownUidValidity())
-            .addContext("uidSet", UidRange.toString(message.getUidSet()))
+            .addContext("mailbox", request.getMailboxName())
+            .addContext("condstore", Boolean.toString(request.getCondstore()))
+            .addContext("knownModseq", request.getKnownModSeq())
+            .addContext("knownUids", UidRange.toString(request.getKnownUidSet()))
+            .addContext("knownIdRange", IdRange.toString(request.getKnownSequenceSet()))
+            .addContext("lastKnownUidValidity", request.getLastKnownUidValidity())
+            .addContext("uidSet", UidRange.toString(request.getUidSet()))
             .build();
     }
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java
index dac509c..6646faa 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java
@@ -127,10 +127,10 @@ public class ExpungeProcessor extends AbstractMailboxProcessor<ExpungeRequest> i
     }
 
     @Override
-    protected Closeable addContextToMDC(ExpungeRequest message) {
+    protected Closeable addContextToMDC(ExpungeRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "EXPUNGE")
-            .addContext("uidSet", IdRange.toString(message.getUidSet()))
+            .addContext("uidSet", IdRange.toString(request.getUidSet()))
             .build();
     }
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java
index 980e567..bd7e884 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java
@@ -61,11 +61,11 @@ public class GetACLProcessor extends AbstractMailboxProcessor<GetACLRequest> imp
     }
 
     @Override
-    protected void processRequest(GetACLRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(GetACLRequest request, ImapSession session, Responder responder) {
 
         final MailboxManager mailboxManager = getMailboxManager();
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
-        final String mailboxName = message.getMailboxName();
+        final String mailboxName = request.getMailboxName();
         try {
 
             MailboxPath mailboxPath = PathConverter.forSession(session).buildFullPath(mailboxName);
@@ -82,29 +82,29 @@ public class GetACLProcessor extends AbstractMailboxProcessor<GetACLRequest> imp
              * existence information, much less the mailbox’s ACL.
              */
             if (!mailboxManager.hasRight(mailboxPath, MailboxACL.Right.Lookup, mailboxSession)) {
-                no(message, responder, HumanReadableText.MAILBOX_NOT_FOUND);
+                no(request, responder, HumanReadableText.MAILBOX_NOT_FOUND);
             } else if (!mailboxManager.hasRight(mailboxPath, MailboxACL.Right.Administer, mailboxSession)) {
                 /* RFC 4314 section 4. */
                 Object[] params = new Object[] {
                         MailboxACL.Right.Administer.toString(),
-                        message.getCommand().getName(),
+                        request.getCommand().getName(),
                         mailboxName
                 };
                 HumanReadableText text = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
-                no(message, responder, text);
+                no(request, responder, text);
             } else {
                 MetaData metaData = messageManager.getMetaData(false, mailboxSession, FetchGroup.NO_COUNT);
                 ACLResponse aclResponse = new ACLResponse(mailboxName, metaData.getACL());
                 responder.respond(aclResponse);
-                okComplete(message, responder);
+                okComplete(request, responder);
                 // FIXME should we send unsolicited responses here?
                 // unsolicitedResponses(session, responder, false);
             }
         } catch (MailboxNotFoundException e) {
-            no(message, responder, HumanReadableText.MAILBOX_NOT_FOUND);
+            no(request, responder, HumanReadableText.MAILBOX_NOT_FOUND);
         } catch (MailboxException e) {
-            LOGGER.error("{} failed for mailbox {}", message.getCommand().getName(), mailboxName, e);
-            no(message, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
+            LOGGER.error("{} failed for mailbox {}", request.getCommand().getName(), mailboxName, e);
+            no(request, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
 
     }
@@ -115,10 +115,10 @@ public class GetACLProcessor extends AbstractMailboxProcessor<GetACLRequest> imp
     }
 
     @Override
-    protected Closeable addContextToMDC(GetACLRequest message) {
+    protected Closeable addContextToMDC(GetACLRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "GET_ACL")
-            .addContext("mailbox", message.getMailboxName())
+            .addContext("mailbox", request.getMailboxName())
             .build();
     }
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetAnnotationProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetAnnotationProcessor.java
index 09fb510..f8a3abd 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetAnnotationProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetAnnotationProcessor.java
@@ -68,15 +68,15 @@ public class GetAnnotationProcessor extends AbstractMailboxProcessor<GetAnnotati
     }
 
     @Override
-    protected void processRequest(GetAnnotationRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(GetAnnotationRequest request, ImapSession session, Responder responder) {
         try {
-            proceed(message, session, responder);
+            proceed(request, session, responder);
         } catch (MailboxNotFoundException e) {
-            LOGGER.info("The command: {} is failed because not found mailbox {}", message.getCommand().getName(), message.getMailboxName());
-            no(message, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX, ResponseCode.tryCreate());
+            LOGGER.info("The command: {} is failed because not found mailbox {}", request.getCommand().getName(), request.getMailboxName());
+            no(request, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX, ResponseCode.tryCreate());
         } catch (MailboxException e) {
-            LOGGER.error("GetAnnotation on mailbox {} failed for user {}", message.getMailboxName(), ImapSessionUtils.getUserName(session), e);
-            no(message, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
+            LOGGER.error("GetAnnotation on mailbox {} failed for user {}", request.getMailboxName(), ImapSessionUtils.getUserName(session), e);
+            no(request, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
     }
 
@@ -156,13 +156,13 @@ public class GetAnnotationProcessor extends AbstractMailboxProcessor<GetAnnotati
     }
 
     @Override
-    protected Closeable addContextToMDC(GetAnnotationRequest message) {
+    protected Closeable addContextToMDC(GetAnnotationRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "GET_ANNOTATION")
-            .addContext("mailbox", message.getMailboxName())
-            .addContext("depth", message.getDepth())
-            .addContext("maxSize", message.getMaxsize())
-            .addContext("keys", message.getKeys())
+            .addContext("mailbox", request.getMailboxName())
+            .addContext("depth", request.getDepth())
+            .addContext("maxSize", request.getMaxsize())
+            .addContext("keys", request.getKeys())
             .build();
     }
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java
index fb74eeb..6dba743 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java
@@ -69,9 +69,9 @@ public class GetQuotaProcessor extends AbstractMailboxProcessor<GetQuotaRequest>
     }
 
     @Override
-    protected void processRequest(GetQuotaRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(GetQuotaRequest request, ImapSession session, Responder responder) {
         try {
-            QuotaRoot quotaRoot = quotaRootResolver.fromString(message.getQuotaRoot());
+            QuotaRoot quotaRoot = quotaRootResolver.fromString(request.getQuotaRoot());
             if (hasRight(quotaRoot, session)) {
                 Quota<QuotaCount> messageQuota = quotaManager.getMessageQuota(quotaRoot);
                 Quota<QuotaSize> storageQuota = quotaManager.getStorageQuota(quotaRoot);
@@ -81,18 +81,18 @@ public class GetQuotaProcessor extends AbstractMailboxProcessor<GetQuotaRequest>
                 if (storageQuota.getLimit().isLimited()) {
                     responder.respond(new QuotaResponse(ImapConstants.STORAGE_QUOTA_RESOURCE, quotaRoot.getValue(), storageQuota));
                 }
-                okComplete(message, responder);
+                okComplete(request, responder);
             } else {
                 Object[] params = new Object[]{
                         MailboxACL.Right.Read.toString(),
-                        message.getCommand().getName(),
+                        request.getCommand().getName(),
                         "Any mailbox of this user USER"
                 };
                 HumanReadableText humanReadableText = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
-                no(message, responder, humanReadableText);
+                no(request, responder, humanReadableText);
             }
         } catch (MailboxException me) {
-            taggedBad(message, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX);
+            taggedBad(request, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX);
         }
     }
 
@@ -109,10 +109,10 @@ public class GetQuotaProcessor extends AbstractMailboxProcessor<GetQuotaRequest>
     }
 
     @Override
-    protected Closeable addContextToMDC(GetQuotaRequest message) {
+    protected Closeable addContextToMDC(GetQuotaRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "GET_QUOTA")
-            .addContext("quotaRoot", message.getQuotaRoot())
+            .addContext("quotaRoot", request.getQuotaRoot())
             .build();
     }
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java
index 293174f..2674736 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java
@@ -70,11 +70,11 @@ public class GetQuotaRootProcessor extends AbstractMailboxProcessor<GetQuotaRoot
     }
 
     @Override
-    protected void processRequest(GetQuotaRootRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(GetQuotaRootRequest request, ImapSession session, Responder responder) {
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
         final MailboxManager mailboxManager = getMailboxManager();
 
-        final MailboxPath mailboxPath = PathConverter.forSession(session).buildFullPath(message.getMailboxName());
+        final MailboxPath mailboxPath = PathConverter.forSession(session).buildFullPath(request.getMailboxName());
 
         // First check mailbox exists
         try {
@@ -82,34 +82,34 @@ public class GetQuotaRootProcessor extends AbstractMailboxProcessor<GetQuotaRoot
                 QuotaRoot quotaRoot = quotaRootResolver.getQuotaRoot(mailboxPath);
                 Quota<QuotaCount> messageQuota = quotaManager.getMessageQuota(quotaRoot);
                 Quota<QuotaSize> storageQuota = quotaManager.getStorageQuota(quotaRoot);
-                responder.respond(new QuotaRootResponse(message.getMailboxName(), quotaRoot.getValue()));
+                responder.respond(new QuotaRootResponse(request.getMailboxName(), quotaRoot.getValue()));
                 if (messageQuota.getLimit().isLimited()) {
                     responder.respond(new QuotaResponse(ImapConstants.MESSAGE_QUOTA_RESOURCE, quotaRoot.getValue(), messageQuota));
                 }
                 if (storageQuota.getLimit().isLimited()) {
                     responder.respond(new QuotaResponse(ImapConstants.STORAGE_QUOTA_RESOURCE, quotaRoot.getValue(), storageQuota));
                 }
-                okComplete(message, responder);
+                okComplete(request, responder);
             } else {
                 Object[] params = new Object[]{
                         MailboxACL.Right.Read.toString(),
-                        message.getCommand().getName(),
-                        message.getMailboxName()
+                        request.getCommand().getName(),
+                        request.getMailboxName()
                 };
                 HumanReadableText humanReadableText = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
-                no(message, responder, humanReadableText);
+                no(request, responder, humanReadableText);
             }
         } catch (MailboxException me) {
-            taggedBad(message, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX);
+            taggedBad(request, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX);
         }
 
     }
 
     @Override
-    protected Closeable addContextToMDC(GetQuotaRootRequest message) {
+    protected Closeable addContextToMDC(GetQuotaRootRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "GET_QUOTA_ROOT")
-            .addContext("mailbox", message.getMailboxName())
+            .addContext("mailbox", request.getMailboxName())
             .build();
     }
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/IdleProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/IdleProcessor.java
index ad19a73..f1dbe51 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/IdleProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/IdleProcessor.java
@@ -84,7 +84,7 @@ public class IdleProcessor extends AbstractMailboxProcessor<IdleRequest> impleme
     }
 
     @Override
-    protected void processRequest(IdleRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(IdleRequest request, ImapSession session, Responder responder) {
         SelectedMailbox sm = session.getSelected();
         Registration registration;
         if (sm != null) {
@@ -110,10 +110,10 @@ public class IdleProcessor extends AbstractMailboxProcessor<IdleRequest> impleme
                 }
                 session.popLineHandler();
                 if (!DONE.equals(line.toUpperCase(Locale.US))) {
-                    StatusResponse response = getStatusResponseFactory().taggedBad(message.getTag(), message.getCommand(), HumanReadableText.INVALID_COMMAND);
+                    StatusResponse response = getStatusResponseFactory().taggedBad(request.getTag(), request.getCommand(), HumanReadableText.INVALID_COMMAND);
                     responder.respond(response);
                 } else {
-                    okComplete(message, responder);
+                    okComplete(request, responder);
 
                 }
                 idleActive.set(false);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/LSubProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/LSubProcessor.java
index 58aa33d..1842c7a 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/LSubProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/LSubProcessor.java
@@ -101,11 +101,11 @@ public class LSubProcessor extends AbstractSubscriptionProcessor<LsubRequest> {
     }
 
     @Override
-    protected Closeable addContextToMDC(LsubRequest message) {
+    protected Closeable addContextToMDC(LsubRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "LSUB")
-            .addContext("base", message.getBaseReferenceName())
-            .addContext("pattern", message.getMailboxPattern())
+            .addContext("base", request.getBaseReferenceName())
+            .addContext("pattern", request.getMailboxPattern())
             .build();
     }
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java
index e62f61b..1768917 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java
@@ -188,11 +188,11 @@ public class ListProcessor extends AbstractMailboxProcessor<ListRequest> {
     }
 
     @Override
-    protected Closeable addContextToMDC(ListRequest message) {
+    protected Closeable addContextToMDC(ListRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "LIST")
-            .addContext("base", message.getBaseReferenceName())
-            .addContext("pattern", message.getMailboxPattern())
+            .addContext("base", request.getBaseReferenceName())
+            .addContext("pattern", request.getMailboxPattern())
             .build();
     }
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java
index 70dfeb8..38b69e8 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java
@@ -60,12 +60,12 @@ public class ListRightsProcessor extends AbstractMailboxProcessor<ListRightsRequ
     }
 
     @Override
-    protected void processRequest(ListRightsRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(ListRightsRequest request, ImapSession session, Responder responder) {
 
         final MailboxManager mailboxManager = getMailboxManager();
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
-        final String mailboxName = message.getMailboxName();
-        final String identifier = message.getIdentifier();
+        final String mailboxName = request.getMailboxName();
+        final String identifier = request.getIdentifier();
         try {
 
             MailboxPath mailboxPath = PathConverter.forSession(session).buildFullPath(mailboxName);
@@ -83,16 +83,16 @@ public class ListRightsProcessor extends AbstractMailboxProcessor<ListRightsRequ
              * existence information, much less the mailbox’s ACL.
              */
             if (!mailboxManager.hasRight(mailboxPath, MailboxACL.Right.Lookup, mailboxSession)) {
-                no(message, responder, HumanReadableText.MAILBOX_NOT_FOUND);
+                no(request, responder, HumanReadableText.MAILBOX_NOT_FOUND);
             } else if (!mailboxManager.hasRight(mailboxPath, MailboxACL.Right.Administer, mailboxSession)) {
                 /* RFC 4314 section 4. */
                 Object[] params = new Object[] {
                         MailboxACL.Right.Administer.toString(),
-                        message.getCommand().getName(),
+                        request.getCommand().getName(),
                         mailboxName
                 };
                 HumanReadableText text = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
-                no(message, responder, text);
+                no(request, responder, text);
             } else {
                 
                 EntryKey key = EntryKey.deserialize(identifier);
@@ -110,15 +110,15 @@ public class ListRightsProcessor extends AbstractMailboxProcessor<ListRightsRequ
                 Rfc4314Rights[] rights = mailboxManager.listRights(mailboxPath, key, mailboxSession);
                 ListRightsResponse aclResponse = new ListRightsResponse(mailboxName, identifier, rights);
                 responder.respond(aclResponse);
-                okComplete(message, responder);
+                okComplete(request, responder);
                 // FIXME should we send unsolicited responses here?
                 // unsolicitedResponses(session, responder, false);
             }
         } catch (MailboxNotFoundException e) {
-            no(message, responder, HumanReadableText.MAILBOX_NOT_FOUND);
+            no(request, responder, HumanReadableText.MAILBOX_NOT_FOUND);
         } catch (MailboxException e) {
-            LOGGER.error("{} failed for mailbox {}", message.getCommand().getName(), mailboxName, e);
-            no(message, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
+            LOGGER.error("{} failed for mailbox {}", request.getCommand().getName(), mailboxName, e);
+            no(request, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
 
     }
@@ -129,11 +129,11 @@ public class ListRightsProcessor extends AbstractMailboxProcessor<ListRightsRequ
     }
 
     @Override
-    protected Closeable addContextToMDC(ListRightsRequest message) {
+    protected Closeable addContextToMDC(ListRightsRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "LIST_RIGHTS")
-            .addContext("mailbox", message.getMailboxName())
-            .addContext("identifier", message.getIdentifier())
+            .addContext("mailbox", request.getMailboxName())
+            .addContext("identifier", request.getIdentifier())
             .build();
     }
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/LoginProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/LoginProcessor.java
index f6593b8..3faa59f 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/LoginProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/LoginProcessor.java
@@ -68,10 +68,10 @@ public class LoginProcessor extends AbstractAuthProcessor<LoginRequest> implemen
     }
 
     @Override
-    protected Closeable addContextToMDC(LoginRequest message) {
+    protected Closeable addContextToMDC(LoginRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "LOGIN")
-            .addContext(MDCBuilder.USER, message.getUserid())
+            .addContext(MDCBuilder.USER, request.getUserid())
             .build();
     }
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java
index 4710f5e..c6b9e8c 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java
@@ -58,7 +58,7 @@ public class LogoutProcessor extends AbstractMailboxProcessor<LogoutRequest> {
     }
 
     @Override
-    protected Closeable addContextToMDC(LogoutRequest message) {
+    protected Closeable addContextToMDC(LogoutRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "LOGOUT")
             .build();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/MoveProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/MoveProcessor.java
index 1f72217..2adb49a 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/MoveProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/MoveProcessor.java
@@ -71,12 +71,12 @@ public class MoveProcessor extends AbstractMessageRangeProcessor<MoveRequest> im
     }
 
     @Override
-    protected Closeable addContextToMDC(MoveRequest message) {
+    protected Closeable addContextToMDC(MoveRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "MOVE")
-            .addContext("targetMailbox", message.getMailboxName())
-            .addContext("uidEnabled", message.isUseUids())
-            .addContext("idSet", IdRange.toString(message.getIdSet()))
+            .addContext("targetMailbox", request.getMailboxName())
+            .addContext("uidEnabled", request.isUseUids())
+            .addContext("idSet", IdRange.toString(request.getIdSet()))
             .build();
     }
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java
index f7c488a..3d88813 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java
@@ -58,11 +58,11 @@ public class MyRightsProcessor extends AbstractMailboxProcessor<MyRightsRequest>
     }
 
     @Override
-    protected void processRequest(MyRightsRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(MyRightsRequest request, ImapSession session, Responder responder) {
 
         final MailboxManager mailboxManager = getMailboxManager();
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
-        final String mailboxName = message.getMailboxName();
+        final String mailboxName = request.getMailboxName();
         try {
 
             MailboxPath mailboxPath = PathConverter.forSession(session).buildFullPath(mailboxName);
@@ -89,19 +89,19 @@ public class MyRightsProcessor extends AbstractMailboxProcessor<MyRightsRequest>
                     && !myRights.contains(MailboxACL.Right.CreateMailbox)
                     && !myRights.contains(MailboxACL.Right.DeleteMailbox)
                     && !myRights.contains(MailboxACL.Right.Administer)) {
-                no(message, responder, HumanReadableText.MAILBOX_NOT_FOUND);
+                no(request, responder, HumanReadableText.MAILBOX_NOT_FOUND);
             } else {
                 MyRightsResponse myRightsResponse = new MyRightsResponse(mailboxName, myRights);
                 responder.respond(myRightsResponse);
-                okComplete(message, responder);
+                okComplete(request, responder);
                 // FIXME should we send unsolicited responses here?
                 // unsolicitedResponses(session, responder, false);
             }
         } catch (MailboxNotFoundException e) {
-            no(message, responder, HumanReadableText.MAILBOX_NOT_FOUND);
+            no(request, responder, HumanReadableText.MAILBOX_NOT_FOUND);
         } catch (MailboxException e) {
-            LOGGER.error("{} failed for mailbox {}", message.getCommand().getName(), mailboxName, e);
-            no(message, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
+            LOGGER.error("{} failed for mailbox {}", request.getCommand().getName(), mailboxName, e);
+            no(request, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
 
     }
@@ -112,10 +112,10 @@ public class MyRightsProcessor extends AbstractMailboxProcessor<MyRightsRequest>
     }
 
     @Override
-    protected Closeable addContextToMDC(MyRightsRequest message) {
+    protected Closeable addContextToMDC(MyRightsRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "MYRIGHTS")
-            .addContext("mailbox", message.getMailboxName())
+            .addContext("mailbox", request.getMailboxName())
             .build();
     }
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/NamespaceProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/NamespaceProcessor.java
index eed4a6b..b0b5a04 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/NamespaceProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/NamespaceProcessor.java
@@ -109,7 +109,7 @@ public class NamespaceProcessor extends AbstractMailboxProcessor<NamespaceReques
     }
 
     @Override
-    protected Closeable addContextToMDC(NamespaceRequest message) {
+    protected Closeable addContextToMDC(NamespaceRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "NAMESPACE")
             .build();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/NoopProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/NoopProcessor.java
index 35a59e9..e66015a 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/NoopProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/NoopProcessor.java
@@ -37,10 +37,10 @@ public class NoopProcessor extends AbstractMailboxProcessor<NoopRequest> {
     }
 
     @Override
-    protected void processRequest(NoopRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(NoopRequest request, ImapSession session, Responder responder) {
         // So, unsolicated responses are returned to check for new mail
         unsolicitedResponses(session, responder, false);
-        okComplete(message, responder);
+        okComplete(request, responder);
     }
 
     @Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/RenameProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/RenameProcessor.java
index 0721035..8d464fc 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/RenameProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/RenameProcessor.java
@@ -80,11 +80,11 @@ public class RenameProcessor extends AbstractMailboxProcessor<RenameRequest> {
     }
 
     @Override
-    protected Closeable addContextToMDC(RenameRequest message) {
+    protected Closeable addContextToMDC(RenameRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "RENAME")
-            .addContext("existingName", message.getExistingName())
-            .addContext("newName", message.getNewName())
+            .addContext("existingName", request.getExistingName())
+            .addContext("newName", request.getNewName())
             .build();
     }
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/SearchProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/SearchProcessor.java
index 2953148..9750c6a 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/SearchProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/SearchProcessor.java
@@ -503,11 +503,11 @@ public class SearchProcessor extends AbstractMailboxProcessor<SearchRequest> imp
     }
 
     @Override
-    protected Closeable addContextToMDC(SearchRequest message) {
+    protected Closeable addContextToMDC(SearchRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "SEARCH")
-            .addContext("useUid", message.isUseUids())
-            .addContext("searchOperation", message.getSearchOperation())
+            .addContext("useUid", request.isUseUids())
+            .addContext("searchOperation", request.getSearchOperation())
             .build();
     }
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java
index e34f96b..25d2ead 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java
@@ -60,17 +60,17 @@ public class SetACLProcessor extends AbstractMailboxProcessor<SetACLRequest> imp
     }
 
     @Override
-    protected void processRequest(SetACLRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(SetACLRequest request, ImapSession session, Responder responder) {
 
         final MailboxManager mailboxManager = getMailboxManager();
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
-        final String mailboxName = message.getMailboxName();
-        final String identifier = message.getIdentifier();
+        final String mailboxName = request.getMailboxName();
+        final String identifier = request.getIdentifier();
         try {
             
             /* parsing the rights is the the cheapest thing to begin with */
             EditMode editMode = EditMode.REPLACE;
-            String rights = message.getRights();
+            String rights = request.getRights();
             if (rights != null && rights.length() > 0) {
                 switch (rights.charAt(0)) {
                 case MailboxACL.ADD_RIGHTS_MARKER:
@@ -100,16 +100,16 @@ public class SetACLProcessor extends AbstractMailboxProcessor<SetACLRequest> imp
              * existence information, much less the mailbox’s ACL.
              */
             if (!mailboxManager.hasRight(mailboxPath, MailboxACL.Right.Lookup, mailboxSession)) {
-                no(message, responder, HumanReadableText.MAILBOX_NOT_FOUND);
+                no(request, responder, HumanReadableText.MAILBOX_NOT_FOUND);
             } else if (!mailboxManager.hasRight(mailboxPath, MailboxACL.Right.Administer, mailboxSession)) {
                 /* RFC 4314 section 4. */
                 Object[] params = new Object[] {
                         MailboxACL.Right.Administer.toString(),
-                        message.getCommand().getName(),
+                        request.getCommand().getName(),
                         mailboxName
                 };
                 HumanReadableText text = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
-                no(message, responder, text);
+                no(request, responder, text);
             } else {
                 
                 EntryKey key = EntryKey.deserialize(identifier);
@@ -128,7 +128,7 @@ public class SetACLProcessor extends AbstractMailboxProcessor<SetACLRequest> imp
                     MailboxACL.command().key(key).mode(editMode).rights(mailboxAclRights).build(),
                     mailboxSession);
 
-                okComplete(message, responder);
+                okComplete(request, responder);
                 // FIXME should we send unsolicited responses here?
                 // unsolicitedResponses(session, responder, false);
             }
@@ -141,12 +141,12 @@ public class SetACLProcessor extends AbstractMailboxProcessor<SetACLRequest> imp
              * */
             Object[] params = new Object[] {e.getUnsupportedRight()};
             HumanReadableText text = new HumanReadableText(HumanReadableText.UNSUPPORTED_RIGHT_KEY, HumanReadableText.UNSUPPORTED_RIGHT_DEFAULT_VALUE, params);
-            taggedBad(message, responder, text);
+            taggedBad(request, responder, text);
         } catch (MailboxNotFoundException e) {
-            no(message, responder, HumanReadableText.MAILBOX_NOT_FOUND);
+            no(request, responder, HumanReadableText.MAILBOX_NOT_FOUND);
         } catch (MailboxException e) {
-            LOGGER.error("{} failed for mailbox {}", message.getCommand().getName(), mailboxName, e);
-            no(message, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
+            LOGGER.error("{} failed for mailbox {}", request.getCommand().getName(), mailboxName, e);
+            no(request, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
 
     }
@@ -157,12 +157,12 @@ public class SetACLProcessor extends AbstractMailboxProcessor<SetACLRequest> imp
     }
 
     @Override
-    protected Closeable addContextToMDC(SetACLRequest message) {
+    protected Closeable addContextToMDC(SetACLRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "SET_ACL")
-            .addContext("mailbox", message.getMailboxName())
-            .addContext("identifier", message.getIdentifier())
-            .addContext("rights", message.getRights())
+            .addContext("mailbox", request.getMailboxName())
+            .addContext("identifier", request.getIdentifier())
+            .addContext("rights", request.getRights())
             .build();
     }
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetAnnotationProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetAnnotationProcessor.java
index e812b71..630799f 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetAnnotationProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetAnnotationProcessor.java
@@ -58,34 +58,34 @@ public class SetAnnotationProcessor extends AbstractMailboxProcessor<SetAnnotati
     }
 
     @Override
-    protected void processRequest(SetAnnotationRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(SetAnnotationRequest request, ImapSession session, Responder responder) {
         final MailboxManager mailboxManager = getMailboxManager();
         final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
-        final String mailboxName = message.getMailboxName();
+        final String mailboxName = request.getMailboxName();
         try {
             MailboxPath mailboxPath = PathConverter.forSession(session).buildFullPath(mailboxName);
 
-            mailboxManager.updateAnnotations(mailboxPath, mailboxSession, message.getMailboxAnnotations());
+            mailboxManager.updateAnnotations(mailboxPath, mailboxSession, request.getMailboxAnnotations());
 
-            okComplete(message, responder);
+            okComplete(request, responder);
         } catch (MailboxNotFoundException e) {
-            LOGGER.info("{} failed for mailbox {}", message.getCommand().getName(), mailboxName, e);
-            no(message, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX, StatusResponse.ResponseCode.tryCreate());
+            LOGGER.info("{} failed for mailbox {}", request.getCommand().getName(), mailboxName, e);
+            no(request, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX, StatusResponse.ResponseCode.tryCreate());
         } catch (AnnotationException e) {
-            LOGGER.info("{} failed for mailbox {}", message.getCommand().getName(), mailboxName, e);
-            no(message, responder, new HumanReadableText(HumanReadableText.MAILBOX_ANNOTATION_KEY, e.getMessage()));
+            LOGGER.info("{} failed for mailbox {}", request.getCommand().getName(), mailboxName, e);
+            no(request, responder, new HumanReadableText(HumanReadableText.MAILBOX_ANNOTATION_KEY, e.getMessage()));
         } catch (MailboxException e) {
-            LOGGER.error("{} failed for mailbox {}", message.getCommand().getName(), mailboxName, e);
-            no(message, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
+            LOGGER.error("{} failed for mailbox {}", request.getCommand().getName(), mailboxName, e);
+            no(request, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
     }
 
     @Override
-    protected Closeable addContextToMDC(SetAnnotationRequest message) {
+    protected Closeable addContextToMDC(SetAnnotationRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "SET_ANNOTATION")
-            .addContext("mailbox", message.getMailboxName())
-            .addContext("annotations", message.getMailboxAnnotations())
+            .addContext("mailbox", request.getMailboxName())
+            .addContext("annotations", request.getMailboxAnnotations())
             .build();
     }
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetQuotaProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetQuotaProcessor.java
index f99acb7..3601b64 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetQuotaProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetQuotaProcessor.java
@@ -50,22 +50,22 @@ public class SetQuotaProcessor extends AbstractMailboxProcessor<SetQuotaRequest>
     }
 
     @Override
-    protected void processRequest(SetQuotaRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(SetQuotaRequest request, ImapSession session, Responder responder) {
         Object[] params = new Object[]{
             "Full admin rights",
-            message.getCommand().getName(),
+            request.getCommand().getName(),
             "Can not perform SETQUOTA commands"
         };
         HumanReadableText humanReadableText = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
-        no(message, responder, humanReadableText);
+        no(request, responder, humanReadableText);
     }
 
     @Override
-    protected Closeable addContextToMDC(SetQuotaRequest message) {
+    protected Closeable addContextToMDC(SetQuotaRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "SET_QUOTA")
-            .addContext("quotaRoot", message.getQuotaRoot())
-            .addContext("limits", message.getResourceLimits())
+            .addContext("quotaRoot", request.getQuotaRoot())
+            .addContext("limits", request.getResourceLimits())
             .build();
     }
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/StatusProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/StatusProcessor.java
index 4752e4d..f067be9 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/StatusProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/StatusProcessor.java
@@ -148,11 +148,11 @@ public class StatusProcessor extends AbstractMailboxProcessor<StatusRequest> {
     }
 
     @Override
-    protected Closeable addContextToMDC(StatusRequest message) {
+    protected Closeable addContextToMDC(StatusRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "STATUS")
-            .addContext("mailbox", message.getMailboxName())
-            .addContext("parameters", message.getStatusDataItems())
+            .addContext("mailbox", request.getMailboxName())
+            .addContext("parameters", request.getStatusDataItems())
             .build();
     }
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/UnselectProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/UnselectProcessor.java
index ac80507..5253f33 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/UnselectProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/UnselectProcessor.java
@@ -47,12 +47,12 @@ public class UnselectProcessor extends AbstractMailboxProcessor<UnselectRequest>
     }
 
     @Override
-    protected void processRequest(UnselectRequest message, ImapSession session, Responder responder) {
+    protected void processRequest(UnselectRequest request, ImapSession session, Responder responder) {
         if (session.getSelected() != null) {
             session.deselect();
-            okComplete(message, responder);
+            okComplete(request, responder);
         } else {
-            taggedBad(message, responder, HumanReadableText.UNSELECT);
+            taggedBad(request, responder, HumanReadableText.UNSELECT);
         }
 
     }
@@ -63,7 +63,7 @@ public class UnselectProcessor extends AbstractMailboxProcessor<UnselectRequest>
     }
 
     @Override
-    protected Closeable addContextToMDC(UnselectRequest message) {
+    protected Closeable addContextToMDC(UnselectRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "UNSELECT")
             .build();
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java
index f257580..dd7c52b 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java
@@ -239,12 +239,12 @@ public class FetchProcessor extends AbstractMailboxProcessor<FetchRequest> {
     }
 
     @Override
-    protected Closeable addContextToMDC(FetchRequest message) {
+    protected Closeable addContextToMDC(FetchRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "FETCH")
-            .addContext("useUid", message.isUseUids())
-            .addContext("idSet", IdRange.toString(message.getIdSet()))
-            .addContext("fetchedData", message.getFetch())
+            .addContext("useUid", request.isUseUids())
+            .addContext("idSet", IdRange.toString(request.getIdSet()))
+            .addContext("fetchedData", request.getFetch())
             .build();
     }
 }


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


[james-project] 28/30: [Refactoring] finally drop {un, }lock methods from MailRepository interface

Posted by bt...@apache.org.
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 35fbc89dcde2b3e50ef73aae9031d86cafba2db1
Author: Matthieu Baechler <ma...@apache.org>
AuthorDate: Wed Nov 13 16:38:46 2019 +0100

    [Refactoring] finally drop {un,}lock methods from MailRepository interface
---
 .../james/mailrepository/file/FileMailRepository.java  |  6 ++----
 .../james/mailrepository/jdbc/JDBCMailRepository.java  | 18 ------------------
 .../james/mailrepository/api/MailRepository.java       | 11 -----------
 .../cassandra/CassandraMailRepository.java             | 10 ----------
 .../mailrepository/memory/MemoryMailRepository.java    | 11 +----------
 5 files changed, 3 insertions(+), 53 deletions(-)

diff --git a/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java b/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java
index 93107f8..ee55188 100644
--- a/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java
+++ b/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java
@@ -98,8 +98,7 @@ public class FileMailRepository implements MailRepository, Configurable, Initial
      *
      * @return true if successfully released the lock, false otherwise
      */
-    @Override
-    public boolean unlock(MailKey key) {
+    private boolean unlock(MailKey key) {
         return accessControlLock.unlock(key);
     }
 
@@ -111,8 +110,7 @@ public class FileMailRepository implements MailRepository, Configurable, Initial
      *
      * @return true if successfully obtained the lock, false otherwise
      */
-    @Override
-    public boolean lock(MailKey key) {
+    private boolean lock(MailKey key) {
         return accessControlLock.lock(key);
     }
 
diff --git a/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java b/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java
index 6c1c06f..ac64737 100644
--- a/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java
+++ b/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java
@@ -219,24 +219,6 @@ public class JDBCMailRepository implements MailRepository, Configurable, Initial
 
     }
 
-
-    /**
-     * JDBC uses transaction, it doesn't need locks
-     */
-    @Override
-    public boolean unlock(MailKey key) {
-        return false;
-    }
-
-    /**
-     * JDBC uses transaction, it doesn't need locks
-     */
-    @Override
-    public boolean lock(MailKey key) {
-        return false;
-    }
-
-
     /**
      * Initialises the JDBC repository.
      * <ol>
diff --git a/server/mailrepository/mailrepository-api/src/main/java/org/apache/james/mailrepository/api/MailRepository.java b/server/mailrepository/mailrepository-api/src/main/java/org/apache/james/mailrepository/api/MailRepository.java
index b20d8b0..113dc7e 100644
--- a/server/mailrepository/mailrepository-api/src/main/java/org/apache/james/mailrepository/api/MailRepository.java
+++ b/server/mailrepository/mailrepository-api/src/main/java/org/apache/james/mailrepository/api/MailRepository.java
@@ -96,15 +96,4 @@ public interface MailRepository {
      */
     void removeAll() throws MessagingException;
 
-    /**
-     * @deprecated This method is implementation dependent, it has been moved to org.apache.james.mailrepository.lib.AbstractMailRepository
-     */
-    @Deprecated
-    boolean lock(MailKey key) throws MessagingException;
-
-    /**
-     * @deprecated This method is implementation dependent, it has been moved to org.apache.james.mailrepository.lib.AbstractMailRepository
-     */
-    @Deprecated
-    boolean unlock(MailKey key) throws MessagingException;
 }
diff --git a/server/mailrepository/mailrepository-cassandra/src/main/java/org/apache/james/mailrepository/cassandra/CassandraMailRepository.java b/server/mailrepository/mailrepository-cassandra/src/main/java/org/apache/james/mailrepository/cassandra/CassandraMailRepository.java
index 277c39d..bbaf01f 100644
--- a/server/mailrepository/mailrepository-cassandra/src/main/java/org/apache/james/mailrepository/cassandra/CassandraMailRepository.java
+++ b/server/mailrepository/mailrepository-cassandra/src/main/java/org/apache/james/mailrepository/cassandra/CassandraMailRepository.java
@@ -154,14 +154,4 @@ public class CassandraMailRepository implements MailRepository {
             .then()
             .block();
     }
-
-    @Override
-    public boolean lock(MailKey key) {
-        return false;
-    }
-
-    @Override
-    public boolean unlock(MailKey key) {
-        return false;
-    }
 }
diff --git a/server/mailrepository/mailrepository-memory/src/main/java/org/apache/james/mailrepository/memory/MemoryMailRepository.java b/server/mailrepository/mailrepository-memory/src/main/java/org/apache/james/mailrepository/memory/MemoryMailRepository.java
index 6df4dee..d21adcb 100644
--- a/server/mailrepository/mailrepository-memory/src/main/java/org/apache/james/mailrepository/memory/MemoryMailRepository.java
+++ b/server/mailrepository/mailrepository-memory/src/main/java/org/apache/james/mailrepository/memory/MemoryMailRepository.java
@@ -23,6 +23,7 @@ import java.util.Collection;
 import java.util.Iterator;
 import java.util.Optional;
 import java.util.concurrent.ConcurrentHashMap;
+
 import javax.mail.MessagingException;
 
 import org.apache.james.mailrepository.api.MailKey;
@@ -72,16 +73,6 @@ public class MemoryMailRepository implements MailRepository {
     }
 
     @Override
-    public boolean lock(MailKey key) {
-        return false;
-    }
-
-    @Override
-    public boolean unlock(MailKey key) {
-        return false;
-    }
-
-    @Override
     public long size() {
         return mails.size();
     }


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


[james-project] 23/30: [Refactoring] move code from AbstractMailRepository to FileMailRepository

Posted by bt...@apache.org.
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 071c8c324ce0d533888b1ae917bb90fe93a7292a
Author: Matthieu Baechler <ma...@apache.org>
AuthorDate: Wed Nov 13 16:20:49 2019 +0100

    [Refactoring] move code from AbstractMailRepository to FileMailRepository
---
 .../mailrepository/file/FileMailRepository.java    | 123 +++++++++++++++-
 .../mailrepository/lib/AbstractMailRepository.java | 164 ---------------------
 2 files changed, 117 insertions(+), 170 deletions(-)

diff --git a/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java b/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java
index 6ff41f8..98c6835 100644
--- a/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java
+++ b/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java
@@ -37,8 +37,11 @@ import org.apache.commons.configuration2.BaseHierarchicalConfiguration;
 import org.apache.commons.configuration2.HierarchicalConfiguration;
 import org.apache.commons.configuration2.tree.ImmutableNode;
 import org.apache.james.filesystem.api.FileSystem;
+import org.apache.james.lifecycle.api.Configurable;
 import org.apache.james.mailrepository.api.MailKey;
-import org.apache.james.mailrepository.lib.AbstractMailRepository;
+import org.apache.james.mailrepository.api.MailRepository;
+import org.apache.james.mailrepository.lib.Lock;
+import org.apache.james.repository.api.Initializable;
 import org.apache.james.repository.file.FilePersistentObjectRepository;
 import org.apache.james.repository.file.FilePersistentStreamRepository;
 import org.apache.james.server.core.MimeMessageCopyOnWriteProxy;
@@ -47,6 +50,10 @@ import org.apache.mailet.Mail;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.github.fge.lambdas.Throwing;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterators;
+
 /**
  * <p>
  * Implementation of a MailRepository on a FileSystem.
@@ -63,9 +70,16 @@ import org.slf4j.LoggerFactory;
  * Requires a logger called MailRepository.
  * </p>
  */
-public class FileMailRepository extends AbstractMailRepository {
+public class FileMailRepository implements MailRepository, Configurable, Initializable {
     private static final Logger LOGGER = LoggerFactory.getLogger(FileMailRepository.class);
 
+
+    /**
+     * Whether 'deep debugging' is turned on.
+     */
+    private static final boolean DEEP_DEBUG = false;
+
+
     private FilePersistentStreamRepository streamRepository;
     private FilePersistentObjectRepository objectRepository;
     private String destination;
@@ -76,14 +90,46 @@ public class FileMailRepository extends AbstractMailRepository {
     // repositories such as spam and error
     private FileSystem fileSystem;
 
+    /**
+     * A lock used to control access to repository elements, locking access
+     * based on the key
+     */
+    private final Lock accessControlLock = new Lock();
+
+    /**
+     * Releases a lock on a message identified the key
+     *
+     * @param key
+     *            the key of the message to be unlocked
+     *
+     * @return true if successfully released the lock, false otherwise
+     */
+    @Override
+    public boolean unlock(MailKey key) {
+        return accessControlLock.unlock(key);
+    }
+
+    /**
+     * Obtains a lock on a message identified by key
+     *
+     * @param key
+     *            the key of the message to be locked
+     *
+     * @return true if successfully obtained the lock, false otherwise
+     */
+    @Override
+    public boolean lock(MailKey key) {
+        return accessControlLock.lock(key);
+    }
+
+
     @Inject
     public void setFileSystem(FileSystem fileSystem) {
         this.fileSystem = fileSystem;
     }
 
     @Override
-    protected void doConfigure(HierarchicalConfiguration<ImmutableNode> config) throws org.apache.commons.configuration2.ex.ConfigurationException {
-        super.doConfigure(config);
+    public void configure(HierarchicalConfiguration<ImmutableNode> config) {
         destination = config.getString("[@destinationURL]");
         LOGGER.debug("FileMailRepository.destinationURL: {}", destination);
         fifo = config.getBoolean("[@FIFO]", false);
@@ -154,7 +200,37 @@ public class FileMailRepository extends AbstractMailRepository {
     }
 
     @Override
-    protected void internalStore(Mail mc) throws MessagingException, IOException {
+    public MailKey store(Mail mc) throws MessagingException {
+        boolean wasLocked = true;
+        MailKey key = MailKey.forMail(mc);
+        try {
+            synchronized (this) {
+                wasLocked = accessControlLock.isLocked(key);
+                if (!wasLocked) {
+                    // If it wasn't locked, we want a lock during the store
+                    lock(key);
+                }
+            }
+            internalStore(mc);
+            return key;
+        } catch (MessagingException e) {
+            LOGGER.error("Exception caught while storing mail {}", key, e);
+            throw e;
+        } catch (Exception e) {
+            LOGGER.error("Exception caught while storing mail {}", key, e);
+            throw new MessagingException("Exception caught while storing mail " + key, e);
+        } finally {
+            if (!wasLocked) {
+                // If it wasn't locked, we need to unlock now
+                unlock(key);
+                synchronized (this) {
+                    notify();
+                }
+            }
+        }
+    }
+
+    private void internalStore(Mail mc) throws MessagingException, IOException {
         String key = mc.getName();
         if (keys != null && !keys.contains(key)) {
             keys.add(key);
@@ -245,7 +321,42 @@ public class FileMailRepository extends AbstractMailRepository {
     }
 
     @Override
-    protected void internalRemove(MailKey key) throws MessagingException {
+    public void remove(Mail mail) throws MessagingException {
+        remove(MailKey.forMail(mail));
+    }
+
+    @Override
+    public void remove(Collection<Mail> mails) throws MessagingException {
+        for (Mail mail : mails) {
+            remove(mail);
+        }
+    }
+
+    @Override
+    public void remove(MailKey key) throws MessagingException {
+        if (lock(key)) {
+            try {
+                internalRemove(key);
+            } finally {
+                unlock(key);
+            }
+        } else {
+            throw new MessagingException("Cannot lock " + key + " to remove it");
+        }
+    }
+
+    @Override
+    public long size() {
+        return Iterators.size(list());
+    }
+
+    @Override
+    public void removeAll() {
+        ImmutableList.copyOf(list())
+            .forEach(Throwing.<MailKey>consumer(this::remove).sneakyThrow());
+    }
+
+    private void internalRemove(MailKey key) {
         if (keys != null) {
             keys.remove(key.asString());
         }
diff --git a/server/data/data-library/src/main/java/org/apache/james/mailrepository/lib/AbstractMailRepository.java b/server/data/data-library/src/main/java/org/apache/james/mailrepository/lib/AbstractMailRepository.java
deleted file mode 100644
index ecf7d46..0000000
--- a/server/data/data-library/src/main/java/org/apache/james/mailrepository/lib/AbstractMailRepository.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/****************************************************************
- * 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.mailrepository.lib;
-
-import java.io.IOException;
-import java.util.Collection;
-
-import javax.mail.MessagingException;
-
-import org.apache.commons.configuration2.HierarchicalConfiguration;
-import org.apache.commons.configuration2.ex.ConfigurationException;
-import org.apache.commons.configuration2.tree.ImmutableNode;
-import org.apache.james.lifecycle.api.Configurable;
-import org.apache.james.mailrepository.api.MailKey;
-import org.apache.james.mailrepository.api.MailRepository;
-import org.apache.james.repository.api.Initializable;
-import org.apache.mailet.Mail;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.github.fge.lambdas.Throwing;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterators;
-
-/**
- * This class represents an AbstractMailRepository that may help implementing MailRepository interface
- */
-public abstract class AbstractMailRepository implements MailRepository, Configurable, Initializable {
-    private static final Logger LOGGER = LoggerFactory.getLogger(AbstractMailRepository.class);
-
-    /**
-     * Whether 'deep debugging' is turned on.
-     */
-    protected static final boolean DEEP_DEBUG = false;
-
-    /**
-     * A lock used to control access to repository elements, locking access
-     * based on the key
-     */
-    private final Lock lock = new Lock();
-
-    @Override
-    public void configure(HierarchicalConfiguration<ImmutableNode> configuration) throws ConfigurationException {
-        doConfigure(configuration);
-    }
-
-    protected void doConfigure(HierarchicalConfiguration<ImmutableNode> config) throws ConfigurationException {
-
-    }
-
-    /**
-     * Releases a lock on a message identified the key
-     * 
-     * @param key
-     *            the key of the message to be unlocked
-     * 
-     * @return true if successfully released the lock, false otherwise
-     */
-    @Override
-    public boolean unlock(MailKey key) {
-        return lock.unlock(key);
-    }
-
-    /**
-     * Obtains a lock on a message identified by key
-     * 
-     * @param key
-     *            the key of the message to be locked
-     * 
-     * @return true if successfully obtained the lock, false otherwise
-     */
-    @Override
-    public boolean lock(MailKey key) {
-        return lock.lock(key);
-    }
-
-    @Override
-    public MailKey store(Mail mc) throws MessagingException {
-        boolean wasLocked = true;
-        MailKey key = MailKey.forMail(mc);
-        try {
-            synchronized (this) {
-                wasLocked = lock.isLocked(key);
-                if (!wasLocked) {
-                    // If it wasn't locked, we want a lock during the store
-                    lock(key);
-                }
-            }
-            internalStore(mc);
-            return key;
-        } catch (MessagingException e) {
-            LOGGER.error("Exception caught while storing mail {}", key, e);
-            throw e;
-        } catch (Exception e) {
-            LOGGER.error("Exception caught while storing mail {}", key, e);
-            throw new MessagingException("Exception caught while storing mail " + key, e);
-        } finally {
-            if (!wasLocked) {
-                // If it wasn't locked, we need to unlock now
-                unlock(key);
-                synchronized (this) {
-                    notify();
-                }
-            }
-        }
-    }
-
-    protected abstract void internalStore(Mail mc) throws MessagingException, IOException;
-
-    @Override
-    public void remove(Mail mail) throws MessagingException {
-        remove(MailKey.forMail(mail));
-    }
-
-    @Override
-    public void remove(Collection<Mail> mails) throws MessagingException {
-        for (Mail mail : mails) {
-            remove(mail);
-        }
-    }
-
-    @Override
-    public void remove(MailKey key) throws MessagingException {
-        if (lock(key)) {
-            try {
-                internalRemove(key);
-            } finally {
-                unlock(key);
-            }
-        } else {
-            throw new MessagingException("Cannot lock " + key + " to remove it");
-        }
-    }
-
-    protected abstract void internalRemove(MailKey key) throws MessagingException;
-
-    @Override
-    public long size() throws MessagingException {
-        return Iterators.size(list());
-    }
-
-    @Override
-    public void removeAll() throws MessagingException {
-        ImmutableList.copyOf(list())
-            .forEach(Throwing.<MailKey>consumer(this::remove).sneakyThrow());
-    }
-}


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


[james-project] 10/30: [Refactoring] Merge some AbstractMailboxProcessor process methods

Posted by bt...@apache.org.
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 d091eb37676d61cc7457b7c16aaa9ba1c9fbf4c7
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Nov 11 12:41:54 2019 +0700

    [Refactoring] Merge some AbstractMailboxProcessor process methods
---
 .../imap/processor/AbstractMailboxProcessor.java   | 29 ++++++----------------
 1 file changed, 7 insertions(+), 22 deletions(-)

diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
index 53b114f..e212b26 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
@@ -28,10 +28,8 @@ import java.util.stream.Stream;
 
 import javax.mail.Flags;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.IdRange;
 import org.apache.james.imap.api.message.UidRange;
@@ -88,41 +86,28 @@ public abstract class AbstractMailboxProcessor<M extends ImapRequest> extends Ab
 
     @Override
     protected final void doProcess(M acceptableMessage, Responder responder, ImapSession session) {
-        process(acceptableMessage, responder, session);
-    }
-
-    protected final void process(M message, Responder responder, ImapSession session) {
-        ImapCommand command = message.getCommand();
-        Tag tag = message.getTag();
-
-        TimeMetric timeMetric = metricFactory.timer(IMAP_PREFIX + command.getName());
-        doProcess(message, command, tag, responder, session);
-        timeMetric.stopAndPublish();
-    }
-
-    final void doProcess(M message, ImapCommand command, Tag tag, Responder responder, ImapSession session) {
+        TimeMetric timeMetric = metricFactory.timer(IMAP_PREFIX + acceptableMessage.getCommand().getName());
         try {
-            if (!command.validForState(session.getState())) {
-                ImapResponseMessage response = factory.taggedNo(tag, command, HumanReadableText.INVALID_COMMAND);
+            if (!acceptableMessage.getCommand().validForState(session.getState())) {
+                ImapResponseMessage response = factory.taggedNo(acceptableMessage.getTag(), acceptableMessage.getCommand(), HumanReadableText.INVALID_COMMAND);
                 responder.respond(response);
 
             } else {
                 getMailboxManager().startProcessingRequest(ImapSessionUtils.getMailboxSession(session));
 
-                processMessage(message, session, responder);
+                processMessage(acceptableMessage, session, responder);
 
                 getMailboxManager().endProcessingRequest(ImapSessionUtils.getMailboxSession(session));
-
             }
         } catch (DeniedAccessOnSharedMailboxException e) {
-            no(message, responder, HumanReadableText.DENIED_SHARED_MAILBOX);
+            no(acceptableMessage, responder, HumanReadableText.DENIED_SHARED_MAILBOX);
         } catch (Exception unexpectedException) {
             LOGGER.error("Unexpected error during IMAP processing", unexpectedException);
-            no(message, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
+            no(acceptableMessage, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
+        timeMetric.stopAndPublish();
     }
 
-
     protected void flags(Responder responder, SelectedMailbox selected) {
         responder.respond(new FlagsResponse(selected.getApplicableFlags()));
     }


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


[james-project] 02/30: JAMES-2704 Improve ReroutingInformation

Posted by bt...@apache.org.
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 9ab4f5124140d7ebb478a582e803342b2759d45f
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Wed Nov 6 16:56:18 2019 +0700

    JAMES-2704 Improve ReroutingInformation
    
     - The class should be static
     - MailAddress and User represent duplicated information
     - user should be strongly typed
---
 .../james/transport/mailets/RandomStoring.java     | 37 ++++++++--------------
 1 file changed, 14 insertions(+), 23 deletions(-)

diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RandomStoring.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RandomStoring.java
index adac9e4..2c56f6f 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RandomStoring.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RandomStoring.java
@@ -42,6 +42,7 @@ import org.apache.mailet.Attribute;
 import org.apache.mailet.Mail;
 import org.apache.mailet.base.GenericMailet;
 
+import com.github.fge.lambdas.Throwing;
 import com.github.steveash.guavate.Guavate;
 import com.google.common.base.MoreObjects;
 import com.google.common.collect.Streams;
@@ -75,12 +76,12 @@ public class RandomStoring extends GenericMailet {
         Collection<ReroutingInfos> reroutingInfos = generateRandomMailboxes();
         Collection<MailAddress> mailAddresses = reroutingInfos
             .stream()
-            .map(ReroutingInfos::getMailAddress)
+            .map(Throwing.function(info -> info.getUser().asMailAddress()))
             .collect(Guavate.toImmutableList());
 
         mail.setRecipients(mailAddresses);
         reroutingInfos.forEach(reroutingInfo ->
-            mail.setAttribute(Attribute.convertToAttribute(MailStore.DELIVERY_PATH_PREFIX + reroutingInfo.getUser(), reroutingInfo.getMailbox())));
+            mail.setAttribute(Attribute.convertToAttribute(MailStore.DELIVERY_PATH_PREFIX + reroutingInfo.getUser().asString(), reroutingInfo.getMailbox())));
     }
 
     @Override
@@ -114,39 +115,31 @@ public class RandomStoring extends GenericMailet {
 
     private Stream<ReroutingInfos> buildReRoutingInfos(Username username) {
         try {
-            MailAddress mailAddress = usersRepository.getMailAddressFor(username);
-
             MailboxSession session = mailboxManager.createSystemSession(username.asString());
             return mailboxManager
                 .search(MailboxQuery.privateMailboxesBuilder(session).build(), session)
                 .stream()
-                .map(metaData -> new ReroutingInfos(mailAddress, metaData.getPath().getName(), username.asString()));
+                .map(metaData -> new ReroutingInfos(metaData.getPath().getName(), username));
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
     }
 
-    private class ReroutingInfos {
-        private final MailAddress mailAddress;
+    private static class ReroutingInfos {
         private final String mailbox;
-        private final String user;
+        private final Username username;
 
-        ReroutingInfos(MailAddress mailAddress, String mailbox, String user) {
-            this.mailAddress = mailAddress;
+        ReroutingInfos(String mailbox, Username username) {
             this.mailbox = mailbox;
-            this.user = user;
-        }
-
-        public MailAddress getMailAddress() {
-            return mailAddress;
+            this.username = username;
         }
 
         public String getMailbox() {
             return mailbox;
         }
 
-        public String getUser() {
-            return user;
+        public Username getUser() {
+            return username;
         }
 
         @Override
@@ -154,24 +147,22 @@ public class RandomStoring extends GenericMailet {
             if (o instanceof ReroutingInfos) {
                 ReroutingInfos that = (ReroutingInfos) o;
 
-                return Objects.equals(this.mailAddress, that.mailAddress)
-                    && Objects.equals(this.mailbox, that.mailbox)
-                    && Objects.equals(this.user, that.user);
+                return Objects.equals(this.mailbox, that.mailbox)
+                    && Objects.equals(this.username, that.username);
             }
             return false;
         }
 
         @Override
         public int hashCode() {
-            return Objects.hash(mailAddress, mailbox, user);
+            return Objects.hash(mailbox, username);
         }
 
         @Override
         public String toString() {
             return MoreObjects.toStringHelper(this)
-                .add("user", mailAddress.asString())
                 .add("mailbox", mailbox)
-                .add("user", user)
+                .add("username", username)
                 .toString();
         }
     }


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


[james-project] 01/30: JAMES-2704 Solve major performance issue for RandomStoring mailet

Posted by bt...@apache.org.
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 8440e83176c84e74695d7909289a151a6a870c13
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Wed Nov 6 16:53:40 2019 +0700

    JAMES-2704 Solve major performance issue for RandomStoring mailet
    
    This mailet was unnecessarily list all mailboxes of all users, for each user.
    
    What we should do is listing all mailboxes of a user, for each user.
---
 .../java/org/apache/james/transport/mailets/RandomStoring.java     | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RandomStoring.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RandomStoring.java
index 8115a23..adac9e4 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RandomStoring.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RandomStoring.java
@@ -26,6 +26,7 @@ import java.util.Objects;
 import java.util.concurrent.ThreadLocalRandom;
 import java.util.function.Supplier;
 import java.util.stream.Stream;
+
 import javax.inject.Inject;
 import javax.mail.MessagingException;
 
@@ -33,6 +34,7 @@ import org.apache.james.core.MailAddress;
 import org.apache.james.core.Username;
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxSession;
+import org.apache.james.mailbox.model.search.MailboxQuery;
 import org.apache.james.transport.mailets.delivery.MailStore;
 import org.apache.james.user.api.UsersRepository;
 import org.apache.james.user.api.UsersRepositoryException;
@@ -43,6 +45,7 @@ import org.apache.mailet.base.GenericMailet;
 import com.github.steveash.guavate.Guavate;
 import com.google.common.base.MoreObjects;
 import com.google.common.collect.Streams;
+
 import reactor.core.publisher.Mono;
 
 /**
@@ -115,9 +118,9 @@ public class RandomStoring extends GenericMailet {
 
             MailboxSession session = mailboxManager.createSystemSession(username.asString());
             return mailboxManager
-                .list(session)
+                .search(MailboxQuery.privateMailboxesBuilder(session).build(), session)
                 .stream()
-                .map(mailboxPath -> new ReroutingInfos(mailAddress, mailboxPath.getName(), username.asString()));
+                .map(metaData -> new ReroutingInfos(mailAddress, metaData.getPath().getName(), username.asString()));
         } catch (Exception e) {
             throw new RuntimeException(e);
         }


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


[james-project] 07/30: [Refactoring] AbstractMailboxProcessor response methods should accept IMAP request

Posted by bt...@apache.org.
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 f5de467dfa278121c713dd95bf654123993517f3
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Nov 11 12:21:21 2019 +0700

    [Refactoring] AbstractMailboxProcessor response methods should accept IMAP request
    
    This limits the count of arguments
---
 .../imap/processor/AbstractAuthProcessor.java      | 26 ++++++++++------------
 .../imap/processor/AbstractMailboxProcessor.java   | 24 ++++++++++----------
 .../processor/AbstractMessageRangeProcessor.java   |  8 +++----
 .../imap/processor/AbstractSelectionProcessor.java | 19 ++++++++--------
 .../james/imap/processor/AppendProcessor.java      | 24 +++++++++-----------
 .../imap/processor/AuthenticateProcessor.java      | 15 +++++++------
 .../james/imap/processor/CapabilityProcessor.java  |  2 +-
 .../james/imap/processor/CheckProcessor.java       |  2 +-
 .../james/imap/processor/CloseProcessor.java       |  4 ++--
 .../james/imap/processor/CreateProcessor.java      |  8 +++----
 .../james/imap/processor/DeleteACLProcessor.java   | 12 +++++-----
 .../james/imap/processor/DeleteProcessor.java      |  8 +++----
 .../james/imap/processor/EnableProcessor.java      |  4 ++--
 .../james/imap/processor/ExpungeProcessor.java     | 10 ++++-----
 .../james/imap/processor/GetACLProcessor.java      | 14 ++++++------
 .../imap/processor/GetAnnotationProcessor.java     | 17 +++++++-------
 .../james/imap/processor/GetQuotaProcessor.java    |  6 ++---
 .../imap/processor/GetQuotaRootProcessor.java      |  6 ++---
 .../apache/james/imap/processor/IdleProcessor.java |  2 +-
 .../apache/james/imap/processor/LSubProcessor.java |  4 ++--
 .../apache/james/imap/processor/ListProcessor.java |  4 ++--
 .../james/imap/processor/ListRightsProcessor.java  | 10 ++++-----
 .../james/imap/processor/LoginProcessor.java       |  4 ++--
 .../james/imap/processor/LogoutProcessor.java      |  4 ++--
 .../james/imap/processor/MyRightsProcessor.java    |  8 +++----
 .../james/imap/processor/NamespaceProcessor.java   |  2 +-
 .../apache/james/imap/processor/NoopProcessor.java |  2 +-
 .../james/imap/processor/RenameProcessor.java      | 10 ++++-----
 .../james/imap/processor/SearchProcessor.java      |  6 ++---
 .../james/imap/processor/SetACLProcessor.java      | 12 +++++-----
 .../imap/processor/SetAnnotationProcessor.java     |  8 +++----
 .../james/imap/processor/SetQuotaProcessor.java    |  2 +-
 .../james/imap/processor/StatusProcessor.java      |  5 +++--
 .../james/imap/processor/StoreProcessor.java       |  8 +++----
 .../james/imap/processor/SubscribeProcessor.java   |  4 ++--
 .../james/imap/processor/UnselectProcessor.java    |  4 ++--
 .../james/imap/processor/UnsubscribeProcessor.java |  4 ++--
 .../james/imap/processor/fetch/FetchProcessor.java | 10 ++++-----
 38 files changed, 160 insertions(+), 162 deletions(-)

diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractAuthProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractAuthProcessor.java
index 58a430b..94ccf20 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractAuthProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractAuthProcessor.java
@@ -20,9 +20,7 @@ package org.apache.james.imap.processor;
 
 import java.util.Optional;
 
-import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.ImapSessionUtils;
-import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
@@ -59,7 +57,7 @@ public abstract class AbstractAuthProcessor<M extends ImapRequest> extends Abstr
         super(acceptableClass, next, mailboxManager, factory, metricFactory);
     }
 
-    protected void doAuth(AuthenticationAttempt authenticationAttempt, ImapSession session, Tag tag, ImapCommand command, Responder responder, HumanReadableText failed) {
+    protected void doAuth(AuthenticationAttempt authenticationAttempt, ImapSession session, ImapRequest request, Responder responder, HumanReadableText failed) {
         Preconditions.checkArgument(!authenticationAttempt.isDelegation());
         try {
             boolean authFailure = false;
@@ -74,21 +72,21 @@ public abstract class AbstractAuthProcessor<M extends ImapRequest> extends Abstr
                     session.authenticated();
                     session.setAttribute(ImapSessionUtils.MAILBOX_SESSION_ATTRIBUTE_SESSION_KEY, mailboxSession);
                     provisionInbox(session, mailboxManager, mailboxSession);
-                    okComplete(command, tag, responder);
+                    okComplete(request, responder);
                 } catch (BadCredentialsException e) {
                     authFailure = true;
                 }
             }
             if (authFailure) {
-                manageFailureCount(session, tag, command, responder, failed);
+                manageFailureCount(session, request, responder, failed);
             }
         } catch (MailboxException e) {
             LOGGER.error("Error encountered while login", e);
-            no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
+            no(request, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
     }
 
-    protected void doAuthWithDelegation(AuthenticationAttempt authenticationAttempt, ImapSession session, Tag tag, ImapCommand command, Responder responder, HumanReadableText failed) {
+    protected void doAuthWithDelegation(AuthenticationAttempt authenticationAttempt, ImapSession session, ImapRequest request, Responder responder, HumanReadableText failed) {
         Preconditions.checkArgument(authenticationAttempt.isDelegation());
         try {
             boolean authFailure = false;
@@ -104,23 +102,23 @@ public abstract class AbstractAuthProcessor<M extends ImapRequest> extends Abstr
                     session.authenticated();
                     session.setAttribute(ImapSessionUtils.MAILBOX_SESSION_ATTRIBUTE_SESSION_KEY, mailboxSession);
                     provisionInbox(session, mailboxManager, mailboxSession);
-                    okComplete(command, tag, responder);
+                    okComplete(request, responder);
                 } catch (BadCredentialsException e) {
                     authFailure = true;
                 }
             }
             if (authFailure) {
-                manageFailureCount(session, tag, command, responder, failed);
+                manageFailureCount(session, request, responder, failed);
             }
         } catch (UserDoesNotExistException e) {
             LOGGER.info("User {} does not exist", authenticationAttempt.getAuthenticationId(), e);
-            no(command, tag, responder, HumanReadableText.USER_DOES_NOT_EXIST);
+            no(request, responder, HumanReadableText.USER_DOES_NOT_EXIST);
         } catch (NotAdminException e) {
             LOGGER.info("User {} is not an admin", authenticationAttempt.getDelegateUserName(), e);
-            no(command, tag, responder, HumanReadableText.NOT_AN_ADMIN);
+            no(request, responder, HumanReadableText.NOT_AN_ADMIN);
         } catch (MailboxException e) {
             LOGGER.info("Login failed", e);
-            no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
+            no(request, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
     }
 
@@ -139,7 +137,7 @@ public abstract class AbstractAuthProcessor<M extends ImapRequest> extends Abstr
         }
     }
 
-    protected void manageFailureCount(ImapSession session, Tag tag, ImapCommand command, Responder responder, HumanReadableText failed) {
+    protected void manageFailureCount(ImapSession session, ImapRequest request, Responder responder, HumanReadableText failed) {
         final Integer currentNumberOfFailures = (Integer) session.getAttribute(ATTRIBUTE_NUMBER_OF_FAILURES);
         final int failures;
         if (currentNumberOfFailures == null) {
@@ -149,7 +147,7 @@ public abstract class AbstractAuthProcessor<M extends ImapRequest> extends Abstr
         }
         if (failures < MAX_FAILURES) {
             session.setAttribute(ATTRIBUTE_NUMBER_OF_FAILURES, failures);
-            no(command, tag, responder, failed);
+            no(request, responder, failed);
         } else {
             LOGGER.info("Too many authentication failures. Closing connection.");
             bye(responder, HumanReadableText.TOO_MANY_FAILURES);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
index 9134494..ffd20e6 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMailboxProcessor.java
@@ -115,10 +115,10 @@ public abstract class AbstractMailboxProcessor<M extends ImapRequest> extends Ab
 
             }
         } catch (DeniedAccessOnSharedMailboxException e) {
-            no(command, tag, responder, HumanReadableText.DENIED_SHARED_MAILBOX);
+            no(message, responder, HumanReadableText.DENIED_SHARED_MAILBOX);
         } catch (Exception unexpectedException) {
             LOGGER.error("Unexpected error during IMAP processing", unexpectedException);
-            no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
+            no(message, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
     }
 
@@ -334,28 +334,28 @@ public abstract class AbstractMailboxProcessor<M extends ImapRequest> extends Ab
         responder.respond(response);
     }
 
-    protected void okComplete(ImapCommand command, Tag tag, ImapProcessor.Responder responder) {
-        final StatusResponse response = factory.taggedOk(tag, command, HumanReadableText.COMPLETED);
+    protected void okComplete(ImapRequest request, ImapProcessor.Responder responder) {
+        final StatusResponse response = factory.taggedOk(request.getTag(), request.getCommand(), HumanReadableText.COMPLETED);
         responder.respond(response);
     }
 
-    protected void okComplete(ImapCommand command, Tag tag, ResponseCode code, ImapProcessor.Responder responder) {
-        final StatusResponse response = factory.taggedOk(tag, command, HumanReadableText.COMPLETED, code);
+    protected void okComplete(ImapRequest request,  ResponseCode code, ImapProcessor.Responder responder) {
+        final StatusResponse response = factory.taggedOk(request.getTag(), request.getCommand(), HumanReadableText.COMPLETED, code);
         responder.respond(response);
     }
 
-    protected void no(ImapCommand command, Tag tag, ImapProcessor.Responder responder, HumanReadableText displayTextKey) {
-        final StatusResponse response = factory.taggedNo(tag, command, displayTextKey);
+    protected void no(ImapRequest request, ImapProcessor.Responder responder, HumanReadableText displayTextKey) {
+        StatusResponse response = factory.taggedNo(request.getTag(), request.getCommand(), displayTextKey);
         responder.respond(response);
     }
 
-    protected void no(ImapCommand command, Tag tag, ImapProcessor.Responder responder, HumanReadableText displayTextKey, StatusResponse.ResponseCode responseCode) {
-        final StatusResponse response = factory.taggedNo(tag, command, displayTextKey, responseCode);
+    protected void no(ImapRequest request, ImapProcessor.Responder responder, HumanReadableText displayTextKey, StatusResponse.ResponseCode responseCode) {
+        StatusResponse response = factory.taggedNo(request.getTag(), request.getCommand(), displayTextKey, responseCode);
         responder.respond(response);
     }
 
-    protected void taggedBad(ImapCommand command, Tag tag, ImapProcessor.Responder responder, HumanReadableText e) {
-        StatusResponse response = factory.taggedBad(tag, command, e);
+    protected void taggedBad(ImapRequest request, ImapProcessor.Responder responder, HumanReadableText e) {
+        StatusResponse response = factory.taggedBad(request.getTag(), request.getCommand(), e);
 
         responder.respond(response);
     }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMessageRangeProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMessageRangeProcessor.java
index 919999e..c95afcf 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMessageRangeProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractMessageRangeProcessor.java
@@ -73,7 +73,7 @@ public abstract class AbstractMessageRangeProcessor<M extends AbstractMessageRan
             final boolean mailboxExists = mailboxManager.mailboxExists(targetMailbox, mailboxSession);
 
             if (!mailboxExists) {
-                no(command, tag, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX, StatusResponse.ResponseCode.tryCreate());
+                no(request, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX, StatusResponse.ResponseCode.tryCreate());
             } else {
 
                 final MessageManager mailbox = mailboxManager.getMailbox(targetMailbox, mailboxSession);
@@ -104,16 +104,16 @@ public abstract class AbstractMessageRangeProcessor<M extends AbstractMessageRan
                 Long uidValidity = mailbox.getMetaData(false, mailboxSession, MessageManager.MetaData.FetchGroup.NO_UNSEEN).getUidValidity();
 
                 unsolicitedResponses(session, responder, useUids);
-                okComplete(command, tag, StatusResponse.ResponseCode.copyUid(uidValidity, idSet, resultUids), responder);
+                okComplete(request, StatusResponse.ResponseCode.copyUid(uidValidity, idSet, resultUids), responder);
             }
         } catch (MessageRangeException e) {
             LOGGER.debug("{} failed from mailbox {} to {} for invalid sequence-set {}",
                     getOperationName(), currentMailbox.getMailboxId(), targetMailbox, idSet, e);
-            taggedBad(command, tag, responder, HumanReadableText.INVALID_MESSAGESET);
+            taggedBad(request, responder, HumanReadableText.INVALID_MESSAGESET);
         } catch (MailboxException e) {
             LOGGER.error("{} failed from mailbox {} to {} for sequence-set {}",
                     getOperationName(), currentMailbox.getMailboxId(), targetMailbox, idSet, e);
-            no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
+            no(request, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
     }
 }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
index af7d916..7f23302 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AbstractSelectionProcessor.java
@@ -30,6 +30,7 @@ import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.api.message.IdRange;
 import org.apache.james.imap.api.message.UidRange;
+import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.StatusResponse;
 import org.apache.james.imap.api.message.response.StatusResponse.ResponseCode;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
@@ -83,7 +84,7 @@ abstract class AbstractSelectionProcessor<M extends AbstractMailboxSelectionRequ
         try {
             final MailboxPath fullMailboxPath = PathConverter.forSession(session).buildFullPath(mailboxName);
 
-            respond(tag, command, session, fullMailboxPath, request, responder);
+            respond(session, fullMailboxPath, request, responder);
            
             
         } catch (MailboxNotFoundException e) {
@@ -91,11 +92,11 @@ abstract class AbstractSelectionProcessor<M extends AbstractMailboxSelectionRequ
             responder.respond(statusResponseFactory.taggedNo(tag, command, HumanReadableText.FAILURE_NO_SUCH_MAILBOX));
         } catch (MailboxException e) {
             LOGGER.error("Select failed for mailbox {}", mailboxName, e);
-            no(command, tag, responder, HumanReadableText.SELECT);
+            no(request, responder, HumanReadableText.SELECT);
         } 
     }
 
-    private void respond(Tag tag, ImapCommand command, ImapSession session, MailboxPath fullMailboxPath, AbstractMailboxSelectionRequest request, Responder responder) throws MailboxException, MessageRangeException {
+    private void respond(ImapSession session, MailboxPath fullMailboxPath, AbstractMailboxSelectionRequest request, Responder responder) throws MailboxException, MessageRangeException {
         
         Long lastKnownUidValidity = request.getLastKnownUidValidity();
         Long modSeq = request.getKnownModSeq();
@@ -112,7 +113,7 @@ abstract class AbstractSelectionProcessor<M extends AbstractMailboxSelectionRequ
         //    and the client hasn't issued "ENABLE QRESYNC" in the current
         //    connection.
         if (lastKnownUidValidity != null && !EnableProcessor.getEnabledCapabilities(session).contains(ImapConstants.SUPPORTS_QRESYNC)) {
-            taggedBad(command, tag, responder, HumanReadableText.QRESYNC_NOT_ENABLED);
+            taggedBad(request, responder, HumanReadableText.QRESYNC_NOT_ENABLED);
             return;
         }
 
@@ -299,13 +300,13 @@ abstract class AbstractSelectionProcessor<M extends AbstractMailboxSelectionRequ
                     //
                     respondVanished(mailboxSession, mailbox, ranges, modSeq, metaData, responder);
                 }
-                taggedOk(responder, tag, command, metaData, HumanReadableText.SELECT);
+                taggedOk(responder, request, metaData, HumanReadableText.SELECT);
             } else {
                 
-                taggedOk(responder, tag, command, metaData, HumanReadableText.QRESYNC_UIDVALIDITY_MISMATCH);
+                taggedOk(responder, request, metaData, HumanReadableText.QRESYNC_UIDVALIDITY_MISMATCH);
             }
         } else {
-            taggedOk(responder, tag, command, metaData, HumanReadableText.SELECT);
+            taggedOk(responder, request, metaData, HumanReadableText.SELECT);
         }
 
         // Reset the saved sequence-set after successful SELECT / EXAMINE
@@ -332,7 +333,7 @@ abstract class AbstractSelectionProcessor<M extends AbstractMailboxSelectionRequ
         responder.respond(untaggedOk);
     }
 
-    private void taggedOk(Responder responder, Tag tag, ImapCommand command, MetaData metaData, HumanReadableText text) {
+    private void taggedOk(Responder responder, ImapRequest request, MetaData metaData, HumanReadableText text) {
         final boolean writeable = metaData.isWriteable() && !openReadOnly;
         final ResponseCode code;
         if (writeable) {
@@ -340,7 +341,7 @@ abstract class AbstractSelectionProcessor<M extends AbstractMailboxSelectionRequ
         } else {
             code = ResponseCode.readOnly();
         }
-        final StatusResponse taggedOk = statusResponseFactory.taggedOk(tag, command, text, code);
+        final StatusResponse taggedOk = statusResponseFactory.taggedOk(request.getTag(), request.getCommand(), text, code);
         responder.respond(taggedOk);
     }
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AppendProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AppendProcessor.java
index ccd6047..316ca10 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AppendProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AppendProcessor.java
@@ -75,7 +75,7 @@ public class AppendProcessor extends AbstractMailboxProcessor<AppendRequest> {
 
             final MailboxManager mailboxManager = getMailboxManager();
             final MessageManager mailbox = mailboxManager.getMailbox(mailboxPath, ImapSessionUtils.getMailboxSession(session));
-            appendToMailbox(messageIn, datetime, flags, session, tag, command, mailbox, responder, mailboxPath);
+            appendToMailbox(messageIn, datetime, flags, session, request, mailbox, responder, mailboxPath);
         } catch (MailboxNotFoundException e) {
             // consume message on exception
             consume(messageIn);
@@ -84,7 +84,7 @@ public class AppendProcessor extends AbstractMailboxProcessor<AppendRequest> {
             
             // Indicates that the mailbox does not exist
             // So TRY CREATE
-            tryCreate(session, tag, command, responder, e);
+            tryCreate(request, responder, e);
 
         } catch (MailboxException e) {
             // consume message on exception
@@ -93,7 +93,7 @@ public class AppendProcessor extends AbstractMailboxProcessor<AppendRequest> {
             LOGGER.error("Append failed for mailbox {}", mailboxPath, e);
             
             // Some other issue
-            no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
+            no(request, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
 
         }
 
@@ -112,24 +112,20 @@ public class AppendProcessor extends AbstractMailboxProcessor<AppendRequest> {
     /**
      * Issues a TRY CREATE response.
      * 
-     * @param session
-     *            not null
-     * @param tag
-     *            not null
-     * @param command
+     * @param request
      *            not null
      * @param responder
      *            not null
      * @param e
      *            not null
      */
-    private void tryCreate(ImapSession session, Tag tag, ImapCommand command, Responder responder, MailboxNotFoundException e) {
+    private void tryCreate(AppendRequest request, Responder responder, MailboxNotFoundException e) {
         LOGGER.debug("Cannot open mailbox: ", e);
 
-        no(command, tag, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX, StatusResponse.ResponseCode.tryCreate());
+        no(request, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX, StatusResponse.ResponseCode.tryCreate());
     }
 
-    private void appendToMailbox(InputStream message, Date datetime, Flags flagsToBeSet, ImapSession session, Tag tag, ImapCommand command, MessageManager mailbox, Responder responder, MailboxPath mailboxPath) {
+    private void appendToMailbox(InputStream message, Date datetime, Flags flagsToBeSet, ImapSession session, AppendRequest request, MessageManager mailbox, Responder responder, MailboxPath mailboxPath) {
         try {
             final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
             final SelectedMailbox selectedMailbox = session.getSelected();
@@ -146,15 +142,15 @@ public class AppendProcessor extends AbstractMailboxProcessor<AppendRequest> {
             unsolicitedResponses(session, responder, false);
 
             // in case of MULTIAPPEND support we will push more then one UID here
-            okComplete(command, tag, ResponseCode.appendUid(uidValidity, new UidRange[] { new UidRange(messageId.getUid()) }), responder);
+            okComplete(request, ResponseCode.appendUid(uidValidity, new UidRange[] { new UidRange(messageId.getUid()) }), responder);
         } catch (MailboxNotFoundException e) {
             // Indicates that the mailbox does not exist
             // So TRY CREATE
-            tryCreate(session, tag, command, responder, e);
+            tryCreate(request, responder, e);
         } catch (MailboxException e) {
             LOGGER.error("Unable to append message to mailbox {}", mailboxPath, e);
             // Some other issue
-            no(command, tag, responder, HumanReadableText.SAVE_FAILED);
+            no(request, responder, HumanReadableText.SAVE_FAILED);
         }
     }
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/AuthenticateProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/AuthenticateProcessor.java
index 2752674..b56fc44 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/AuthenticateProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/AuthenticateProcessor.java
@@ -29,6 +29,7 @@ import java.util.StringTokenizer;
 import org.apache.james.imap.api.ImapCommand;
 import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
+import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
 import org.apache.james.imap.api.process.ImapSession;
@@ -61,18 +62,18 @@ public class AuthenticateProcessor extends AbstractAuthProcessor<AuthenticateReq
         if (authType.equalsIgnoreCase(PLAIN)) {
             // See if AUTH=PLAIN is allowed. See IMAP-304
             if (session.isPlainAuthDisallowed() && session.isTLSActive() == false) {
-                no(command, tag, responder, HumanReadableText.DISABLED_LOGIN);
+                no(request, responder, HumanReadableText.DISABLED_LOGIN);
             } else {
                 if (request instanceof IRAuthenticateRequest) {
                     IRAuthenticateRequest irRequest = (IRAuthenticateRequest) request;
-                    doPlainAuth(irRequest.getInitialClientResponse(), session, tag, command, responder);
+                    doPlainAuth(irRequest.getInitialClientResponse(), session, request, responder);
                 } else {
                     responder.respond(new AuthenticateResponse());
                     session.pushLineHandler((requestSession, data) -> {
                         // cut of the CRLF
                         String initialClientResponse = new String(data, 0, data.length - 2, Charset.forName("US-ASCII"));
 
-                        doPlainAuth(initialClientResponse, requestSession, tag, command, responder);
+                        doPlainAuth(initialClientResponse, requestSession, request, responder);
 
                         // remove the handler now
                         requestSession.popLineHandler();
@@ -81,19 +82,19 @@ public class AuthenticateProcessor extends AbstractAuthProcessor<AuthenticateReq
             }
         } else {
             LOGGER.debug("Unsupported authentication mechanism '{}'", authType);
-            no(command, tag, responder, HumanReadableText.UNSUPPORTED_AUTHENTICATION_MECHANISM);
+            no(request, responder, HumanReadableText.UNSUPPORTED_AUTHENTICATION_MECHANISM);
         }
     }
 
     /**
      * Parse the initialClientResponse and do a PLAIN AUTH with it
      */
-    protected void doPlainAuth(String initialClientResponse, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
+    protected void doPlainAuth(String initialClientResponse, ImapSession session, ImapRequest request, Responder responder) {
         AuthenticationAttempt authenticationAttempt = parseDelegationAttempt(initialClientResponse);
         if (authenticationAttempt.isDelegation()) {
-            doAuthWithDelegation(authenticationAttempt, session, tag, command, responder, HumanReadableText.AUTHENTICATION_FAILED);
+            doAuthWithDelegation(authenticationAttempt, session, request, responder, HumanReadableText.AUTHENTICATION_FAILED);
         } else {
-            doAuth(authenticationAttempt, session, tag, command, responder, HumanReadableText.AUTHENTICATION_FAILED);
+            doAuth(authenticationAttempt, session, request, responder, HumanReadableText.AUTHENTICATION_FAILED);
         }
     }
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java
index 5054009..3642f35 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/CapabilityProcessor.java
@@ -84,7 +84,7 @@ public class CapabilityProcessor extends AbstractMailboxProcessor<CapabilityRequ
         final CapabilityResponse result = new CapabilityResponse(getSupportedCapabilities(session));        
         responder.respond(result);
         unsolicitedResponses(session, responder, false);
-        okComplete(command, tag, responder);
+        okComplete(request, responder);
     }
 
     /**
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/CheckProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/CheckProcessor.java
index 12089b6..da80013 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/CheckProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/CheckProcessor.java
@@ -41,7 +41,7 @@ public class CheckProcessor extends AbstractMailboxProcessor<CheckRequest> {
     @Override
     protected void doProcess(CheckRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
         unsolicitedResponses(session, responder, false);
-        okComplete(command, tag, responder);
+        okComplete(message, responder);
     }
 
     @Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/CloseProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/CloseProcessor.java
index 07cb7d7..110daf5 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/CloseProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/CloseProcessor.java
@@ -60,13 +60,13 @@ public class CloseProcessor extends AbstractMailboxProcessor<CloseRequest> {
                 // Don't send HIGHESTMODSEQ when close. Like correct in the ERRATA of RFC5162
                 //
                 // See http://www.rfc-editor.org/errata_search.php?rfc=5162
-                okComplete(command, tag, responder);
+                okComplete(message, responder);
                
             }
 
         } catch (MailboxException e) {
             LOGGER.error("Close failed for mailbox {}", session.getSelected().getMailboxId(), e);
-            no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
+            no(message, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
     }
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/CreateProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/CreateProcessor.java
index 6d77247..c243440 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/CreateProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/CreateProcessor.java
@@ -55,16 +55,16 @@ public class CreateProcessor extends AbstractMailboxProcessor<CreateRequest> {
             final MailboxManager mailboxManager = getMailboxManager();
             mailboxManager.createMailbox(mailboxPath, ImapSessionUtils.getMailboxSession(session));
             unsolicitedResponses(session, responder, false);
-            okComplete(command, tag, responder);
+            okComplete(request, responder);
         } catch (MailboxExistsException e) {
             LOGGER.debug("Create failed for mailbox {} as it already exists", mailboxPath, e);
-            no(command, tag, responder, HumanReadableText.MAILBOX_EXISTS);
+            no(request, responder, HumanReadableText.MAILBOX_EXISTS);
         } catch (TooLongMailboxNameException e) {
             LOGGER.debug("The mailbox name length is over limit: {}", mailboxPath.getName(), e);
-            taggedBad(command, tag, responder, HumanReadableText.FAILURE_MAILBOX_NAME);
+            taggedBad(request, responder, HumanReadableText.FAILURE_MAILBOX_NAME);
         } catch (MailboxException e) {
             LOGGER.error("Create failed for mailbox {}", mailboxPath, e);
-            no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
+            no(request, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
     }
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java
index 04ff93e..8a631c2 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java
@@ -83,7 +83,7 @@ public class DeleteACLProcessor extends AbstractMailboxProcessor<DeleteACLReques
              * existence information, much less the mailbox’s ACL.
              */
             if (!mailboxManager.hasRight(mailboxPath, MailboxACL.Right.Lookup, mailboxSession)) {
-                no(command, tag, responder, HumanReadableText.MAILBOX_NOT_FOUND);
+                no(message, responder, HumanReadableText.MAILBOX_NOT_FOUND);
             } else if (!mailboxManager.hasRight(mailboxPath, MailboxACL.Right.Administer, mailboxSession)) {
                 /* RFC 4314 section 4. */
                 Object[] params = new Object[] {
@@ -92,7 +92,7 @@ public class DeleteACLProcessor extends AbstractMailboxProcessor<DeleteACLReques
                         mailboxName
                 };
                 HumanReadableText text = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
-                no(command, tag, responder, text);
+                no(message, responder, text);
             } else {
                 
                 EntryKey key = EntryKey.deserialize(identifier);
@@ -113,7 +113,7 @@ public class DeleteACLProcessor extends AbstractMailboxProcessor<DeleteACLReques
                     mailboxSession
                 );
 
-                okComplete(command, tag, responder);
+                okComplete(message, responder);
                 // FIXME should we send unsolicited responses here?
                 // unsolicitedResponses(session, responder, false);
             }
@@ -126,12 +126,12 @@ public class DeleteACLProcessor extends AbstractMailboxProcessor<DeleteACLReques
              * */
             Object[] params = new Object[] {e.getUnsupportedRight()};
             HumanReadableText text = new HumanReadableText(HumanReadableText.UNSUPPORTED_RIGHT_KEY, HumanReadableText.UNSUPPORTED_RIGHT_DEFAULT_VALUE, params);
-            taggedBad(command, tag, responder, text);
+            taggedBad(message, responder, text);
         } catch (MailboxNotFoundException e) {
-            no(command, tag, responder, HumanReadableText.MAILBOX_NOT_FOUND);
+            no(message, responder, HumanReadableText.MAILBOX_NOT_FOUND);
         } catch (MailboxException e) {
             LOGGER.error("{} failed for mailbox {}", command.getName(), mailboxName, e);
-            no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
+            no(message, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
 
     }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java
index a80c1ff..d15eb6a 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteProcessor.java
@@ -61,16 +61,16 @@ public class DeleteProcessor extends AbstractMailboxProcessor<DeleteRequest> {
             final MailboxManager mailboxManager = getMailboxManager();
             mailboxManager.deleteMailbox(mailboxPath, ImapSessionUtils.getMailboxSession(session));
             unsolicitedResponses(session, responder, false);
-            okComplete(command, tag, responder);
+            okComplete(request, responder);
         } catch (MailboxNotFoundException e) {
             LOGGER.debug("Delete failed for mailbox {} as it doesn't exist", mailboxPath, e);
-            no(command, tag, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX);
+            no(request, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX);
         } catch (TooLongMailboxNameException e) {
             LOGGER.debug("The mailbox name length is over limit: {}", mailboxPath.getName(), e);
-            taggedBad(command, tag, responder, HumanReadableText.FAILURE_MAILBOX_NAME);
+            taggedBad(request, responder, HumanReadableText.FAILURE_MAILBOX_NAME);
         } catch (MailboxException e) {
             LOGGER.error("Delete failed for mailbox {}", mailboxPath, e);
-            no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
+            no(request, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
     }
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/EnableProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/EnableProcessor.java
index 98c283c..f653a05 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/EnableProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/EnableProcessor.java
@@ -77,10 +77,10 @@ public class EnableProcessor extends AbstractMailboxProcessor<EnableRequest> imp
             responder.respond(new EnableResponse(enabledCaps));
 
             unsolicitedResponses(session, responder, false);
-            okComplete(command, tag, responder);
+            okComplete(request, responder);
         } catch (EnableException e) {
             LOGGER.info("Unable to enable extension", e);
-            taggedBad(command, tag, responder, HumanReadableText.FAILED);
+            taggedBad(request, responder, HumanReadableText.FAILED);
         }
     }
    
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java
index 1f1e6b7..7d50868 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/ExpungeProcessor.java
@@ -71,7 +71,7 @@ public class ExpungeProcessor extends AbstractMailboxProcessor<ExpungeRequest> i
             MetaData mdata = mailbox.getMetaData(false, mailboxSession, FetchGroup.NO_COUNT);
 
             if (!mdata.isWriteable()) {
-                no(command, tag, responder, HumanReadableText.MAILBOX_IS_READ_ONLY);
+                no(request, responder, HumanReadableText.MAILBOX_IS_READ_ONLY);
             } else {
                 IdRange[] ranges = request.getUidSet();
                 if (ranges == null) {
@@ -95,17 +95,17 @@ public class ExpungeProcessor extends AbstractMailboxProcessor<ExpungeRequest> i
                 //
                 // See RFC5162 3.3 EXPUNGE Command 3.5. UID EXPUNGE Command
                 if (EnableProcessor.getEnabledCapabilities(session).contains(ImapConstants.SUPPORTS_QRESYNC)  && expunged > 0) {
-                    okComplete(command, tag, ResponseCode.highestModSeq(mdata.getHighestModSeq()), responder);
+                    okComplete(request, ResponseCode.highestModSeq(mdata.getHighestModSeq()), responder);
                 } else {
-                    okComplete(command, tag, responder);
+                    okComplete(request, responder);
                 }
             }
         } catch (MessageRangeException e) {
             LOGGER.debug("Expunge failed", e);
-            taggedBad(command, tag, responder, HumanReadableText.INVALID_MESSAGESET);
+            taggedBad(request, responder, HumanReadableText.INVALID_MESSAGESET);
         } catch (MailboxException e) {
             LOGGER.error("Expunge failed for mailbox {}", session.getSelected().getMailboxId(), e);
-            no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
+            no(request, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
     }
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java
index abdfeb7..ce61b5c 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java
@@ -84,29 +84,29 @@ public class GetACLProcessor extends AbstractMailboxProcessor<GetACLRequest> imp
              * existence information, much less the mailbox’s ACL.
              */
             if (!mailboxManager.hasRight(mailboxPath, MailboxACL.Right.Lookup, mailboxSession)) {
-                no(command, tag, responder, HumanReadableText.MAILBOX_NOT_FOUND);
+                no(message, responder, HumanReadableText.MAILBOX_NOT_FOUND);
             } else if (!mailboxManager.hasRight(mailboxPath, MailboxACL.Right.Administer, mailboxSession)) {
                 /* RFC 4314 section 4. */
                 Object[] params = new Object[] {
                         MailboxACL.Right.Administer.toString(),
-                        command.getName(),
+                        message.getCommand().getName(),
                         mailboxName
                 };
                 HumanReadableText text = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
-                no(command, tag, responder, text);
+                no(message, responder, text);
             } else {
                 MetaData metaData = messageManager.getMetaData(false, mailboxSession, FetchGroup.NO_COUNT);
                 ACLResponse aclResponse = new ACLResponse(mailboxName, metaData.getACL());
                 responder.respond(aclResponse);
-                okComplete(command, tag, responder);
+                okComplete(message, responder);
                 // FIXME should we send unsolicited responses here?
                 // unsolicitedResponses(session, responder, false);
             }
         } catch (MailboxNotFoundException e) {
-            no(command, tag, responder, HumanReadableText.MAILBOX_NOT_FOUND);
+            no(message, responder, HumanReadableText.MAILBOX_NOT_FOUND);
         } catch (MailboxException e) {
-            LOGGER.error("{} failed for mailbox {}", command.getName(), mailboxName, e);
-            no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
+            LOGGER.error("{} failed for mailbox {}", message.getCommand().getName(), mailboxName, e);
+            no(message, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
 
     }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetAnnotationProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetAnnotationProcessor.java
index dcd843d..0cce69e 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetAnnotationProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetAnnotationProcessor.java
@@ -32,6 +32,7 @@ import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapSessionUtils;
 import org.apache.james.imap.api.Tag;
 import org.apache.james.imap.api.display.HumanReadableText;
+import org.apache.james.imap.api.message.request.ImapRequest;
 import org.apache.james.imap.api.message.response.StatusResponse.ResponseCode;
 import org.apache.james.imap.api.message.response.StatusResponseFactory;
 import org.apache.james.imap.api.process.ImapProcessor;
@@ -72,17 +73,17 @@ public class GetAnnotationProcessor extends AbstractMailboxProcessor<GetAnnotati
     protected void doProcess(GetAnnotationRequest message, ImapSession session, Tag tag, ImapCommand command,
                              Responder responder) {
         try {
-            proceed(message, session, tag, command, responder);
+            proceed(message, session, responder);
         } catch (MailboxNotFoundException e) {
             LOGGER.info("The command: {} is failed because not found mailbox {}", command.getName(), message.getMailboxName());
-            no(command, tag, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX, ResponseCode.tryCreate());
+            no(message, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX, ResponseCode.tryCreate());
         } catch (MailboxException e) {
             LOGGER.error("GetAnnotation on mailbox {} failed for user {}", message.getMailboxName(), ImapSessionUtils.getUserName(session), e);
-            no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
+            no(message, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
     }
 
-    private void proceed(GetAnnotationRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) throws MailboxException {
+    private void proceed(GetAnnotationRequest message, ImapSession session, Responder responder) throws MailboxException {
         String mailboxName = message.getMailboxName();
         Optional<Integer> maxsize = message.getMaxsize();
         MailboxPath mailboxPath = PathConverter.forSession(session).buildFullPath(mailboxName);
@@ -90,17 +91,17 @@ public class GetAnnotationProcessor extends AbstractMailboxProcessor<GetAnnotati
         List<MailboxAnnotation> mailboxAnnotations = getMailboxAnnotations(session, message.getKeys(), message.getDepth(), mailboxPath);
         Optional<Integer> maximumOversizedSize = getMaxSizeValue(mailboxAnnotations, maxsize);
 
-        respond(tag, command, responder, mailboxName, mailboxAnnotations, maxsize, maximumOversizedSize);
+        respond(message, responder, mailboxName, mailboxAnnotations, maxsize, maximumOversizedSize);
     }
 
-    private void respond(Tag tag, ImapCommand command, Responder responder, String mailboxName,
+    private void respond(ImapRequest request, Responder responder, String mailboxName,
                          List<MailboxAnnotation> mailboxAnnotations, Optional<Integer> maxsize, Optional<Integer> maximumOversizedSize) {
         if (maximumOversizedSize.isPresent()) {
             responder.respond(new AnnotationResponse(mailboxName, filterItemsBySize(mailboxAnnotations, maxsize)));
-            okComplete(command, tag, ResponseCode.longestMetadataEntry(maximumOversizedSize.get()), responder);
+            okComplete(request, ResponseCode.longestMetadataEntry(maximumOversizedSize.get()), responder);
         } else {
             responder.respond(new AnnotationResponse(mailboxName, mailboxAnnotations));
-            okComplete(command, tag, responder);
+            okComplete(request, responder);
         }
     }
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java
index 7ee3113..174cdbe 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java
@@ -83,7 +83,7 @@ public class GetQuotaProcessor extends AbstractMailboxProcessor<GetQuotaRequest>
                 if (storageQuota.getLimit().isLimited()) {
                     responder.respond(new QuotaResponse(ImapConstants.STORAGE_QUOTA_RESOURCE, quotaRoot.getValue(), storageQuota));
                 }
-                okComplete(command, tag, responder);
+                okComplete(message, responder);
             } else {
                 Object[] params = new Object[]{
                         MailboxACL.Right.Read.toString(),
@@ -91,10 +91,10 @@ public class GetQuotaProcessor extends AbstractMailboxProcessor<GetQuotaRequest>
                         "Any mailbox of this user USER"
                 };
                 HumanReadableText humanReadableText = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
-                no(command, tag, responder, humanReadableText);
+                no(message, responder, humanReadableText);
             }
         } catch (MailboxException me) {
-            taggedBad(command, tag, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX);
+            taggedBad(message, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX);
         }
     }
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java
index c7a2db2..f38832d 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java
@@ -91,7 +91,7 @@ public class GetQuotaRootProcessor extends AbstractMailboxProcessor<GetQuotaRoot
                 if (storageQuota.getLimit().isLimited()) {
                     responder.respond(new QuotaResponse(ImapConstants.STORAGE_QUOTA_RESOURCE, quotaRoot.getValue(), storageQuota));
                 }
-                okComplete(command, tag, responder);
+                okComplete(message, responder);
             } else {
                 Object[] params = new Object[]{
                         MailboxACL.Right.Read.toString(),
@@ -99,10 +99,10 @@ public class GetQuotaRootProcessor extends AbstractMailboxProcessor<GetQuotaRoot
                         message.getMailboxName()
                 };
                 HumanReadableText humanReadableText = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
-                no(command, tag, responder, humanReadableText);
+                no(message, responder, humanReadableText);
             }
         } catch (MailboxException me) {
-            taggedBad(command, tag, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX);
+            taggedBad(message, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX);
         }
 
     }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/IdleProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/IdleProcessor.java
index a26dde5..1c0843f 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/IdleProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/IdleProcessor.java
@@ -115,7 +115,7 @@ public class IdleProcessor extends AbstractMailboxProcessor<IdleRequest> impleme
                     StatusResponse response = getStatusResponseFactory().taggedBad(tag, command, HumanReadableText.INVALID_COMMAND);
                     responder.respond(response);
                 } else {
-                    okComplete(command, tag, responder);
+                    okComplete(message, responder);
 
                 }
                 idleActive.set(false);
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/LSubProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/LSubProcessor.java
index 6a138c7..ef7f299 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/LSubProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/LSubProcessor.java
@@ -61,10 +61,10 @@ public class LSubProcessor extends AbstractSubscriptionProcessor<LsubRequest> {
         try {
             listSubscriptions(session, responder, referenceName, mailboxPattern);
 
-            okComplete(command, tag, responder);
+            okComplete(request, responder);
         } catch (MailboxException e) {
             LOGGER.error("LSub failed for reference {} and pattern {}", referenceName, mailboxPattern, e);
-            no(command, tag, responder, HumanReadableText.GENERIC_LSUB_FAILURE);
+            no(request, responder, HumanReadableText.GENERIC_LSUB_FAILURE);
         }
     }
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java
index eb6ad4d..7f05af7 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListProcessor.java
@@ -81,10 +81,10 @@ public class ListProcessor extends AbstractMailboxProcessor<ListRequest> {
             } else {
                 respondMailboxList(baseReferenceName, mailboxPatternString, session, responder, mailboxSession);
             }
-            okComplete(command, tag, responder);
+            okComplete(request, responder);
         } catch (MailboxException e) {
             LOGGER.error("List failed for mailboxName {}", mailboxPatternString, e);
-            no(command, tag, responder, HumanReadableText.SEARCH_FAILED);
+            no(request, responder, HumanReadableText.SEARCH_FAILED);
         }
     }
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java
index f889fc9..8a6a5cf 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java
@@ -85,7 +85,7 @@ public class ListRightsProcessor extends AbstractMailboxProcessor<ListRightsRequ
              * existence information, much less the mailbox’s ACL.
              */
             if (!mailboxManager.hasRight(mailboxPath, MailboxACL.Right.Lookup, mailboxSession)) {
-                no(command, tag, responder, HumanReadableText.MAILBOX_NOT_FOUND);
+                no(message, responder, HumanReadableText.MAILBOX_NOT_FOUND);
             } else if (!mailboxManager.hasRight(mailboxPath, MailboxACL.Right.Administer, mailboxSession)) {
                 /* RFC 4314 section 4. */
                 Object[] params = new Object[] {
@@ -94,7 +94,7 @@ public class ListRightsProcessor extends AbstractMailboxProcessor<ListRightsRequ
                         mailboxName
                 };
                 HumanReadableText text = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
-                no(command, tag, responder, text);
+                no(message, responder, text);
             } else {
                 
                 EntryKey key = EntryKey.deserialize(identifier);
@@ -112,15 +112,15 @@ public class ListRightsProcessor extends AbstractMailboxProcessor<ListRightsRequ
                 Rfc4314Rights[] rights = mailboxManager.listRights(mailboxPath, key, mailboxSession);
                 ListRightsResponse aclResponse = new ListRightsResponse(mailboxName, identifier, rights);
                 responder.respond(aclResponse);
-                okComplete(command, tag, responder);
+                okComplete(message, responder);
                 // FIXME should we send unsolicited responses here?
                 // unsolicitedResponses(session, responder, false);
             }
         } catch (MailboxNotFoundException e) {
-            no(command, tag, responder, HumanReadableText.MAILBOX_NOT_FOUND);
+            no(message, responder, HumanReadableText.MAILBOX_NOT_FOUND);
         } catch (MailboxException e) {
             LOGGER.error("{} failed for mailbox {}", command.getName(), mailboxName, e);
-            no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
+            no(message, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
 
     }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/LoginProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/LoginProcessor.java
index e7f960b..959fc15 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/LoginProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/LoginProcessor.java
@@ -52,10 +52,10 @@ public class LoginProcessor extends AbstractAuthProcessor<LoginRequest> implemen
     protected void doProcess(LoginRequest request, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
             // check if the login is allowed with LOGIN command. See IMAP-304
             if (session.isPlainAuthDisallowed() && session.isTLSActive() == false) {
-                no(command, tag, responder, HumanReadableText.DISABLED_LOGIN);
+                no(request, responder, HumanReadableText.DISABLED_LOGIN);
             } else {
                 doAuth(noDelegation(request.getUserid(), request.getPassword()),
-                    session, tag, command, responder, HumanReadableText.INVALID_LOGIN);
+                    session, request, responder, HumanReadableText.INVALID_LOGIN);
             }
     }
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java
index 8fcc486..b0bd7ce 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/LogoutProcessor.java
@@ -52,10 +52,10 @@ public class LogoutProcessor extends AbstractMailboxProcessor<LogoutRequest> {
             getMailboxManager().logout(mailboxSession, false);
             session.logout();
             bye(responder);
-            okComplete(command, tag, responder);
+            okComplete(request, responder);
         } catch (MailboxException e) {
             LOGGER.error("Logout failed for user {}", mailboxSession.getUser().asString(), e);
-            no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
+            no(request, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
     }
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java
index 3eedf3b..01ecf51 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java
@@ -91,19 +91,19 @@ public class MyRightsProcessor extends AbstractMailboxProcessor<MyRightsRequest>
                     && !myRights.contains(MailboxACL.Right.CreateMailbox)
                     && !myRights.contains(MailboxACL.Right.DeleteMailbox)
                     && !myRights.contains(MailboxACL.Right.Administer)) {
-                no(command, tag, responder, HumanReadableText.MAILBOX_NOT_FOUND);
+                no(message, responder, HumanReadableText.MAILBOX_NOT_FOUND);
             } else {
                 MyRightsResponse myRightsResponse = new MyRightsResponse(mailboxName, myRights);
                 responder.respond(myRightsResponse);
-                okComplete(command, tag, responder);
+                okComplete(message, responder);
                 // FIXME should we send unsolicited responses here?
                 // unsolicitedResponses(session, responder, false);
             }
         } catch (MailboxNotFoundException e) {
-            no(command, tag, responder, HumanReadableText.MAILBOX_NOT_FOUND);
+            no(message, responder, HumanReadableText.MAILBOX_NOT_FOUND);
         } catch (MailboxException e) {
             LOGGER.error("{} failed for mailbox {}", command.getName(), mailboxName, e);
-            no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
+            no(message, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
 
     }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/NamespaceProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/NamespaceProcessor.java
index 30cac09..6c6457a 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/NamespaceProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/NamespaceProcessor.java
@@ -61,7 +61,7 @@ public class NamespaceProcessor extends AbstractMailboxProcessor<NamespaceReques
         final NamespaceResponse response = new NamespaceResponse(personalNamespaces, otherUsersNamespaces, sharedNamespaces);
         responder.respond(response);
         unsolicitedResponses(session, responder, false);
-        okComplete(command, tag, responder);
+        okComplete(request, responder);
     }
 
     /**
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/NoopProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/NoopProcessor.java
index ff8b404..b5e4ad4 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/NoopProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/NoopProcessor.java
@@ -42,7 +42,7 @@ public class NoopProcessor extends AbstractMailboxProcessor<NoopRequest> {
     protected void doProcess(NoopRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
         // So, unsolicated responses are returned to check for new mail
         unsolicitedResponses(session, responder, false);
-        okComplete(command, tag, responder);
+        okComplete(message, responder);
     }
 
     @Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/RenameProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/RenameProcessor.java
index 62c932c..7b41df6 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/RenameProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/RenameProcessor.java
@@ -64,20 +64,20 @@ public class RenameProcessor extends AbstractMailboxProcessor<RenameRequest> {
             if (existingPath.getName().equalsIgnoreCase(ImapConstants.INBOX_NAME) && !mailboxManager.mailboxExists(existingPath, mailboxsession)) {
                 mailboxManager.createMailbox(existingPath, mailboxsession);
             }
-            okComplete(command, tag, responder);
+            okComplete(request, responder);
             unsolicitedResponses(session, responder, false);
         } catch (MailboxExistsException e) {
             LOGGER.debug("Rename from {} to {} failed because the target mailbox exists", existingPath, newPath, e);
-            no(command, tag, responder, HumanReadableText.FAILURE_MAILBOX_EXISTS);
+            no(request, responder, HumanReadableText.FAILURE_MAILBOX_EXISTS);
         } catch (MailboxNotFoundException e) {
             LOGGER.debug("Rename from {} to {} failed because the source mailbox doesn't exist", existingPath, newPath, e);
-            no(command, tag, responder, HumanReadableText.MAILBOX_NOT_FOUND);
+            no(request, responder, HumanReadableText.MAILBOX_NOT_FOUND);
         } catch (TooLongMailboxNameException e) {
             LOGGER.debug("The mailbox name length is over limit: {}", newPath.getName(), e);
-            taggedBad(command, tag, responder, HumanReadableText.FAILURE_MAILBOX_NAME);
+            taggedBad(request, responder, HumanReadableText.FAILURE_MAILBOX_NAME);
         } catch (MailboxException e) {
             LOGGER.error("Rename from {} to {} failed", existingPath, newPath, e);
-            no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
+            no(request, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
     }
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/SearchProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/SearchProcessor.java
index 77a71ad..134218e 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/SearchProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/SearchProcessor.java
@@ -186,13 +186,13 @@ public class SearchProcessor extends AbstractMailboxProcessor<SearchRequest> imp
 
             boolean omitExpunged = (!useUids);
             unsolicitedResponses(session, responder, omitExpunged, useUids);
-            okComplete(command, tag, responder);
+            okComplete(request, responder);
         } catch (MessageRangeException e) {
             LOGGER.debug("Search failed in mailbox {} because of an invalid sequence-set ", session.getSelected().getMailboxId(), e);
-            taggedBad(command, tag, responder, HumanReadableText.INVALID_MESSAGESET);
+            taggedBad(request, responder, HumanReadableText.INVALID_MESSAGESET);
         } catch (MailboxException e) {
             LOGGER.error("Search failed in mailbox {}", session.getSelected().getMailboxId(), e);
-            no(command, tag, responder, HumanReadableText.SEARCH_FAILED);
+            no(request, responder, HumanReadableText.SEARCH_FAILED);
             
             if (resultOptions.contains(SearchResultOption.SAVE)) {
                 // Reset the saved sequence-set on a BAD response if the SAVE option was used.
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java
index ec4bdd7..b135f7f 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java
@@ -102,7 +102,7 @@ public class SetACLProcessor extends AbstractMailboxProcessor<SetACLRequest> imp
              * existence information, much less the mailbox’s ACL.
              */
             if (!mailboxManager.hasRight(mailboxPath, MailboxACL.Right.Lookup, mailboxSession)) {
-                no(command, tag, responder, HumanReadableText.MAILBOX_NOT_FOUND);
+                no(message, responder, HumanReadableText.MAILBOX_NOT_FOUND);
             } else if (!mailboxManager.hasRight(mailboxPath, MailboxACL.Right.Administer, mailboxSession)) {
                 /* RFC 4314 section 4. */
                 Object[] params = new Object[] {
@@ -111,7 +111,7 @@ public class SetACLProcessor extends AbstractMailboxProcessor<SetACLRequest> imp
                         mailboxName
                 };
                 HumanReadableText text = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
-                no(command, tag, responder, text);
+                no(message, responder, text);
             } else {
                 
                 EntryKey key = EntryKey.deserialize(identifier);
@@ -130,7 +130,7 @@ public class SetACLProcessor extends AbstractMailboxProcessor<SetACLRequest> imp
                     MailboxACL.command().key(key).mode(editMode).rights(mailboxAclRights).build(),
                     mailboxSession);
 
-                okComplete(command, tag, responder);
+                okComplete(message, responder);
                 // FIXME should we send unsolicited responses here?
                 // unsolicitedResponses(session, responder, false);
             }
@@ -143,12 +143,12 @@ public class SetACLProcessor extends AbstractMailboxProcessor<SetACLRequest> imp
              * */
             Object[] params = new Object[] {e.getUnsupportedRight()};
             HumanReadableText text = new HumanReadableText(HumanReadableText.UNSUPPORTED_RIGHT_KEY, HumanReadableText.UNSUPPORTED_RIGHT_DEFAULT_VALUE, params);
-            taggedBad(command, tag, responder, text);
+            taggedBad(message, responder, text);
         } catch (MailboxNotFoundException e) {
-            no(command, tag, responder, HumanReadableText.MAILBOX_NOT_FOUND);
+            no(message, responder, HumanReadableText.MAILBOX_NOT_FOUND);
         } catch (MailboxException e) {
             LOGGER.error("{} failed for mailbox {}", command.getName(), mailboxName, e);
-            no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
+            no(message, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
 
     }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetAnnotationProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetAnnotationProcessor.java
index 1665e98..6c64145 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetAnnotationProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetAnnotationProcessor.java
@@ -70,16 +70,16 @@ public class SetAnnotationProcessor extends AbstractMailboxProcessor<SetAnnotati
 
             mailboxManager.updateAnnotations(mailboxPath, mailboxSession, message.getMailboxAnnotations());
 
-            okComplete(command, tag, responder);
+            okComplete(message, responder);
         } catch (MailboxNotFoundException e) {
             LOGGER.info("{} failed for mailbox {}", command.getName(), mailboxName, e);
-            no(command, tag, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX, StatusResponse.ResponseCode.tryCreate());
+            no(message, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX, StatusResponse.ResponseCode.tryCreate());
         } catch (AnnotationException e) {
             LOGGER.info("{} failed for mailbox {}", command.getName(), mailboxName, e);
-            no(command, tag, responder, new HumanReadableText(HumanReadableText.MAILBOX_ANNOTATION_KEY, e.getMessage()));
+            no(message, responder, new HumanReadableText(HumanReadableText.MAILBOX_ANNOTATION_KEY, e.getMessage()));
         } catch (MailboxException e) {
             LOGGER.error("{} failed for mailbox {}", command.getName(), mailboxName, e);
-            no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
+            no(message, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
         }
     }
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetQuotaProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetQuotaProcessor.java
index a871919..f8beffb 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetQuotaProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetQuotaProcessor.java
@@ -59,7 +59,7 @@ public class SetQuotaProcessor extends AbstractMailboxProcessor<SetQuotaRequest>
             "Can not perform SETQUOTA commands"
         };
         HumanReadableText humanReadableText = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
-        no(command, tag, responder, humanReadableText);
+        no(message, responder, humanReadableText);
     }
 
     @Override
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/StatusProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/StatusProcessor.java
index 0486f36..6191d2c 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/StatusProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/StatusProcessor.java
@@ -69,10 +69,11 @@ public class StatusProcessor extends AbstractMailboxProcessor<StatusRequest> {
             }
             responder.respond(response);
             unsolicitedResponses(session, responder, false);
-            okComplete(command, tag, responder);
+
+            okComplete(request, responder);
         } catch (MailboxException e) {
             LOGGER.error("Status failed for mailbox {}", mailboxPath, e);
-            no(command, tag, responder, HumanReadableText.SEARCH_FAILED);
+            no(request, responder, HumanReadableText.SEARCH_FAILED);
         }
     }
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/StoreProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/StoreProcessor.java
index 1e09e48..86c9af3 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/StoreProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/StoreProcessor.java
@@ -92,7 +92,7 @@ public class StoreProcessor extends AbstractMailboxProcessor<StoreRequest> {
                 if (metaData.isModSeqPermanent() == false) {
                     // Check if the mailbox did not support modsequences. If so return a tagged bad response.
                     // See RFC4551 3.1.2. NOMODSEQ Response Code 
-                    taggedBad(command, tag, responder, HumanReadableText.NO_MOD_SEQ);
+                    taggedBad(request, responder, HumanReadableText.NO_MOD_SEQ);
                     return;
                 } else if (unchangedSince == 0) {
                     Flags.Flag[] systemFlags = flags.getSystemFlags();
@@ -179,7 +179,7 @@ public class StoreProcessor extends AbstractMailboxProcessor<StoreRequest> {
             
             // check if we had some failed uids which didn't pass the UNCHANGEDSINCE filter
             if (failed.isEmpty() && failedMsns.isEmpty()) {
-                okComplete(imapCommand, tag, responder);
+                okComplete(request, responder);
             } else {
                 if (useUids) {
                     List<MessageRange> ranges = MessageRange.toRanges(failed);
@@ -211,10 +211,10 @@ public class StoreProcessor extends AbstractMailboxProcessor<StoreRequest> {
             }
         } catch (MessageRangeException e) {
             LOGGER.debug("Store failed for mailbox {} because of an invalid sequence-set {}", session.getSelected().getMailboxId(), idSet, e);
-            taggedBad(imapCommand, tag, responder, HumanReadableText.INVALID_MESSAGESET);
+            taggedBad(request, responder, HumanReadableText.INVALID_MESSAGESET);
         } catch (MailboxException e) {
             LOGGER.error("Store failed for mailbox {} and sequence-set {}", session.getSelected().getMailboxId(), idSet, e);
-            no(imapCommand, tag, responder, HumanReadableText.SAVE_FAILED);
+            no(request, responder, HumanReadableText.SAVE_FAILED);
         }
     }
     
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/SubscribeProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/SubscribeProcessor.java
index 7c53735..b4a2797 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/SubscribeProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/SubscribeProcessor.java
@@ -54,12 +54,12 @@ public class SubscribeProcessor extends AbstractSubscriptionProcessor<SubscribeR
             getSubscriptionManager().subscribe(mailboxSession, mailboxName);
 
             unsolicitedResponses(session, responder, false);
-            okComplete(command, tag, responder);
+            okComplete(request, responder);
 
         } catch (SubscriptionException e) {
             LOGGER.info("Subscribe failed for mailbox {}", mailboxName, e);
             unsolicitedResponses(session, responder, false);
-            no(command, tag, responder, HumanReadableText.GENERIC_SUBSCRIPTION_FAILURE);
+            no(request, responder, HumanReadableText.GENERIC_SUBSCRIPTION_FAILURE);
         }
     }
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/UnselectProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/UnselectProcessor.java
index 19dd80e..0edf0e7 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/UnselectProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/UnselectProcessor.java
@@ -52,9 +52,9 @@ public class UnselectProcessor extends AbstractMailboxProcessor<UnselectRequest>
     protected void doProcess(UnselectRequest message, ImapSession session, Tag tag, ImapCommand command, Responder responder) {
         if (session.getSelected() != null) {
             session.deselect();
-            okComplete(command, tag, responder);
+            okComplete(message, responder);
         } else {
-            taggedBad(command, tag, responder, HumanReadableText.UNSELECT);
+            taggedBad(message, responder, HumanReadableText.UNSELECT);
         }
 
     }
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/UnsubscribeProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/UnsubscribeProcessor.java
index 853ff7f..17fdcb4 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/UnsubscribeProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/UnsubscribeProcessor.java
@@ -54,13 +54,13 @@ public class UnsubscribeProcessor extends AbstractSubscriptionProcessor<Unsubscr
             getSubscriptionManager().unsubscribe(mailboxSession, mailboxName);
 
             unsolicitedResponses(session, responder, false);
-            okComplete(command, tag, responder);
+            okComplete(request, responder);
 
         } catch (SubscriptionException e) {
             LOGGER.info("Unsubscribe failed for mailbox {}", mailboxName, e);
             unsolicitedResponses(session, responder, false);
 
-            no(command, tag, responder, HumanReadableText.GENERIC_SUBSCRIPTION_FAILURE);
+            no(request, responder, HumanReadableText.GENERIC_SUBSCRIPTION_FAILURE);
         }
     }
 
diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java
index fa26006..7aeb44d 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/fetch/FetchProcessor.java
@@ -81,12 +81,12 @@ public class FetchProcessor extends AbstractMailboxProcessor<FetchRequest> {
 
             final boolean vanished = fetch.getVanished();
             if (vanished && !EnableProcessor.getEnabledCapabilities(session).contains(ImapConstants.SUPPORTS_QRESYNC)) {
-                taggedBad(command, tag, responder, HumanReadableText.QRESYNC_NOT_ENABLED);
+                taggedBad(request, responder, HumanReadableText.QRESYNC_NOT_ENABLED);
                 return;
             }
            
             if (vanished && changedSince == -1) {
-                taggedBad(command, tag, responder, HumanReadableText.QRESYNC_VANISHED_WITHOUT_CHANGEDSINCE);
+                taggedBad(request, responder, HumanReadableText.QRESYNC_VANISHED_WITHOUT_CHANGEDSINCE);
                 return;
             }
             final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
@@ -124,13 +124,13 @@ public class FetchProcessor extends AbstractMailboxProcessor<FetchRequest> {
             // processor. See IMAP-284
             final boolean omitExpunged = (!useUids);
             unsolicitedResponses(session, responder, omitExpunged, useUids);
-            okComplete(command, tag, responder);
+            okComplete(request, responder);
         } catch (MessageRangeException e) {
             LOGGER.debug("Fetch failed for mailbox {} because of invalid sequence-set {}", session.getSelected().getMailboxId(), idSet, e);
-            taggedBad(command, tag, responder, HumanReadableText.INVALID_MESSAGESET);
+            taggedBad(request, responder, HumanReadableText.INVALID_MESSAGESET);
         } catch (MailboxException e) {
             LOGGER.error("Fetch failed for mailbox {} and sequence-set {}", session.getSelected().getMailboxId(), idSet, e);
-            no(command, tag, responder, HumanReadableText.SEARCH_FAILED);
+            no(request, responder, HumanReadableText.SEARCH_FAILED);
         }
     }
 


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


[james-project] 13/30: [Refactoring] Moving tests in mailbox.acl to JUnit 5

Posted by bt...@apache.org.
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 6520ebd500bca03fa01ca2465cd58f3200b64fda
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Mon Nov 11 16:21:36 2019 +0700

    [Refactoring] Moving tests in mailbox.acl to JUnit 5
---
 .../org/apache/james/mailbox/acl/ACLDiffTest.java  | 34 ++++++++--------
 .../mailbox/acl/PositiveUserACLChangedTest.java    |  6 +--
 .../james/mailbox/acl/PositiveUserACLDiffTest.java | 46 +++++++++++-----------
 .../acl/SimpleGroupMembershipResolverTest.java     | 18 ++++-----
 .../mailbox/acl/UnionMailboxACLResolverTest.java   | 26 ++++++------
 5 files changed, 65 insertions(+), 65 deletions(-)

diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/acl/ACLDiffTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/acl/ACLDiffTest.java
index a983d9f..4cd679f 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/acl/ACLDiffTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/acl/ACLDiffTest.java
@@ -23,14 +23,14 @@ import static org.assertj.core.api.Assertions.assertThat;
 
 import org.apache.james.mailbox.exception.UnsupportedRightException;
 import org.apache.james.mailbox.model.MailboxACL;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-public class ACLDiffTest {
+class ACLDiffTest {
     private static final MailboxACL.EntryKey ENTRY_KEY = MailboxACL.EntryKey.createGroupEntryKey("any", false);
     private static final MailboxACL.Rfc4314Rights RIGHTS = new MailboxACL.Rfc4314Rights(MailboxACL.Right.Administer);
 
     @Test
-    public void addedEntriesShouldReturnEmptyWhenSameACL() {
+    void addedEntriesShouldReturnEmptyWhenSameACL() {
         ACLDiff aclDiff = ACLDiff.computeDiff(
             MailboxACL.EMPTY,
             MailboxACL.EMPTY);
@@ -39,7 +39,7 @@ public class ACLDiffTest {
     }
 
     @Test
-    public void addedEntriesShouldReturnEmptyWhenSameNonEmptyACL() throws UnsupportedRightException {
+    void addedEntriesShouldReturnEmptyWhenSameNonEmptyACL() throws UnsupportedRightException {
         MailboxACL mailboxACL = MailboxACL.EMPTY.apply(
             MailboxACL.command()
                 .key(ENTRY_KEY)
@@ -52,7 +52,7 @@ public class ACLDiffTest {
     }
 
     @Test
-    public void removedEntriesShouldReturnEmptyWhenSameACL() {
+    void removedEntriesShouldReturnEmptyWhenSameACL() {
         ACLDiff aclDiff = ACLDiff.computeDiff(
             MailboxACL.EMPTY,
             MailboxACL.EMPTY);
@@ -61,7 +61,7 @@ public class ACLDiffTest {
     }
 
     @Test
-    public void removedEntriesShouldReturnEmptyWhenSameNonEmptyACL() throws UnsupportedRightException {
+    void removedEntriesShouldReturnEmptyWhenSameNonEmptyACL() throws UnsupportedRightException {
         MailboxACL mailboxACL = MailboxACL.EMPTY.apply(
             MailboxACL.command()
                 .key(ENTRY_KEY)
@@ -74,7 +74,7 @@ public class ACLDiffTest {
     }
 
     @Test
-    public void changedEntriesShouldReturnEmptyWhenSameACL() {
+    void changedEntriesShouldReturnEmptyWhenSameACL() {
         ACLDiff aclDiff = ACLDiff.computeDiff(
             MailboxACL.EMPTY,
             MailboxACL.EMPTY);
@@ -83,7 +83,7 @@ public class ACLDiffTest {
     }
 
     @Test
-    public void changedEntriesShouldReturnEmptyWhenSameNonEmptyACL() throws UnsupportedRightException {
+    void changedEntriesShouldReturnEmptyWhenSameNonEmptyACL() throws UnsupportedRightException {
         MailboxACL mailboxACL = MailboxACL.EMPTY.apply(
             MailboxACL.command()
                 .key(ENTRY_KEY)
@@ -96,7 +96,7 @@ public class ACLDiffTest {
     }
     
     @Test
-    public void addedEntriesShouldReturnNewEntryWhenAddedEntry() throws Exception {
+    void addedEntriesShouldReturnNewEntryWhenAddedEntry() throws Exception {
         ACLDiff aclDiff = ACLDiff.computeDiff(
             MailboxACL.EMPTY,
             MailboxACL.EMPTY.apply(
@@ -110,7 +110,7 @@ public class ACLDiffTest {
     }
 
     @Test
-    public void changedEntriesShouldReturnEmptyWhenAddedEntry() throws Exception {
+    void changedEntriesShouldReturnEmptyWhenAddedEntry() throws Exception {
         ACLDiff aclDiff = ACLDiff.computeDiff(
             MailboxACL.EMPTY,
             MailboxACL.EMPTY.apply(
@@ -124,7 +124,7 @@ public class ACLDiffTest {
     }
 
     @Test
-    public void removedEntriesShouldReturnEmptyWhenAddedEntry() throws Exception {
+    void removedEntriesShouldReturnEmptyWhenAddedEntry() throws Exception {
         ACLDiff aclDiff = ACLDiff.computeDiff(
             MailboxACL.EMPTY,
             MailboxACL.EMPTY.apply(
@@ -138,7 +138,7 @@ public class ACLDiffTest {
     }
 
     @Test
-    public void addedEntriesShouldReturnEmptyWhenRemovedEntry() throws Exception {
+    void addedEntriesShouldReturnEmptyWhenRemovedEntry() throws Exception {
         ACLDiff aclDiff = ACLDiff.computeDiff(
             MailboxACL.EMPTY.apply(
                 MailboxACL.command()
@@ -152,7 +152,7 @@ public class ACLDiffTest {
     }
 
     @Test
-    public void changedEntriesShouldReturnEmptyWhenRemovedEntry() throws Exception {
+    void changedEntriesShouldReturnEmptyWhenRemovedEntry() throws Exception {
         ACLDiff aclDiff = ACLDiff.computeDiff(
             MailboxACL.EMPTY.apply(
                 MailboxACL.command()
@@ -166,7 +166,7 @@ public class ACLDiffTest {
     }
 
     @Test
-    public void removedEntriesShouldReturnEntryWhenRemovedEntry() throws Exception {
+    void removedEntriesShouldReturnEntryWhenRemovedEntry() throws Exception {
         ACLDiff aclDiff = ACLDiff.computeDiff(
             MailboxACL.EMPTY.apply(
                 MailboxACL.command()
@@ -180,7 +180,7 @@ public class ACLDiffTest {
     }
 
     @Test
-    public void removedEntriesShouldReturnEmptyWhenChangedEntry() throws Exception {
+    void removedEntriesShouldReturnEmptyWhenChangedEntry() throws Exception {
         ACLDiff aclDiff = ACLDiff.computeDiff(
             MailboxACL.EMPTY.apply(
                 MailboxACL.command()
@@ -198,7 +198,7 @@ public class ACLDiffTest {
     }
 
     @Test
-    public void addedEntriesShouldReturnEmptyWhenChangedEntry() throws Exception {
+    void addedEntriesShouldReturnEmptyWhenChangedEntry() throws Exception {
         ACLDiff aclDiff = ACLDiff.computeDiff(
             MailboxACL.EMPTY.apply(
                 MailboxACL.command()
@@ -216,7 +216,7 @@ public class ACLDiffTest {
     }
 
     @Test
-    public void changedEntriesShouldReturnEntryWhenChangedEntry() throws Exception {
+    void changedEntriesShouldReturnEntryWhenChangedEntry() throws Exception {
         ACLDiff aclDiff = ACLDiff.computeDiff(
             MailboxACL.EMPTY.apply(
                 MailboxACL.command()
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/acl/PositiveUserACLChangedTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/acl/PositiveUserACLChangedTest.java
index 70a5ee7..c391e2d 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/acl/PositiveUserACLChangedTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/acl/PositiveUserACLChangedTest.java
@@ -19,14 +19,14 @@
 
 package org.apache.james.mailbox.acl;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
 
-public class PositiveUserACLChangedTest {
+class PositiveUserACLChangedTest {
 
     @Test
-    public void shouldMatchBeanContact() {
+    void shouldMatchBeanContact() {
         EqualsVerifier.forClass(PositiveUserACLChanged.class)
             .verify();
     }
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/acl/PositiveUserACLDiffTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/acl/PositiveUserACLDiffTest.java
index 999f8c4..257a1a6 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/acl/PositiveUserACLDiffTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/acl/PositiveUserACLDiffTest.java
@@ -26,9 +26,9 @@ import org.apache.james.mailbox.model.MailboxACL.Entry;
 import org.apache.james.mailbox.model.MailboxACL.EntryKey;
 import org.apache.james.mailbox.model.MailboxACL.Rfc4314Rights;
 import org.apache.james.mailbox.model.MailboxACL.Right;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-public class PositiveUserACLDiffTest {
+class PositiveUserACLDiffTest {
 
     private static final EntryKey USER_ENTRY_KEY = EntryKey.createUserEntryKey("user");
     private static final EntryKey NEGATIVE_USER_ENTRY_KEY = EntryKey.createUserEntryKey("user", true);
@@ -36,7 +36,7 @@ public class PositiveUserACLDiffTest {
     private static final Rfc4314Rights RIGHTS = new Rfc4314Rights(Right.Administer);
 
     @Test
-    public void addedEntriesShouldReturnEmptyWhenSameACL() {
+    void addedEntriesShouldReturnEmptyWhenSameACL() {
         PositiveUserACLDiff positiveUserAclDiff = PositiveUserACLDiff.computeDiff(
             MailboxACL.EMPTY,
             MailboxACL.EMPTY);
@@ -45,7 +45,7 @@ public class PositiveUserACLDiffTest {
     }
 
     @Test
-    public void addedEntriesShouldReturnEmptyWhenSameNonEmptyACL() throws UnsupportedRightException {
+    void addedEntriesShouldReturnEmptyWhenSameNonEmptyACL() throws UnsupportedRightException {
         MailboxACL mailboxACL = MailboxACL.EMPTY.apply(
             MailboxACL.command()
                 .key(USER_ENTRY_KEY)
@@ -58,7 +58,7 @@ public class PositiveUserACLDiffTest {
     }
 
     @Test
-    public void removedEntriesShouldReturnEmptyWhenSameACL() {
+    void removedEntriesShouldReturnEmptyWhenSameACL() {
         PositiveUserACLDiff positiveUserAclDiff = PositiveUserACLDiff.computeDiff(
             MailboxACL.EMPTY,
             MailboxACL.EMPTY);
@@ -67,7 +67,7 @@ public class PositiveUserACLDiffTest {
     }
 
     @Test
-    public void removedEntriesShouldReturnEmptyWhenSameNonEmptyACL() throws UnsupportedRightException {
+    void removedEntriesShouldReturnEmptyWhenSameNonEmptyACL() throws UnsupportedRightException {
         MailboxACL mailboxACL = MailboxACL.EMPTY.apply(
             MailboxACL.command()
                 .key(USER_ENTRY_KEY)
@@ -80,7 +80,7 @@ public class PositiveUserACLDiffTest {
     }
 
     @Test
-    public void changedEntriesShouldReturnEmptyWhenSameACL() {
+    void changedEntriesShouldReturnEmptyWhenSameACL() {
         PositiveUserACLDiff positiveUserAclDiff = PositiveUserACLDiff.computeDiff(
             MailboxACL.EMPTY,
             MailboxACL.EMPTY);
@@ -89,7 +89,7 @@ public class PositiveUserACLDiffTest {
     }
 
     @Test
-    public void changedEntriesShouldReturnEmptyWhenSameNonEmptyACL() throws UnsupportedRightException {
+    void changedEntriesShouldReturnEmptyWhenSameNonEmptyACL() throws UnsupportedRightException {
         MailboxACL mailboxACL = MailboxACL.EMPTY.apply(
             MailboxACL.command()
                 .key(USER_ENTRY_KEY)
@@ -102,7 +102,7 @@ public class PositiveUserACLDiffTest {
     }
 
     @Test
-    public void addedEntriesShouldReturnNewEntryWhenAddedEntry() throws Exception {
+    void addedEntriesShouldReturnNewEntryWhenAddedEntry() throws Exception {
         PositiveUserACLDiff positiveUserAclDiff = PositiveUserACLDiff.computeDiff(
             MailboxACL.EMPTY,
             MailboxACL.EMPTY.apply(
@@ -116,7 +116,7 @@ public class PositiveUserACLDiffTest {
     }
 
     @Test
-    public void addedEntriesShouldFilterNonUserEntryKey() throws Exception {
+    void addedEntriesShouldFilterNonUserEntryKey() throws Exception {
         PositiveUserACLDiff positiveUserAclDiff = PositiveUserACLDiff.computeDiff(
             MailboxACL.EMPTY,
             MailboxACL.EMPTY.apply(
@@ -130,7 +130,7 @@ public class PositiveUserACLDiffTest {
     }
 
     @Test
-    public void addedEntriesShouldFilterNegativeUserEntryKey() throws Exception {
+    void addedEntriesShouldFilterNegativeUserEntryKey() throws Exception {
         PositiveUserACLDiff positiveUserAclDiff = PositiveUserACLDiff.computeDiff(
             MailboxACL.EMPTY,
             MailboxACL.EMPTY.apply(
@@ -144,7 +144,7 @@ public class PositiveUserACLDiffTest {
     }
 
     @Test
-    public void changedEntriesShouldReturnEmptyWhenAddedEntry() throws Exception {
+    void changedEntriesShouldReturnEmptyWhenAddedEntry() throws Exception {
         PositiveUserACLDiff positiveUserAclDiff = PositiveUserACLDiff.computeDiff(
             MailboxACL.EMPTY,
             MailboxACL.EMPTY.apply(
@@ -158,7 +158,7 @@ public class PositiveUserACLDiffTest {
     }
 
     @Test
-    public void removedEntriesShouldReturnEmptyWhenAddedEntry() throws Exception {
+    void removedEntriesShouldReturnEmptyWhenAddedEntry() throws Exception {
         PositiveUserACLDiff positiveUserAclDiff = PositiveUserACLDiff.computeDiff(
             MailboxACL.EMPTY,
             MailboxACL.EMPTY.apply(
@@ -172,7 +172,7 @@ public class PositiveUserACLDiffTest {
     }
 
     @Test
-    public void addedEntriesShouldReturnEmptyWhenRemovedEntry() throws Exception {
+    void addedEntriesShouldReturnEmptyWhenRemovedEntry() throws Exception {
         PositiveUserACLDiff positiveUserAclDiff = PositiveUserACLDiff.computeDiff(
             MailboxACL.EMPTY.apply(
                 MailboxACL.command()
@@ -186,7 +186,7 @@ public class PositiveUserACLDiffTest {
     }
 
     @Test
-    public void changedEntriesShouldReturnEmptyWhenRemovedEntry() throws Exception {
+    void changedEntriesShouldReturnEmptyWhenRemovedEntry() throws Exception {
         PositiveUserACLDiff positiveUserAclDiff = PositiveUserACLDiff.computeDiff(
             MailboxACL.EMPTY.apply(
                 MailboxACL.command()
@@ -200,7 +200,7 @@ public class PositiveUserACLDiffTest {
     }
 
     @Test
-    public void removedEntriesShouldReturnEntryWhenRemovedEntry() throws Exception {
+    void removedEntriesShouldReturnEntryWhenRemovedEntry() throws Exception {
         PositiveUserACLDiff positiveUserAclDiff = PositiveUserACLDiff.computeDiff(
             MailboxACL.EMPTY.apply(
                 MailboxACL.command()
@@ -214,7 +214,7 @@ public class PositiveUserACLDiffTest {
     }
 
     @Test
-    public void removedEntriesShouldFilterNonUserEntry() throws Exception {
+    void removedEntriesShouldFilterNonUserEntry() throws Exception {
         PositiveUserACLDiff positiveUserAclDiff = PositiveUserACLDiff.computeDiff(
             MailboxACL.EMPTY.apply(
                 MailboxACL.command()
@@ -228,7 +228,7 @@ public class PositiveUserACLDiffTest {
     }
 
     @Test
-    public void removedEntriesShouldFilterNegativeUserEntry() throws Exception {
+    void removedEntriesShouldFilterNegativeUserEntry() throws Exception {
         PositiveUserACLDiff positiveUserAclDiff = PositiveUserACLDiff.computeDiff(
             MailboxACL.EMPTY.apply(
                 MailboxACL.command()
@@ -242,7 +242,7 @@ public class PositiveUserACLDiffTest {
     }
 
     @Test
-    public void removedEntriesShouldReturnEmptyWhenChangedEntry() throws Exception {
+    void removedEntriesShouldReturnEmptyWhenChangedEntry() throws Exception {
         PositiveUserACLDiff positiveUserAclDiff = PositiveUserACLDiff.computeDiff(
             MailboxACL.EMPTY.apply(
                 MailboxACL.command()
@@ -260,7 +260,7 @@ public class PositiveUserACLDiffTest {
     }
 
     @Test
-    public void addedEntriesShouldReturnEmptyWhenChangedEntry() throws Exception {
+    void addedEntriesShouldReturnEmptyWhenChangedEntry() throws Exception {
         PositiveUserACLDiff positiveUserAclDiff = PositiveUserACLDiff.computeDiff(
             MailboxACL.EMPTY.apply(
                 MailboxACL.command()
@@ -278,7 +278,7 @@ public class PositiveUserACLDiffTest {
     }
 
     @Test
-    public void changedEntriesShouldReturnEntryWhenChangedEntry() throws Exception {
+    void changedEntriesShouldReturnEntryWhenChangedEntry() throws Exception {
         PositiveUserACLDiff positiveUserAclDiff = PositiveUserACLDiff.computeDiff(
             MailboxACL.EMPTY.apply(
                 MailboxACL.command()
@@ -296,7 +296,7 @@ public class PositiveUserACLDiffTest {
     }
 
     @Test
-    public void changedEntriesShouldFilterNonUserEntry() throws Exception {
+    void changedEntriesShouldFilterNonUserEntry() throws Exception {
         PositiveUserACLDiff positiveUserAclDiff = PositiveUserACLDiff.computeDiff(
             MailboxACL.EMPTY.apply(
                 MailboxACL.command()
@@ -314,7 +314,7 @@ public class PositiveUserACLDiffTest {
     }
 
     @Test
-    public void changedEntriesShouldFilterNegativeUserEntry() throws Exception {
+    void changedEntriesShouldFilterNegativeUserEntry() throws Exception {
         PositiveUserACLDiff positiveUserAclDiff = PositiveUserACLDiff.computeDiff(
             MailboxACL.EMPTY.apply(
                 MailboxACL.command()
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/acl/SimpleGroupMembershipResolverTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/acl/SimpleGroupMembershipResolverTest.java
index f77dbbb..ece7ff9 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/acl/SimpleGroupMembershipResolverTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/acl/SimpleGroupMembershipResolverTest.java
@@ -22,20 +22,20 @@ package org.apache.james.mailbox.acl;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-public class SimpleGroupMembershipResolverTest {
+class SimpleGroupMembershipResolverTest {
 
     private SimpleGroupMembershipResolver simpleGroupMembershipResolver;
 
-    @Before
-    public void setUp() {
+    @BeforeEach
+    void setUp() {
        simpleGroupMembershipResolver = new SimpleGroupMembershipResolver();
     }
 
     @Test
-    public void isMemberShouldReturnFalseWhenEmptyResolver() throws Exception {
+    void isMemberShouldReturnFalseWhenEmptyResolver() {
         //When
         boolean actual = simpleGroupMembershipResolver.isMember("user", "group");
         //Then
@@ -43,7 +43,7 @@ public class SimpleGroupMembershipResolverTest {
     }
 
     @Test
-    public void isMemberShouldReturnTrueWhenTheSearchedMembershipIsPresent() throws Exception {
+    void isMemberShouldReturnTrueWhenTheSearchedMembershipIsPresent() {
         //Given
         simpleGroupMembershipResolver.addMembership("group", "user");
         //When
@@ -53,7 +53,7 @@ public class SimpleGroupMembershipResolverTest {
     }
 
     @Test
-    public void addMembershipShouldAddAMembershipWhenNonNullUser() throws Exception {
+    void addMembershipShouldAddAMembershipWhenNonNullUser() {
         //When
         simpleGroupMembershipResolver.addMembership("group", "user");
         boolean actual = simpleGroupMembershipResolver.isMember("user", "group");
@@ -62,7 +62,7 @@ public class SimpleGroupMembershipResolverTest {
     }
 
     @Test
-    public void addMembershipShouldAddAMembershipWithANullUser() throws Exception {
+    void addMembershipShouldAddAMembershipWithANullUser() {
         //Given
         String userAdded = null;
         //When
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/acl/UnionMailboxACLResolverTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/acl/UnionMailboxACLResolverTest.java
index 9d34634..b133994 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/acl/UnionMailboxACLResolverTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/acl/UnionMailboxACLResolverTest.java
@@ -28,10 +28,10 @@ import org.apache.james.mailbox.model.MailboxACL.Entry;
 import org.apache.james.mailbox.model.MailboxACL.EntryKey;
 import org.apache.james.mailbox.model.MailboxACL.NameType;
 import org.apache.james.mailbox.model.MailboxACL.Rfc4314Rights;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 
-public class UnionMailboxACLResolverTest {
+class UnionMailboxACLResolverTest {
 
     private static final String GROUP_1 = "group1";
     private static final String GROUP_2 = "group2";
@@ -60,8 +60,8 @@ public class UnionMailboxACLResolverTest {
     private EntryKey group1Key;
     private EntryKey group2Key;
 
-    @Before
-    public void setUp() throws Exception {
+    @BeforeEach
+    void setUp() throws Exception {
         user1Key = EntryKey.createUserEntryKey(USER_1);
         user2Key = EntryKey.createUserEntryKey(USER_2);
         group1Key = EntryKey.createGroupEntryKey(GROUP_1);
@@ -99,7 +99,7 @@ public class UnionMailboxACLResolverTest {
     }
 
     @Test
-    public void testAppliesNullUser() throws UnsupportedRightException {
+    void testAppliesNullUser() throws UnsupportedRightException {
 
         assertThat(UnionMailboxACLResolver.applies(user1Key, null, groupMembershipResolver, USER_1, false)).isFalse();
         assertThat(UnionMailboxACLResolver.applies(user2Key, null, groupMembershipResolver, USER_1, false)).isFalse();
@@ -111,7 +111,7 @@ public class UnionMailboxACLResolverTest {
     }
 
     @Test
-    public void testAppliesUser() throws UnsupportedRightException {
+    void testAppliesUser() throws UnsupportedRightException {
         /* requester is the resource owner */
         assertThat(UnionMailboxACLResolver.applies(user1Key, user1Key, groupMembershipResolver, USER_1, false)).isTrue();
         assertThat(UnionMailboxACLResolver.applies(user2Key, user1Key, groupMembershipResolver, USER_1, false)).isFalse();
@@ -160,7 +160,7 @@ public class UnionMailboxACLResolverTest {
     }
 
     @Test
-    public void testResolveRightsNullUser() throws UnsupportedRightException {
+    void testResolveRightsNullUser() throws UnsupportedRightException {
 
         assertThat(
             anyoneReadListGlobal.resolveRights(null, groupMembershipResolver, user1Read, USER_1, false)
@@ -399,7 +399,7 @@ public class UnionMailboxACLResolverTest {
     }
 
     @Test
-    public void testResolveRightsNullUserGlobals() throws UnsupportedRightException {
+    void testResolveRightsNullUserGlobals() throws UnsupportedRightException {
         assertThat(
             anyoneReadListGlobal.resolveRights(null, groupMembershipResolver, user1Read, USER_2, false)
                 .contains(MailboxACL.Right.Read))
@@ -424,7 +424,7 @@ public class UnionMailboxACLResolverTest {
 
 
     @Test
-    public void testResolveRightsUserSelfOwner() throws UnsupportedRightException {
+    void testResolveRightsUserSelfOwner() throws UnsupportedRightException {
 
         assertThat(
             anyoneReadListGlobal.resolveRights(USER_1, groupMembershipResolver, user1Read, USER_1, false)
@@ -659,7 +659,7 @@ public class UnionMailboxACLResolverTest {
 
 
     @Test
-    public void testResolveRightsUserNotOwner() throws UnsupportedRightException {
+    void testResolveRightsUserNotOwner() throws UnsupportedRightException {
 
         assertThat(
             anyoneReadListGlobal.resolveRights(USER_1, groupMembershipResolver, user1Read, USER_2, false)
@@ -893,7 +893,7 @@ public class UnionMailboxACLResolverTest {
     }
 
     @Test
-    public void testResolveRightsUserMemberOfOwnerGroup() throws UnsupportedRightException {
+    void testResolveRightsUserMemberOfOwnerGroup() throws UnsupportedRightException {
 
         assertThat(
             anyoneReadListGlobal.resolveRights(USER_1, groupMembershipResolver, user1Read, GROUP_1, true)
@@ -1128,7 +1128,7 @@ public class UnionMailboxACLResolverTest {
 
 
     @Test
-    public void testResolveRightsUserNotMemberOfOwnerGroup() throws UnsupportedRightException {
+    void testResolveRightsUserNotMemberOfOwnerGroup() throws UnsupportedRightException {
 
         assertThat(
             anyoneReadListGlobal.resolveRights(USER_1, groupMembershipResolver, user1Read, GROUP_2, true)


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


[james-project] 22/30: MAILBOX-392 Strengthen MailboxName validation

Posted by bt...@apache.org.
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 2f882d4f36a4afa6d32b115c48ed6ca8ff7c3710
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Tue Nov 12 12:22:09 2019 +0700

    MAILBOX-392 Strengthen MailboxName validation
---
 .../apache/james/mailbox/model/MailboxPath.java    | 31 +++++++++++-
 .../james/mailbox/model/MailboxPathTest.java       | 56 ++++++++++++++++++++++
 .../james/mailbox/store/StoreMailboxManager.java   | 17 +------
 3 files changed, 88 insertions(+), 16 deletions(-)

diff --git a/mailbox/api/src/main/java/org/apache/james/mailbox/model/MailboxPath.java b/mailbox/api/src/main/java/org/apache/james/mailbox/model/MailboxPath.java
index 92cbde1..27051e3 100644
--- a/mailbox/api/src/main/java/org/apache/james/mailbox/model/MailboxPath.java
+++ b/mailbox/api/src/main/java/org/apache/james/mailbox/model/MailboxPath.java
@@ -26,7 +26,11 @@ import java.util.Optional;
 
 import org.apache.james.mailbox.DefaultMailboxes;
 import org.apache.james.mailbox.MailboxSession;
+import org.apache.james.mailbox.exception.HasEmptyMailboxNameInHierarchyException;
+import org.apache.james.mailbox.exception.MailboxNameException;
+import org.apache.james.mailbox.exception.TooLongMailboxNameException;
 
+import com.google.common.base.CharMatcher;
 import com.google.common.collect.ImmutableList;
 
 /**
@@ -48,6 +52,11 @@ public class MailboxPath {
         return new MailboxPath(MailboxConstants.USER_NAMESPACE, username, mailboxName);
     }
 
+    private static final String INVALID_CHARS = "%*&#";
+    private static final CharMatcher INVALID_CHARS_MATCHER = CharMatcher.anyOf(INVALID_CHARS);
+    // This is the size that all mailbox backend should support
+    public  static final int MAX_MAILBOX_NAME_LENGTH = 200;
+
     private final String namespace;
     private final String user;
     private final String name;
@@ -136,7 +145,27 @@ public class MailboxPath {
         return this;
     }
 
-    public boolean hasEmptyNameInHierarchy(char pathDelimiter) {
+    public void assertAcceptable(char pathDelimiter) throws MailboxNameException {
+        if (hasEmptyNameInHierarchy(pathDelimiter)) {
+            throw new HasEmptyMailboxNameInHierarchyException(asString());
+        }
+        if (nameContainsForbiddenCharacters()) {
+            throw new MailboxNameException(asString() + " contains one of the forbidden characters " + INVALID_CHARS);
+        }
+        if (isMailboxNameTooLong()) {
+            throw new TooLongMailboxNameException("Mailbox name exceeds maximum size of " + MAX_MAILBOX_NAME_LENGTH + " characters");
+        }
+    }
+
+    private boolean nameContainsForbiddenCharacters() {
+        return INVALID_CHARS_MATCHER.matchesAnyOf(name);
+    }
+
+    private boolean isMailboxNameTooLong() {
+        return name.length() > MAX_MAILBOX_NAME_LENGTH;
+    }
+
+    boolean hasEmptyNameInHierarchy(char pathDelimiter) {
         String delimiterString = String.valueOf(pathDelimiter);
         return this.name.isEmpty()
             || this.name.contains(delimiterString + delimiterString)
diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxPathTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxPathTest.java
index b1817cc..321f58f 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxPathTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/model/MailboxPathTest.java
@@ -21,9 +21,16 @@
 package org.apache.james.mailbox.model;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatCode;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import org.apache.james.mailbox.DefaultMailboxes;
 import org.junit.jupiter.api.Test;
+import org.apache.james.mailbox.exception.HasEmptyMailboxNameInHierarchyException;
+import org.apache.james.mailbox.exception.MailboxNameException;
+import org.apache.james.mailbox.exception.TooLongMailboxNameException;
+
+import com.google.common.base.Strings;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
 
@@ -182,6 +189,55 @@ class MailboxPathTest {
     }
 
     @Test
+    void assertAcceptableShouldThrowOnDoubleSeparator() {
+        assertThatThrownBy(() -> MailboxPath.forUser("user", "a..b")
+                .assertAcceptable('.'))
+            .isInstanceOf(HasEmptyMailboxNameInHierarchyException.class);
+    }
+
+    @Test
+    void assertAcceptableShouldThrowOnAnd() {
+        assertThatThrownBy(() -> MailboxPath.forUser("user", "a&b")
+                .assertAcceptable('.'))
+            .isInstanceOf(MailboxNameException.class);
+    }
+
+    @Test
+    void assertAcceptableShouldThrowOnSharp() {
+        assertThatThrownBy(() -> MailboxPath.forUser("user", "a#b")
+                .assertAcceptable('.'))
+            .isInstanceOf(MailboxNameException.class);
+    }
+
+    @Test
+    void assertAcceptableShouldThrowOnPercent() {
+        assertThatThrownBy(() -> MailboxPath.forUser("user", "a%b")
+                .assertAcceptable('.'))
+            .isInstanceOf(MailboxNameException.class);
+    }
+
+    @Test
+    void assertAcceptableShouldThrowOnWildcard() {
+        assertThatThrownBy(() -> MailboxPath.forUser("user", "a*b")
+                .assertAcceptable('.'))
+            .isInstanceOf(MailboxNameException.class);
+    }
+
+    @Test
+    void assertAcceptableShouldThrowOnTooLongMailboxName() {
+        assertThatThrownBy(() -> MailboxPath.forUser("user", Strings.repeat("a", 201))
+                .assertAcceptable('.'))
+            .isInstanceOf(TooLongMailboxNameException.class);
+    }
+
+    @Test
+    void assertAcceptableShouldNotThrowOnNotTooLongMailboxName() {
+        assertThatCode(() -> MailboxPath.forUser("user", Strings.repeat("a", 200))
+                .assertAcceptable('.'))
+            .doesNotThrowAnyException();
+    }
+
+    @Test
     void isInboxShouldReturnTrueWhenINBOX() {
         MailboxPath mailboxPath = new MailboxPath(MailboxConstants.USER_NAMESPACE, "user", DefaultMailboxes.INBOX);
         assertThat(mailboxPath.isInbox()).isTrue();
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
index 86f3ebe..d334fa2 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
@@ -42,13 +42,11 @@ import org.apache.james.mailbox.MessageManager;
 import org.apache.james.mailbox.MetadataWithMailboxId;
 import org.apache.james.mailbox.events.EventBus;
 import org.apache.james.mailbox.events.MailboxIdRegistrationKey;
-import org.apache.james.mailbox.exception.HasEmptyMailboxNameInHierarchyException;
 import org.apache.james.mailbox.exception.InboxAlreadyCreated;
 import org.apache.james.mailbox.exception.InsufficientRightsException;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.exception.MailboxExistsException;
 import org.apache.james.mailbox.exception.MailboxNotFoundException;
-import org.apache.james.mailbox.exception.TooLongMailboxNameException;
 import org.apache.james.mailbox.extension.PreDeletionHook;
 import org.apache.james.mailbox.model.Mailbox;
 import org.apache.james.mailbox.model.MailboxACL;
@@ -322,18 +320,12 @@ public class StoreMailboxManager implements MailboxManager {
             LOGGER.warn("Ignoring mailbox with empty name");
         } else {
             MailboxPath sanitizedMailboxPath = mailboxPath.sanitize(mailboxSession.getPathDelimiter());
-            if (isMailboxNameTooLong(mailboxPath)) {
-                throw new TooLongMailboxNameException("Mailbox name exceed maximum size of " + MAX_MAILBOX_NAME_LENGTH + " characters");
-            }
+            sanitizedMailboxPath.assertAcceptable(mailboxSession.getPathDelimiter());
 
             if (mailboxExists(sanitizedMailboxPath, mailboxSession)) {
                 throw new MailboxExistsException(sanitizedMailboxPath.asString());
             }
 
-            if (sanitizedMailboxPath.hasEmptyNameInHierarchy(mailboxSession.getPathDelimiter())) {
-                throw new HasEmptyMailboxNameInHierarchyException(sanitizedMailboxPath.asString());
-            }
-
             List<MailboxId> mailboxIds = createMailboxesForPath(mailboxSession, sanitizedMailboxPath);
 
             if (!mailboxIds.isEmpty()) {
@@ -468,12 +460,7 @@ public class StoreMailboxManager implements MailboxManager {
         if (mailboxExists(sanitizedMailboxPath, session)) {
             throw new MailboxExistsException(sanitizedMailboxPath.toString());
         }
-        if (isMailboxNameTooLong(sanitizedMailboxPath)) {
-            throw new TooLongMailboxNameException("Mailbox name exceed maximum size of " + MAX_MAILBOX_NAME_LENGTH + " characters");
-        }
-        if (sanitizedMailboxPath.hasEmptyNameInHierarchy(session.getPathDelimiter())) {
-            throw new HasEmptyMailboxNameInHierarchyException(to.asString());
-        }
+        sanitizedMailboxPath.assertAcceptable(session.getPathDelimiter());
 
         assertIsOwner(session, from);
         MailboxMapper mapper = mailboxSessionMapperFactory.getMailboxMapper(session);


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


[james-project] 26/30: [Refactoring] replace some System.out by a logger

Posted by bt...@apache.org.
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 8226d098e61d6304222b90f02ca692fee59058ba
Author: Matthieu Baechler <ma...@apache.org>
AuthorDate: Wed Nov 13 16:27:07 2019 +0100

    [Refactoring] replace some System.out by a logger
---
 .../james/mailrepository/file/FileMailRepository.java    | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java b/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java
index c818b65..8d71e69 100644
--- a/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java
+++ b/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java
@@ -73,13 +73,6 @@ import com.google.common.collect.Iterators;
 public class FileMailRepository implements MailRepository, Configurable, Initializable {
     private static final Logger LOGGER = LoggerFactory.getLogger(FileMailRepository.class);
 
-
-    /**
-     * Whether 'deep debugging' is turned on.
-     */
-    private static final boolean DEEP_DEBUG = false;
-
-
     private FilePersistentStreamRepository streamRepository;
     private FilePersistentObjectRepository objectRepository;
     private String destination;
@@ -246,12 +239,9 @@ public class FileMailRepository implements MailRepository, Configurable, Initial
         }
         if (message instanceof MimeMessageWrapper) {
             MimeMessageWrapper wrapper = (MimeMessageWrapper) message;
-            if (DEEP_DEBUG) {
-                System.out.println("Retrieving from: " + wrapper.getSourceId());
-                String debugBuffer = "Saving to:       " + destination + "/" + mc.getName();
-                System.out.println(debugBuffer);
-                System.out.println("Modified: " + wrapper.isModified());
-            }
+            LOGGER.trace("Retrieving from: {}", wrapper.getSourceId());
+            LOGGER.trace("Saving to:       {}/{}", destination, mc.getName());
+            LOGGER.trace("Modified: {}", wrapper.isModified());
             String destinationBuffer = destination + "/" + mc.getName();
             if (destinationBuffer.equals(wrapper.getSourceId())) {
                 if (!wrapper.isModified()) {


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


[james-project] 14/30: [Refactoring] Moving tests in mailbox.extractor to JUnit 5

Posted by bt...@apache.org.
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 180b19dfcd280a84397a97cd8f0f95c96ab2847c
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Mon Nov 11 16:21:59 2019 +0700

    [Refactoring] Moving tests in mailbox.extractor to JUnit 5
---
 .../java/org/apache/james/mailbox/extractor/ParsedContentTest.java  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/extractor/ParsedContentTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/extractor/ParsedContentTest.java
index be65e10..a5ef84e 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/extractor/ParsedContentTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/extractor/ParsedContentTest.java
@@ -19,14 +19,14 @@
 
 package org.apache.james.mailbox.extractor;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import nl.jqno.equalsverifier.EqualsVerifier;
 
-public class ParsedContentTest {
+class ParsedContentTest {
 
     @Test
-    public void shouldMatchBeanContract() {
+    void shouldMatchBeanContract() {
         EqualsVerifier.forClass(ParsedContent.class)
             .verify();
     }


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


[james-project] 24/30: [Refactoring] Set.add is idempotent in case of entry already present

Posted by bt...@apache.org.
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 ca3555ec0e0b523003d11a42424dd686927b84b8
Author: Matthieu Baechler <ma...@apache.org>
AuthorDate: Wed Nov 13 16:22:32 2019 +0100

    [Refactoring] Set.add is idempotent in case of entry already present
---
 .../java/org/apache/james/mailrepository/file/FileMailRepository.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java b/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java
index 98c6835..2472531 100644
--- a/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java
+++ b/server/data/data-file/src/main/java/org/apache/james/mailrepository/file/FileMailRepository.java
@@ -232,7 +232,7 @@ public class FileMailRepository implements MailRepository, Configurable, Initial
 
     private void internalStore(Mail mc) throws MessagingException, IOException {
         String key = mc.getName();
-        if (keys != null && !keys.contains(key)) {
+        if (keys != null) {
             keys.add(key);
         }
         boolean saveStream = true;


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