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/01/24 03:03:52 UTC

[1/8] james-project git commit: MAILBOX-374 Fix test class name

Repository: james-project
Updated Branches:
  refs/heads/master 9799f43a8 -> 0e9cd67e1


MAILBOX-374 Fix test class name

Test was duplicated in it


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

Branch: refs/heads/master
Commit: d93da805d61a6679522689fd0095c5433b78a65c
Parents: 9799f43
Author: Benoit Tellier <bt...@linagora.com>
Authored: Mon Jan 21 18:12:23 2019 +0700
Committer: Benoit Tellier <bt...@linagora.com>
Committed: Wed Jan 23 17:51:46 2019 +0700

----------------------------------------------------------------------
 .../InMemoryListingWithSharingTest.java         | 44 ++++++++++++++++++++
 .../InMemoryListingWithSharingTestTest.java     | 44 --------------------
 2 files changed, 44 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/d93da805/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/InMemoryListingWithSharingTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/InMemoryListingWithSharingTest.java b/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/InMemoryListingWithSharingTest.java
new file mode 100644
index 0000000..f3c1b97
--- /dev/null
+++ b/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/InMemoryListingWithSharingTest.java
@@ -0,0 +1,44 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.inmemory;
+
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.inmemory.host.InMemoryHostSystem;
+import org.apache.james.mpt.imapmailbox.suite.ListingWithSharingTest;
+import org.junit.Before;
+
+public class InMemoryListingWithSharingTest extends ListingWithSharingTest {
+
+    private ImapHostSystem system;
+
+    @Override
+    @Before
+    public void setUp() throws Exception {
+        system = new InMemoryHostSystem();
+        system.beforeTest();
+        super.setUp();
+    }
+    
+    @Override
+    protected ImapHostSystem createImapHostSystem() {
+        return system;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/d93da805/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/InMemoryListingWithSharingTestTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/InMemoryListingWithSharingTestTest.java b/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/InMemoryListingWithSharingTestTest.java
deleted file mode 100644
index cb4e8df..0000000
--- a/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/InMemoryListingWithSharingTestTest.java
+++ /dev/null
@@ -1,44 +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.mpt.imapmailbox.inmemory;
-
-import org.apache.james.mpt.api.ImapHostSystem;
-import org.apache.james.mpt.imapmailbox.inmemory.host.InMemoryHostSystem;
-import org.apache.james.mpt.imapmailbox.suite.ListingWithSharingTest;
-import org.junit.Before;
-
-public class InMemoryListingWithSharingTestTest extends ListingWithSharingTest {
-
-    private ImapHostSystem system;
-
-    @Override
-    @Before
-    public void setUp() throws Exception {
-        system = new InMemoryHostSystem();
-        system.beforeTest();
-        super.setUp();
-    }
-    
-    @Override
-    protected ImapHostSystem createImapHostSystem() {
-        return system;
-    }
-    
-}


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


[6/8] james-project git commit: MAILBOX-374 Use InMemoryIntegrationResources to ease RabbitMQ hostSystem instantiation

Posted by bt...@apache.org.
MAILBOX-374 Use InMemoryIntegrationResources to ease RabbitMQ hostSystem instantiation


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

Branch: refs/heads/master
Commit: dc25108ee7b391efdf0ea932a9acbd80807fc241
Parents: b926689
Author: Benoit Tellier <bt...@linagora.com>
Authored: Tue Jan 22 16:43:06 2019 +0700
Committer: Benoit Tellier <bt...@linagora.com>
Committed: Thu Jan 24 09:46:04 2019 +0700

----------------------------------------------------------------------
 .../manager/InMemoryIntegrationResources.java   | 13 +++-
 .../host/RabbitMQEventBusHostSystem.java        | 69 +++++---------------
 2 files changed, 26 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/dc25108e/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/manager/InMemoryIntegrationResources.java
----------------------------------------------------------------------
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 2e1a3de..1f5beff 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
@@ -23,9 +23,9 @@ import org.apache.james.mailbox.MessageIdManager;
 import org.apache.james.mailbox.acl.GroupMembershipResolver;
 import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver;
 import org.apache.james.mailbox.acl.UnionMailboxACLResolver;
+import org.apache.james.mailbox.events.EventBus;
 import org.apache.james.mailbox.events.InVMEventBus;
 import org.apache.james.mailbox.events.delivery.InVmEventDelivery;
-import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.inmemory.InMemoryMailboxManager;
 import org.apache.james.mailbox.inmemory.InMemoryMailboxSessionMapperFactory;
 import org.apache.james.mailbox.inmemory.InMemoryMessageId;
@@ -136,8 +136,17 @@ public class InMemoryIntegrationResources implements IntegrationResources<StoreM
                                       Authenticator authenticator, Authorizator authorizator,
                                       int limitAnnotationCount, int limitAnnotationSize) {
 
+        return createResources(new InVMEventBus(new InVmEventDelivery(new NoopMetricFactory())),
+            groupMembershipResolver, authenticator, authorizator, limitAnnotationCount, limitAnnotationSize);
+    }
+
+    public Resources createResources(EventBus eventBus, Authenticator authenticator, Authorizator authorizator) {
+        return createResources(eventBus,
+            new SimpleGroupMembershipResolver(), authenticator, authorizator, MailboxConstants.DEFAULT_LIMIT_ANNOTATIONS_ON_MAILBOX, MailboxConstants.DEFAULT_LIMIT_ANNOTATION_SIZE);
+    }
+
+    private Resources createResources(EventBus eventBus, GroupMembershipResolver groupMembershipResolver, Authenticator authenticator, Authorizator authorizator, int limitAnnotationCount, int limitAnnotationSize) {
         InMemoryMailboxSessionMapperFactory mailboxSessionMapperFactory = new InMemoryMailboxSessionMapperFactory();
-        InVMEventBus eventBus = new InVMEventBus(new InVmEventDelivery(new NoopMetricFactory()));
         StoreRightManager storeRightManager = new StoreRightManager(mailboxSessionMapperFactory, new UnionMailboxACLResolver(),
             groupMembershipResolver, eventBus);
         StoreMailboxAnnotationManager annotationManager = new StoreMailboxAnnotationManager(mailboxSessionMapperFactory, storeRightManager, limitAnnotationCount, limitAnnotationSize);

http://git-wip-us.apache.org/repos/asf/james-project/blob/dc25108e/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/host/RabbitMQEventBusHostSystem.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/host/RabbitMQEventBusHostSystem.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/host/RabbitMQEventBusHostSystem.java
index 6c3ef49..e6b4760 100644
--- a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/host/RabbitMQEventBusHostSystem.java
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/host/RabbitMQEventBusHostSystem.java
@@ -38,37 +38,16 @@ import org.apache.james.imap.encode.main.DefaultImapEncoderFactory;
 import org.apache.james.imap.main.DefaultImapDecoderFactory;
 import org.apache.james.imap.processor.main.DefaultImapProcessorFactory;
 import org.apache.james.mailbox.MailboxManager;
-import org.apache.james.mailbox.acl.GroupMembershipResolver;
-import org.apache.james.mailbox.acl.MailboxACLResolver;
-import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver;
-import org.apache.james.mailbox.acl.UnionMailboxACLResolver;
 import org.apache.james.mailbox.events.MailboxIdRegistrationKey;
 import org.apache.james.mailbox.events.MemoryEventDeadLetters;
 import org.apache.james.mailbox.events.RabbitMQEventBus;
 import org.apache.james.mailbox.events.RetryBackoffConfiguration;
 import org.apache.james.mailbox.events.RoutingKeyConverter;
 import org.apache.james.mailbox.inmemory.InMemoryId;
-import org.apache.james.mailbox.inmemory.InMemoryMailboxManager;
-import org.apache.james.mailbox.inmemory.InMemoryMailboxSessionMapperFactory;
 import org.apache.james.mailbox.inmemory.InMemoryMessageId;
-import org.apache.james.mailbox.inmemory.quota.InMemoryCurrentQuotaManager;
-import org.apache.james.mailbox.inmemory.quota.InMemoryPerUserMaxQuotaManager;
-import org.apache.james.mailbox.store.JVMMailboxPathLocker;
-import org.apache.james.mailbox.store.MailboxSessionMapperFactory;
-import org.apache.james.mailbox.store.SessionProvider;
-import org.apache.james.mailbox.store.StoreMailboxAnnotationManager;
+import org.apache.james.mailbox.inmemory.manager.InMemoryIntegrationResources;
 import org.apache.james.mailbox.store.StoreMailboxManager;
-import org.apache.james.mailbox.store.StoreRightManager;
 import org.apache.james.mailbox.store.StoreSubscriptionManager;
-import org.apache.james.mailbox.store.extractor.DefaultTextExtractor;
-import org.apache.james.mailbox.store.mail.model.impl.MessageParser;
-import org.apache.james.mailbox.store.quota.CurrentQuotaCalculator;
-import org.apache.james.mailbox.store.quota.DefaultUserQuotaRootResolver;
-import org.apache.james.mailbox.store.quota.ListeningCurrentQuotaUpdater;
-import org.apache.james.mailbox.store.quota.QuotaComponents;
-import org.apache.james.mailbox.store.quota.StoreQuotaManager;
-import org.apache.james.mailbox.store.search.MessageSearchIndex;
-import org.apache.james.mailbox.store.search.SimpleMessageSearchIndex;
 import org.apache.james.metrics.logger.DefaultMetricFactory;
 import org.apache.james.mpt.api.ImapFeatures;
 import org.apache.james.mpt.api.ImapFeatures.Feature;
@@ -93,9 +72,8 @@ public class RabbitMQEventBusHostSystem extends JamesImapHostSystem {
 
     private final DockerRabbitMQ dockerRabbitMQ;
     private StoreMailboxManager mailboxManager;
-    private InMemoryPerUserMaxQuotaManager maxQuotaManager;
-    private RabbitMQConnectionFactory rabbitConnectionFactory;
     private RabbitMQEventBus eventBus;
+    private InMemoryIntegrationResources integrationResources;
 
     public RabbitMQEventBusHostSystem(DockerRabbitMQ dockerRabbitMQ) {
         this.dockerRabbitMQ = dockerRabbitMQ;
@@ -104,47 +82,26 @@ public class RabbitMQEventBusHostSystem extends JamesImapHostSystem {
     @Override
     public void beforeTest() throws Exception {
         super.beforeTest();
-        JVMMailboxPathLocker locker = new JVMMailboxPathLocker();
-        MailboxSessionMapperFactory mailboxSessionMapperFactory = new InMemoryMailboxSessionMapperFactory();
-        StoreSubscriptionManager sm = new StoreSubscriptionManager(mailboxSessionMapperFactory);
-
-        MailboxACLResolver aclResolver = new UnionMailboxACLResolver();
-        GroupMembershipResolver groupMembershipResolver = new SimpleGroupMembershipResolver();
-        MessageParser messageParser = new MessageParser();
-
 
         InMemoryMessageId.Factory messageIdFactory = new InMemoryMessageId.Factory();
         InMemoryId.Factory mailboxIdFactory = new InMemoryId.Factory();
         EventSerializer eventSerializer = new EventSerializer(mailboxIdFactory, messageIdFactory);
         RoutingKeyConverter routingKeyConverter = new RoutingKeyConverter(ImmutableSet.of(new MailboxIdRegistrationKey.Factory(mailboxIdFactory)));
-        rabbitConnectionFactory = createRabbitConnectionFactory();
+        RabbitMQConnectionFactory rabbitConnectionFactory = createRabbitConnectionFactory();
         eventBus = new RabbitMQEventBus(rabbitConnectionFactory, eventSerializer, RetryBackoffConfiguration.DEFAULT, routingKeyConverter, new MemoryEventDeadLetters());
+        eventBus.start();
 
-        StoreRightManager storeRightManager = new StoreRightManager(mailboxSessionMapperFactory, aclResolver, groupMembershipResolver, eventBus);
-        StoreMailboxAnnotationManager annotationManager = new StoreMailboxAnnotationManager(mailboxSessionMapperFactory, storeRightManager);
-        SessionProvider sessionProvider = new SessionProvider(authenticator, authorizator);
-
-        maxQuotaManager = new InMemoryPerUserMaxQuotaManager();
-        DefaultUserQuotaRootResolver quotaRootResolver =  new DefaultUserQuotaRootResolver(sessionProvider, mailboxSessionMapperFactory);
-        InMemoryCurrentQuotaManager currentQuotaManager = new InMemoryCurrentQuotaManager(new CurrentQuotaCalculator(mailboxSessionMapperFactory, quotaRootResolver), sessionProvider);
-        StoreQuotaManager quotaManager = new StoreQuotaManager(currentQuotaManager, maxQuotaManager);
-        ListeningCurrentQuotaUpdater listeningCurrentQuotaUpdater = new ListeningCurrentQuotaUpdater(currentQuotaManager, quotaRootResolver, eventBus, quotaManager);
-        QuotaComponents quotaComponents = new QuotaComponents(maxQuotaManager, quotaManager, quotaRootResolver, listeningCurrentQuotaUpdater);
-        MessageSearchIndex index = new SimpleMessageSearchIndex(mailboxSessionMapperFactory, mailboxSessionMapperFactory, new DefaultTextExtractor());
+        integrationResources = new InMemoryIntegrationResources();
+        mailboxManager = integrationResources.createResources(eventBus, authenticator, authorizator).getMailboxManager();
 
-        mailboxManager = new InMemoryMailboxManager(mailboxSessionMapperFactory, sessionProvider, locker, messageParser,
-            messageIdFactory, eventBus, annotationManager,  storeRightManager, quotaComponents, index);
-
-        eventBus.start();
-        eventBus.register(listeningCurrentQuotaUpdater);
 
         ImapProcessor defaultImapProcessorFactory =
             DefaultImapProcessorFactory.createDefaultProcessor(
                 mailboxManager,
                 eventBus,
-                sm,
-                quotaComponents.getQuotaManager(),
-                quotaComponents.getQuotaRootResolver(),
+                new StoreSubscriptionManager(mailboxManager.getMapperFactory()),
+                integrationResources.retrieveQuotaManager(mailboxManager),
+                integrationResources.retrieveQuotaRootResolver(mailboxManager),
                 new DefaultMetricFactory());
         configure(new DefaultImapDecoderFactory().buildImapDecoder(),
             new DefaultImapEncoderFactory().buildImapEncoder(),
@@ -184,8 +141,12 @@ public class RabbitMQEventBusHostSystem extends JamesImapHostSystem {
 
     @Override
     public void setQuotaLimits(QuotaCount maxMessageQuota, QuotaSize maxStorageQuota) {
-        maxQuotaManager.setGlobalMaxMessage(maxMessageQuota);
-        maxQuotaManager.setGlobalMaxStorage(maxStorageQuota);
+        try {
+            integrationResources.retrieveMaxQuotaManager(mailboxManager).setGlobalMaxMessage(maxMessageQuota);
+            integrationResources.retrieveMaxQuotaManager(mailboxManager).setGlobalMaxStorage(maxStorageQuota);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
     }
 
     @Override


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


[4/8] james-project git commit: MAILBOX-374 IMAP MPT tests for rabbitmq reactor

Posted by bt...@apache.org.
MAILBOX-374 IMAP MPT tests for rabbitmq reactor

These tests serves as integretion tests for IMAP and thus are important.


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

Branch: refs/heads/master
Commit: 6a9554c317a1d32c118fe7bc5d010ac9ab1a7e36
Parents: d93da80
Author: Benoit Tellier <bt...@linagora.com>
Authored: Mon Jan 21 18:13:55 2019 +0700
Committer: Benoit Tellier <bt...@linagora.com>
Committed: Thu Jan 24 09:46:03 2019 +0700

----------------------------------------------------------------------
 .../james/mailbox/events/RabbitMQEventBus.java  |   5 +-
 .../mailbox/events/RoutingKeyConverter.java     |   4 +-
 .../org/apache/james/imap/scripts/Quota.test    |   2 +
 mpt/impl/imap-mailbox/pom.xml                   |   1 +
 mpt/impl/imap-mailbox/rabbitmq/pom.xml          |  86 ++++++++
 .../rabbitmq/RabbitMQAuthenticatePlainTest.java |  40 ++++
 .../RabbitMQAuthenticatedStateTest.java         |  40 ++++
 .../RabbitMQConcurrentSessionsTest.java         |  40 ++++
 .../rabbitmq/RabbitMQCondstoreTest.java         |  40 ++++
 .../imapmailbox/rabbitmq/RabbitMQCopyTest.java  |  40 ++++
 .../rabbitmq/RabbitMQEventsTest.java            |  40 ++++
 .../rabbitmq/RabbitMQFetchBodySectionTest.java  |  40 ++++
 .../RabbitMQFetchBodyStructureTest.java         |  40 ++++
 .../rabbitmq/RabbitMQFetchHeadersTest.java      |  40 ++++
 .../imapmailbox/rabbitmq/RabbitMQFetchTest.java |  40 ++++
 .../rabbitmq/RabbitMQListingTest.java           |  40 ++++
 .../RabbitMQListingWithSharingTest.java         |  40 ++++
 .../rabbitmq/RabbitMQMailboxAnnotationTest.java |  40 ++++
 .../RabbitMQMailboxWithLongNameErrorTest.java   |  40 ++++
 .../imapmailbox/rabbitmq/RabbitMQMoveTest.java  |  40 ++++
 .../RabbitMQNonAuthenticatedStateTest.java      |  40 ++++
 .../rabbitmq/RabbitMQPartialFetchTest.java      |  40 ++++
 .../imapmailbox/rabbitmq/RabbitMQQuotaTest.java |  40 ++++
 .../rabbitmq/RabbitMQRenameTest.java            |  40 ++++
 .../rabbitmq/RabbitMQSearchTest.java            |  40 ++++
 .../rabbitmq/RabbitMQSecurityTest.java          |  40 ++++
 .../rabbitmq/RabbitMQSelectTest.java            |  40 ++++
 .../rabbitmq/RabbitMQSelectedInboxTest.java     |  40 ++++
 .../rabbitmq/RabbitMQSelectedStateTest.java     |  40 ++++
 .../rabbitmq/RabbitMQUidSearchTest.java         |  40 ++++
 .../rabbitmq/RabbitMQUserFlagsSupportTest.java  |  40 ++++
 .../host/RabbitMQEventBusHostSystem.java        | 199 +++++++++++++++++++
 .../host/RabbitMQEventBusHostSystemRule.java    |  52 +++++
 33 files changed, 1384 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mailbox/event/event-rabbitmq/src/main/java/org/apache/james/mailbox/events/RabbitMQEventBus.java
----------------------------------------------------------------------
diff --git a/mailbox/event/event-rabbitmq/src/main/java/org/apache/james/mailbox/events/RabbitMQEventBus.java b/mailbox/event/event-rabbitmq/src/main/java/org/apache/james/mailbox/events/RabbitMQEventBus.java
index 8fba81d..b203032 100644
--- a/mailbox/event/event-rabbitmq/src/main/java/org/apache/james/mailbox/events/RabbitMQEventBus.java
+++ b/mailbox/event/event-rabbitmq/src/main/java/org/apache/james/mailbox/events/RabbitMQEventBus.java
@@ -52,14 +52,13 @@ public class RabbitMQEventBus implements EventBus {
     private final EventDeadLetters eventDeadLetters;
     private final MailboxListenerExecutor mailboxListenerExecutor;
 
-    private MailboxListenerRegistry mailboxListenerRegistry;
     private GroupRegistrationHandler groupRegistrationHandler;
     private KeyRegistrationHandler keyRegistrationHandler;
     private EventDispatcher eventDispatcher;
     private Sender sender;
 
     @Inject
-    RabbitMQEventBus(RabbitMQConnectionFactory rabbitMQConnectionFactory, EventSerializer eventSerializer,
+    public RabbitMQEventBus(RabbitMQConnectionFactory rabbitMQConnectionFactory, EventSerializer eventSerializer,
                      RetryBackoffConfiguration retryBackoff,
                      RoutingKeyConverter routingKeyConverter,
                      EventDeadLetters eventDeadLetters, MetricFactory metricFactory) {
@@ -76,7 +75,7 @@ public class RabbitMQEventBus implements EventBus {
     public void start() {
         if (!isRunning.get()) {
             sender = RabbitFlux.createSender(new SenderOptions().connectionMono(connectionMono));
-            mailboxListenerRegistry = new MailboxListenerRegistry();
+            MailboxListenerRegistry mailboxListenerRegistry = new MailboxListenerRegistry();
             keyRegistrationHandler = new KeyRegistrationHandler(eventBusId, eventSerializer, sender, connectionMono, routingKeyConverter, mailboxListenerRegistry, mailboxListenerExecutor);
             groupRegistrationHandler = new GroupRegistrationHandler(eventSerializer, sender, connectionMono, retryBackoff, eventDeadLetters, mailboxListenerExecutor);
             eventDispatcher = new EventDispatcher(eventBusId, eventSerializer, sender, mailboxListenerRegistry, mailboxListenerExecutor);

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mailbox/event/event-rabbitmq/src/main/java/org/apache/james/mailbox/events/RoutingKeyConverter.java
----------------------------------------------------------------------
diff --git a/mailbox/event/event-rabbitmq/src/main/java/org/apache/james/mailbox/events/RoutingKeyConverter.java b/mailbox/event/event-rabbitmq/src/main/java/org/apache/james/mailbox/events/RoutingKeyConverter.java
index c8a23d1..7e0edb8 100644
--- a/mailbox/event/event-rabbitmq/src/main/java/org/apache/james/mailbox/events/RoutingKeyConverter.java
+++ b/mailbox/event/event-rabbitmq/src/main/java/org/apache/james/mailbox/events/RoutingKeyConverter.java
@@ -34,7 +34,7 @@ import com.google.common.base.Splitter;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
 
-class RoutingKeyConverter {
+public class RoutingKeyConverter {
     private static final String SEPARATOR = ":";
 
     static class RoutingKey {
@@ -67,7 +67,7 @@ class RoutingKeyConverter {
     private final Set<RegistrationKey.Factory> factories;
 
     @Inject
-    RoutingKeyConverter(Set<RegistrationKey.Factory> factories) {
+    public RoutingKeyConverter(Set<RegistrationKey.Factory> factories) {
         this.factories = factories;
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/Quota.test
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/Quota.test b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/Quota.test
index 6e192dd..b8c8b22 100644
--- a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/Quota.test
+++ b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/Quota.test
@@ -79,6 +79,8 @@ S: \* 3 RECENT
 S: A005 OK (\[.+\] )?APPEND completed.
 
 LOG INFO awaiting commands
+# RabbitMQ do not process events straight away
+AWAIT
 
 C: A006 GETQUOTAROOT #private.imapuser.test
 S: \* QUOTAROOT "#private\.imapuser\.test" #private&imapuser

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/pom.xml
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/pom.xml b/mpt/impl/imap-mailbox/pom.xml
index 9c4732e..571a594 100644
--- a/mpt/impl/imap-mailbox/pom.xml
+++ b/mpt/impl/imap-mailbox/pom.xml
@@ -42,6 +42,7 @@
         <module>jpa</module>
         <module>lucenesearch</module>
         <module>maildir</module>
+        <module>rabbitmq</module>
     </modules>
 
     <dependencyManagement>

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/pom.xml
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/pom.xml b/mpt/impl/imap-mailbox/rabbitmq/pom.xml
new file mode 100644
index 0000000..90e9520
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/pom.xml
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <artifactId>apache-james-mpt-imapmailbox</artifactId>
+        <groupId>org.apache.james</groupId>
+        <version>3.3.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>apache-james-mpt-imapmailbox-rabbitmq</artifactId>
+    <name>Apache James MPT Imap Mailbox - RabbitMQ EventBus</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>apache-james-backends-rabbitmq</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>apache-james-backends-rabbitmq</artifactId>
+            <scope>test</scope>
+            <type>test-jar</type>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>apache-james-mailbox-api</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>apache-james-mailbox-api</artifactId>
+            <scope>test</scope>
+            <type>test-jar</type>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>apache-james-mailbox-event-rabbitmq</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>apache-james-mailbox-memory</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>apache-james-mailbox-memory</artifactId>
+            <scope>test</scope>
+            <type>test-jar</type>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>apache-james-mpt-imapmailbox-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>james-server-testing</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.testcontainers</groupId>
+            <artifactId>testcontainers</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQAuthenticatePlainTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQAuthenticatePlainTest.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQAuthenticatePlainTest.java
new file mode 100644
index 0000000..2087248
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQAuthenticatePlainTest.java
@@ -0,0 +1,40 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQTestRule;
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.rabbitmq.host.RabbitMQEventBusHostSystemRule;
+import org.apache.james.mpt.imapmailbox.suite.AuthenticatePlain;
+import org.junit.ClassRule;
+import org.junit.Rule;
+
+public class RabbitMQAuthenticatePlainTest extends AuthenticatePlain {
+    @ClassRule
+    public static DockerRabbitMQTestRule rabbitMQRule = new DockerRabbitMQTestRule();
+
+    @Rule
+    public RabbitMQEventBusHostSystemRule hostSystemRule = new RabbitMQEventBusHostSystemRule(rabbitMQRule);
+
+    @Override
+    protected ImapHostSystem createImapHostSystem() {
+        return hostSystemRule.getHostSystem();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQAuthenticatedStateTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQAuthenticatedStateTest.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQAuthenticatedStateTest.java
new file mode 100644
index 0000000..c2efdfb
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQAuthenticatedStateTest.java
@@ -0,0 +1,40 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQTestRule;
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.rabbitmq.host.RabbitMQEventBusHostSystemRule;
+import org.apache.james.mpt.imapmailbox.suite.AuthenticatedState;
+import org.junit.ClassRule;
+import org.junit.Rule;
+
+public class RabbitMQAuthenticatedStateTest extends AuthenticatedState {
+    @ClassRule
+    public static DockerRabbitMQTestRule rabbitMQRule = new DockerRabbitMQTestRule();
+
+    @Rule
+    public RabbitMQEventBusHostSystemRule hostSystemRule = new RabbitMQEventBusHostSystemRule(rabbitMQRule);
+    
+    @Override
+    protected ImapHostSystem createImapHostSystem() {
+        return hostSystemRule.getHostSystem();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQConcurrentSessionsTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQConcurrentSessionsTest.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQConcurrentSessionsTest.java
new file mode 100644
index 0000000..e1df7e2
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQConcurrentSessionsTest.java
@@ -0,0 +1,40 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQTestRule;
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.rabbitmq.host.RabbitMQEventBusHostSystemRule;
+import org.apache.james.mpt.imapmailbox.suite.ConcurrentSessions;
+import org.junit.ClassRule;
+import org.junit.Rule;
+
+public class RabbitMQConcurrentSessionsTest extends ConcurrentSessions {
+    @ClassRule
+    public static DockerRabbitMQTestRule rabbitMQRule = new DockerRabbitMQTestRule();
+
+    @Rule
+    public RabbitMQEventBusHostSystemRule hostSystemRule = new RabbitMQEventBusHostSystemRule(rabbitMQRule);
+
+    @Override
+    protected ImapHostSystem createImapHostSystem() {
+        return hostSystemRule.getHostSystem();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQCondstoreTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQCondstoreTest.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQCondstoreTest.java
new file mode 100644
index 0000000..679f4b9
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQCondstoreTest.java
@@ -0,0 +1,40 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQTestRule;
+import org.apache.james.mpt.host.JamesImapHostSystem;
+import org.apache.james.mpt.imapmailbox.rabbitmq.host.RabbitMQEventBusHostSystemRule;
+import org.apache.james.mpt.imapmailbox.suite.Condstore;
+import org.junit.ClassRule;
+import org.junit.Rule;
+
+public class RabbitMQCondstoreTest extends Condstore {
+    @ClassRule
+    public static DockerRabbitMQTestRule rabbitMQRule = new DockerRabbitMQTestRule();
+
+    @Rule
+    public RabbitMQEventBusHostSystemRule hostSystemRule = new RabbitMQEventBusHostSystemRule(rabbitMQRule);
+
+    @Override
+    protected JamesImapHostSystem createJamesImapHostSystem() {
+        return hostSystemRule.getHostSystem();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQCopyTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQCopyTest.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQCopyTest.java
new file mode 100644
index 0000000..44dfaef
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQCopyTest.java
@@ -0,0 +1,40 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQTestRule;
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.rabbitmq.host.RabbitMQEventBusHostSystemRule;
+import org.apache.james.mpt.imapmailbox.suite.Copy;
+import org.junit.ClassRule;
+import org.junit.Rule;
+
+public class RabbitMQCopyTest extends Copy {
+    @ClassRule
+    public static DockerRabbitMQTestRule rabbitMQRule = new DockerRabbitMQTestRule();
+
+    @Rule
+    public RabbitMQEventBusHostSystemRule hostSystemRule = new RabbitMQEventBusHostSystemRule(rabbitMQRule);
+
+    @Override
+    protected ImapHostSystem createImapHostSystem() {
+        return hostSystemRule.getHostSystem();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQEventsTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQEventsTest.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQEventsTest.java
new file mode 100644
index 0000000..bffdfcd
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQEventsTest.java
@@ -0,0 +1,40 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQTestRule;
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.rabbitmq.host.RabbitMQEventBusHostSystemRule;
+import org.apache.james.mpt.imapmailbox.suite.Events;
+import org.junit.ClassRule;
+import org.junit.Rule;
+
+public class RabbitMQEventsTest extends Events {
+    @ClassRule
+    public static DockerRabbitMQTestRule rabbitMQRule = new DockerRabbitMQTestRule();
+
+    @Rule
+    public RabbitMQEventBusHostSystemRule hostSystemRule = new RabbitMQEventBusHostSystemRule(rabbitMQRule);
+
+    @Override
+    protected ImapHostSystem createImapHostSystem() {
+        return hostSystemRule.getHostSystem();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQFetchBodySectionTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQFetchBodySectionTest.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQFetchBodySectionTest.java
new file mode 100644
index 0000000..ad1b0f0
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQFetchBodySectionTest.java
@@ -0,0 +1,40 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQTestRule;
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.rabbitmq.host.RabbitMQEventBusHostSystemRule;
+import org.apache.james.mpt.imapmailbox.suite.FetchBodySection;
+import org.junit.ClassRule;
+import org.junit.Rule;
+
+public class RabbitMQFetchBodySectionTest extends FetchBodySection {
+    @ClassRule
+    public static DockerRabbitMQTestRule rabbitMQRule = new DockerRabbitMQTestRule();
+
+    @Rule
+    public RabbitMQEventBusHostSystemRule hostSystemRule = new RabbitMQEventBusHostSystemRule(rabbitMQRule);
+
+    @Override
+    protected ImapHostSystem createImapHostSystem() {
+        return hostSystemRule.getHostSystem();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQFetchBodyStructureTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQFetchBodyStructureTest.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQFetchBodyStructureTest.java
new file mode 100644
index 0000000..30cae91
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQFetchBodyStructureTest.java
@@ -0,0 +1,40 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQTestRule;
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.rabbitmq.host.RabbitMQEventBusHostSystemRule;
+import org.apache.james.mpt.imapmailbox.suite.FetchBodyStructure;
+import org.junit.ClassRule;
+import org.junit.Rule;
+
+public class RabbitMQFetchBodyStructureTest extends FetchBodyStructure {
+    @ClassRule
+    public static DockerRabbitMQTestRule rabbitMQRule = new DockerRabbitMQTestRule();
+
+    @Rule
+    public RabbitMQEventBusHostSystemRule hostSystemRule = new RabbitMQEventBusHostSystemRule(rabbitMQRule);
+
+    @Override
+    protected ImapHostSystem createImapHostSystem() {
+        return hostSystemRule.getHostSystem();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQFetchHeadersTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQFetchHeadersTest.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQFetchHeadersTest.java
new file mode 100644
index 0000000..efffa5b
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQFetchHeadersTest.java
@@ -0,0 +1,40 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQTestRule;
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.rabbitmq.host.RabbitMQEventBusHostSystemRule;
+import org.apache.james.mpt.imapmailbox.suite.FetchHeaders;
+import org.junit.ClassRule;
+import org.junit.Rule;
+
+public class RabbitMQFetchHeadersTest extends FetchHeaders {
+    @ClassRule
+    public static DockerRabbitMQTestRule rabbitMQRule = new DockerRabbitMQTestRule();
+
+    @Rule
+    public RabbitMQEventBusHostSystemRule hostSystemRule = new RabbitMQEventBusHostSystemRule(rabbitMQRule);
+
+    @Override
+    protected ImapHostSystem createImapHostSystem() {
+        return hostSystemRule.getHostSystem();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQFetchTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQFetchTest.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQFetchTest.java
new file mode 100644
index 0000000..e6fc0e3
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQFetchTest.java
@@ -0,0 +1,40 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQTestRule;
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.rabbitmq.host.RabbitMQEventBusHostSystemRule;
+import org.apache.james.mpt.imapmailbox.suite.Fetch;
+import org.junit.ClassRule;
+import org.junit.Rule;
+
+public class RabbitMQFetchTest extends Fetch {
+    @ClassRule
+    public static DockerRabbitMQTestRule rabbitMQRule = new DockerRabbitMQTestRule();
+
+    @Rule
+    public RabbitMQEventBusHostSystemRule hostSystemRule = new RabbitMQEventBusHostSystemRule(rabbitMQRule);
+
+    @Override
+    protected ImapHostSystem createImapHostSystem() {
+        return hostSystemRule.getHostSystem();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQListingTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQListingTest.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQListingTest.java
new file mode 100644
index 0000000..7dbd552
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQListingTest.java
@@ -0,0 +1,40 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQTestRule;
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.rabbitmq.host.RabbitMQEventBusHostSystemRule;
+import org.apache.james.mpt.imapmailbox.suite.Listing;
+import org.junit.ClassRule;
+import org.junit.Rule;
+
+public class RabbitMQListingTest extends Listing {
+    @ClassRule
+    public static DockerRabbitMQTestRule rabbitMQRule = new DockerRabbitMQTestRule();
+
+    @Rule
+    public RabbitMQEventBusHostSystemRule hostSystemRule = new RabbitMQEventBusHostSystemRule(rabbitMQRule);
+
+    @Override
+    protected ImapHostSystem createImapHostSystem() {
+        return hostSystemRule.getHostSystem();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQListingWithSharingTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQListingWithSharingTest.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQListingWithSharingTest.java
new file mode 100644
index 0000000..ecd47df
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQListingWithSharingTest.java
@@ -0,0 +1,40 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQTestRule;
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.rabbitmq.host.RabbitMQEventBusHostSystemRule;
+import org.apache.james.mpt.imapmailbox.suite.ListingWithSharingTest;
+import org.junit.ClassRule;
+import org.junit.Rule;
+
+public class RabbitMQListingWithSharingTest extends ListingWithSharingTest {
+    @ClassRule
+    public static DockerRabbitMQTestRule rabbitMQRule = new DockerRabbitMQTestRule();
+
+    @Rule
+    public RabbitMQEventBusHostSystemRule hostSystemRule = new RabbitMQEventBusHostSystemRule(rabbitMQRule);
+
+    @Override
+    protected ImapHostSystem createImapHostSystem() {
+        return hostSystemRule.getHostSystem();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQMailboxAnnotationTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQMailboxAnnotationTest.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQMailboxAnnotationTest.java
new file mode 100644
index 0000000..d86a209
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQMailboxAnnotationTest.java
@@ -0,0 +1,40 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQTestRule;
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.rabbitmq.host.RabbitMQEventBusHostSystemRule;
+import org.apache.james.mpt.imapmailbox.suite.MailboxAnnotation;
+import org.junit.ClassRule;
+import org.junit.Rule;
+
+public class RabbitMQMailboxAnnotationTest extends MailboxAnnotation {
+    @ClassRule
+    public static DockerRabbitMQTestRule rabbitMQRule = new DockerRabbitMQTestRule();
+
+    @Rule
+    public RabbitMQEventBusHostSystemRule hostSystemRule = new RabbitMQEventBusHostSystemRule(rabbitMQRule);
+
+    @Override
+    protected ImapHostSystem createImapHostSystem() {
+        return hostSystemRule.getHostSystem();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQMailboxWithLongNameErrorTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQMailboxWithLongNameErrorTest.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQMailboxWithLongNameErrorTest.java
new file mode 100644
index 0000000..83077f3
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQMailboxWithLongNameErrorTest.java
@@ -0,0 +1,40 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQTestRule;
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.rabbitmq.host.RabbitMQEventBusHostSystemRule;
+import org.apache.james.mpt.imapmailbox.suite.MailboxWithLongNameError;
+import org.junit.ClassRule;
+import org.junit.Rule;
+
+public class RabbitMQMailboxWithLongNameErrorTest extends MailboxWithLongNameError {
+    @ClassRule
+    public static DockerRabbitMQTestRule rabbitMQRule = new DockerRabbitMQTestRule();
+
+    @Rule
+    public RabbitMQEventBusHostSystemRule hostSystemRule = new RabbitMQEventBusHostSystemRule(rabbitMQRule);
+
+    @Override
+    protected ImapHostSystem createImapHostSystem() {
+        return hostSystemRule.getHostSystem();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQMoveTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQMoveTest.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQMoveTest.java
new file mode 100644
index 0000000..8e45414
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQMoveTest.java
@@ -0,0 +1,40 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQTestRule;
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.rabbitmq.host.RabbitMQEventBusHostSystemRule;
+import org.apache.james.mpt.imapmailbox.suite.Move;
+import org.junit.ClassRule;
+import org.junit.Rule;
+
+public class RabbitMQMoveTest extends Move {
+    @ClassRule
+    public static DockerRabbitMQTestRule rabbitMQRule = new DockerRabbitMQTestRule();
+
+    @Rule
+    public RabbitMQEventBusHostSystemRule hostSystemRule = new RabbitMQEventBusHostSystemRule(rabbitMQRule);
+
+    @Override
+    protected ImapHostSystem createImapHostSystem() {
+        return hostSystemRule.getHostSystem();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQNonAuthenticatedStateTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQNonAuthenticatedStateTest.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQNonAuthenticatedStateTest.java
new file mode 100644
index 0000000..6d88d7a
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQNonAuthenticatedStateTest.java
@@ -0,0 +1,40 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQTestRule;
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.rabbitmq.host.RabbitMQEventBusHostSystemRule;
+import org.apache.james.mpt.imapmailbox.suite.NonAuthenticatedState;
+import org.junit.ClassRule;
+import org.junit.Rule;
+
+public class RabbitMQNonAuthenticatedStateTest extends NonAuthenticatedState {
+    @ClassRule
+    public static DockerRabbitMQTestRule rabbitMQRule = new DockerRabbitMQTestRule();
+
+    @Rule
+    public RabbitMQEventBusHostSystemRule hostSystemRule = new RabbitMQEventBusHostSystemRule(rabbitMQRule);
+
+    @Override
+    protected ImapHostSystem createImapHostSystem() {
+        return hostSystemRule.getHostSystem();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQPartialFetchTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQPartialFetchTest.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQPartialFetchTest.java
new file mode 100644
index 0000000..573ef6b
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQPartialFetchTest.java
@@ -0,0 +1,40 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQTestRule;
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.rabbitmq.host.RabbitMQEventBusHostSystemRule;
+import org.apache.james.mpt.imapmailbox.suite.PartialFetch;
+import org.junit.ClassRule;
+import org.junit.Rule;
+
+public class RabbitMQPartialFetchTest extends PartialFetch {
+    @ClassRule
+    public static DockerRabbitMQTestRule rabbitMQRule = new DockerRabbitMQTestRule();
+
+    @Rule
+    public RabbitMQEventBusHostSystemRule hostSystemRule = new RabbitMQEventBusHostSystemRule(rabbitMQRule);
+
+    @Override
+    protected ImapHostSystem createImapHostSystem() {
+        return hostSystemRule.getHostSystem();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQQuotaTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQQuotaTest.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQQuotaTest.java
new file mode 100644
index 0000000..8760065
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQQuotaTest.java
@@ -0,0 +1,40 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQTestRule;
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.rabbitmq.host.RabbitMQEventBusHostSystemRule;
+import org.apache.james.mpt.imapmailbox.suite.QuotaTest;
+import org.junit.ClassRule;
+import org.junit.Rule;
+
+public class RabbitMQQuotaTest extends QuotaTest {
+    @ClassRule
+    public static DockerRabbitMQTestRule rabbitMQRule = new DockerRabbitMQTestRule();
+
+    @Rule
+    public RabbitMQEventBusHostSystemRule hostSystemRule = new RabbitMQEventBusHostSystemRule(rabbitMQRule);
+
+    @Override
+    protected ImapHostSystem createImapHostSystem() {
+        return hostSystemRule.getHostSystem();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQRenameTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQRenameTest.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQRenameTest.java
new file mode 100644
index 0000000..b7af635
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQRenameTest.java
@@ -0,0 +1,40 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQTestRule;
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.rabbitmq.host.RabbitMQEventBusHostSystemRule;
+import org.apache.james.mpt.imapmailbox.suite.Rename;
+import org.junit.ClassRule;
+import org.junit.Rule;
+
+public class RabbitMQRenameTest extends Rename {
+    @ClassRule
+    public static DockerRabbitMQTestRule rabbitMQRule = new DockerRabbitMQTestRule();
+
+    @Rule
+    public RabbitMQEventBusHostSystemRule hostSystemRule = new RabbitMQEventBusHostSystemRule(rabbitMQRule);
+
+    @Override
+    protected ImapHostSystem createImapHostSystem() {
+        return hostSystemRule.getHostSystem();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQSearchTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQSearchTest.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQSearchTest.java
new file mode 100644
index 0000000..a67535c
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQSearchTest.java
@@ -0,0 +1,40 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQTestRule;
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.rabbitmq.host.RabbitMQEventBusHostSystemRule;
+import org.apache.james.mpt.imapmailbox.suite.Search;
+import org.junit.ClassRule;
+import org.junit.Rule;
+
+public class RabbitMQSearchTest extends Search {
+    @ClassRule
+    public static DockerRabbitMQTestRule rabbitMQRule = new DockerRabbitMQTestRule();
+
+    @Rule
+    public RabbitMQEventBusHostSystemRule hostSystemRule = new RabbitMQEventBusHostSystemRule(rabbitMQRule);
+
+    @Override
+    protected ImapHostSystem createImapHostSystem() {
+        return hostSystemRule.getHostSystem();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQSecurityTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQSecurityTest.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQSecurityTest.java
new file mode 100644
index 0000000..d027ecc
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQSecurityTest.java
@@ -0,0 +1,40 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQTestRule;
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.rabbitmq.host.RabbitMQEventBusHostSystemRule;
+import org.apache.james.mpt.imapmailbox.suite.Security;
+import org.junit.ClassRule;
+import org.junit.Rule;
+
+public class RabbitMQSecurityTest extends Security {
+    @ClassRule
+    public static DockerRabbitMQTestRule rabbitMQRule = new DockerRabbitMQTestRule();
+
+    @Rule
+    public RabbitMQEventBusHostSystemRule hostSystemRule = new RabbitMQEventBusHostSystemRule(rabbitMQRule);
+
+    @Override
+    protected ImapHostSystem createImapHostSystem() {
+        return hostSystemRule.getHostSystem();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQSelectTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQSelectTest.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQSelectTest.java
new file mode 100644
index 0000000..9d6f8c3
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQSelectTest.java
@@ -0,0 +1,40 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQTestRule;
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.rabbitmq.host.RabbitMQEventBusHostSystemRule;
+import org.apache.james.mpt.imapmailbox.suite.Select;
+import org.junit.ClassRule;
+import org.junit.Rule;
+
+public class RabbitMQSelectTest extends Select {
+    @ClassRule
+    public static DockerRabbitMQTestRule rabbitMQRule = new DockerRabbitMQTestRule();
+
+    @Rule
+    public RabbitMQEventBusHostSystemRule hostSystemRule = new RabbitMQEventBusHostSystemRule(rabbitMQRule);
+
+    @Override
+    protected ImapHostSystem createImapHostSystem() {
+        return hostSystemRule.getHostSystem();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQSelectedInboxTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQSelectedInboxTest.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQSelectedInboxTest.java
new file mode 100644
index 0000000..c2fb1fc
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQSelectedInboxTest.java
@@ -0,0 +1,40 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQTestRule;
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.rabbitmq.host.RabbitMQEventBusHostSystemRule;
+import org.apache.james.mpt.imapmailbox.suite.SelectedInbox;
+import org.junit.ClassRule;
+import org.junit.Rule;
+
+public class RabbitMQSelectedInboxTest extends SelectedInbox {
+    @ClassRule
+    public static DockerRabbitMQTestRule rabbitMQRule = new DockerRabbitMQTestRule();
+
+    @Rule
+    public RabbitMQEventBusHostSystemRule hostSystemRule = new RabbitMQEventBusHostSystemRule(rabbitMQRule);
+
+    @Override
+    protected ImapHostSystem createImapHostSystem() {
+        return hostSystemRule.getHostSystem();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQSelectedStateTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQSelectedStateTest.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQSelectedStateTest.java
new file mode 100644
index 0000000..8ce70ed
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQSelectedStateTest.java
@@ -0,0 +1,40 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQTestRule;
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.rabbitmq.host.RabbitMQEventBusHostSystemRule;
+import org.apache.james.mpt.imapmailbox.suite.SelectedState;
+import org.junit.ClassRule;
+import org.junit.Rule;
+
+public class RabbitMQSelectedStateTest extends SelectedState {
+    @ClassRule
+    public static DockerRabbitMQTestRule rabbitMQRule = new DockerRabbitMQTestRule();
+
+    @Rule
+    public RabbitMQEventBusHostSystemRule hostSystemRule = new RabbitMQEventBusHostSystemRule(rabbitMQRule);
+
+    @Override
+    protected ImapHostSystem createImapHostSystem() {
+        return hostSystemRule.getHostSystem();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQUidSearchTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQUidSearchTest.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQUidSearchTest.java
new file mode 100644
index 0000000..e727c4c
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQUidSearchTest.java
@@ -0,0 +1,40 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQTestRule;
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.rabbitmq.host.RabbitMQEventBusHostSystemRule;
+import org.apache.james.mpt.imapmailbox.suite.UidSearch;
+import org.junit.ClassRule;
+import org.junit.Rule;
+
+public class RabbitMQUidSearchTest extends UidSearch {
+    @ClassRule
+    public static DockerRabbitMQTestRule rabbitMQRule = new DockerRabbitMQTestRule();
+
+    @Rule
+    public RabbitMQEventBusHostSystemRule hostSystemRule = new RabbitMQEventBusHostSystemRule(rabbitMQRule);
+
+    @Override
+    protected ImapHostSystem createImapHostSystem() {
+        return hostSystemRule.getHostSystem();
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQUserFlagsSupportTest.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQUserFlagsSupportTest.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQUserFlagsSupportTest.java
new file mode 100644
index 0000000..46a9087
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/RabbitMQUserFlagsSupportTest.java
@@ -0,0 +1,40 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQTestRule;
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.rabbitmq.host.RabbitMQEventBusHostSystemRule;
+import org.apache.james.mpt.imapmailbox.suite.UserFlagsSupport;
+import org.junit.ClassRule;
+import org.junit.Rule;
+
+public class RabbitMQUserFlagsSupportTest extends UserFlagsSupport {
+    @ClassRule
+    public static DockerRabbitMQTestRule rabbitMQRule = new DockerRabbitMQTestRule();
+
+    @Rule
+    public RabbitMQEventBusHostSystemRule hostSystemRule = new RabbitMQEventBusHostSystemRule(rabbitMQRule);
+
+    @Override
+    protected ImapHostSystem createImapHostSystem() {
+        return hostSystemRule.getHostSystem();
+    }
+}


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


[2/8] james-project git commit: MAILBOX-374 Slightly improve ListeningCurrentQuotaUpdater code quality

Posted by bt...@apache.org.
MAILBOX-374 Slightly improve ListeningCurrentQuotaUpdater code quality


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

Branch: refs/heads/master
Commit: b9266899a141a72a0c8e44c05a5dcf0d03856974
Parents: ac3d520
Author: Benoit Tellier <bt...@linagora.com>
Authored: Tue Jan 22 11:47:42 2019 +0700
Committer: Benoit Tellier <bt...@linagora.com>
Committed: Thu Jan 24 09:46:03 2019 +0700

----------------------------------------------------------------------
 .../quota/ListeningCurrentQuotaUpdater.java     | 31 ++++++++------------
 1 file changed, 13 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/b9266899/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/ListeningCurrentQuotaUpdater.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/ListeningCurrentQuotaUpdater.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/ListeningCurrentQuotaUpdater.java
index 57cee5a..cf6cace 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/ListeningCurrentQuotaUpdater.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/ListeningCurrentQuotaUpdater.java
@@ -19,13 +19,11 @@
 package org.apache.james.mailbox.store.quota;
 
 import java.time.Instant;
-import java.util.Collection;
 
 import javax.inject.Inject;
 
 import org.apache.james.mailbox.Event;
 import org.apache.james.mailbox.MailboxListener;
-import org.apache.james.mailbox.MessageUid;
 import org.apache.james.mailbox.events.EventBus;
 import org.apache.james.mailbox.events.Group;
 import org.apache.james.mailbox.events.RegistrationKey;
@@ -78,16 +76,11 @@ public class ListeningCurrentQuotaUpdater implements MailboxListener.GroupMailbo
     }
 
     private void handleExpungedEvent(Expunged expunged, QuotaRoot quotaRoot) throws MailboxException {
-        long addedSize = 0;
-        long addedCount = 0;
-        Collection<MessageUid> uids = expunged.getUids();
-        for (MessageUid uid : uids) {
-            addedSize += expunged.getMetaData(uid).getSize();
-            addedCount++;
-        }
+        long expungedSize = totalSize(expunged);
+        long expungedCount = (long) expunged.getUids().size();
         // Expunge event can contain no data (expunge performed while no messages marked \Deleted)
-        if (addedCount != 0 && addedSize != 0) {
-            currentQuotaManager.decrease(quotaRoot, addedCount, addedSize);
+        if (expungedCount != 0 && expungedSize != 0) {
+            currentQuotaManager.decrease(quotaRoot, expungedCount, expungedSize);
         }
         eventBus.dispatch(
             EventFactory.quotaUpdated()
@@ -103,13 +96,8 @@ public class ListeningCurrentQuotaUpdater implements MailboxListener.GroupMailbo
     }
 
     private void handleAddedEvent(Added added, QuotaRoot quotaRoot) throws MailboxException {
-        long addedSize = 0;
-        long addedCount = 0;
-        Collection<MessageUid> uids = added.getUids();
-        for (MessageUid uid : uids) {
-            addedSize += added.getMetaData(uid).getSize();
-            addedCount++;
-        }
+        long addedSize = totalSize(added);
+        long addedCount = (long) added.getUids().size();
         if (addedCount != 0 && addedSize != 0) {
             currentQuotaManager.increase(quotaRoot, addedCount, addedSize);
         }
@@ -126,6 +114,13 @@ public class ListeningCurrentQuotaUpdater implements MailboxListener.GroupMailbo
             .block();
     }
 
+    private long totalSize(MetaDataHoldingEvent metaDataHoldingEvent) {
+        return metaDataHoldingEvent.getUids()
+            .stream()
+            .mapToLong(uid -> metaDataHoldingEvent.getMetaData(uid).getSize())
+            .sum();
+    }
+
     private void handleMailboxDeletionEvent(MailboxDeletion mailboxDeletionEvent) throws MailboxException {
         boolean mailboxContainedMessages = mailboxDeletionEvent.getDeletedMessageCount().asLong() > 0;
         if (mailboxContainedMessages) {


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


[5/8] james-project git commit: MAILBOX-374 Fix a bug between group registration and key registration

Posted by bt...@apache.org.
MAILBOX-374 Fix a bug between group registration and key registration

In some cases groups were not dispatched when a key was registered/unregistered.


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

Branch: refs/heads/master
Commit: ac3d5209e11b5573ed74ea9a55014245f2ad6830
Parents: 6a9554c
Author: Benoit Tellier <bt...@linagora.com>
Authored: Tue Jan 22 11:47:14 2019 +0700
Committer: Benoit Tellier <bt...@linagora.com>
Committed: Thu Jan 24 09:46:03 2019 +0700

----------------------------------------------------------------------
 .../james/mailbox/events/EventDispatcher.java   | 21 +++++++++++---------
 .../james/mailbox/events/GroupRegistration.java |  2 +-
 2 files changed, 13 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/ac3d5209/mailbox/event/event-rabbitmq/src/main/java/org/apache/james/mailbox/events/EventDispatcher.java
----------------------------------------------------------------------
diff --git a/mailbox/event/event-rabbitmq/src/main/java/org/apache/james/mailbox/events/EventDispatcher.java b/mailbox/event/event-rabbitmq/src/main/java/org/apache/james/mailbox/events/EventDispatcher.java
index 628bab3..f1cc7d3 100644
--- a/mailbox/event/event-rabbitmq/src/main/java/org/apache/james/mailbox/events/EventDispatcher.java
+++ b/mailbox/event/event-rabbitmq/src/main/java/org/apache/james/mailbox/events/EventDispatcher.java
@@ -76,6 +76,14 @@ class EventDispatcher {
     }
 
     Mono<Void> dispatch(Event event, Set<RegistrationKey> keys) {
+        Mono<byte[]> serializedEvent = Mono.just(event)
+            .publishOn(Schedulers.parallel())
+            .map(this::serializeEvent)
+            .cache();
+
+        Mono<Void> distantDispatchMono = doDispatch(serializedEvent, keys).cache()
+            .subscribeWith(MonoProcessor.create());
+
         Mono<Void> localListenerDelivery = Flux.fromIterable(keys)
             .subscribeOn(Schedulers.elastic())
             .flatMap(key -> mailboxListenerRegistry.getLocalMailboxListeners(key)
@@ -85,17 +93,12 @@ class EventDispatcher {
                 .doOnError(e -> structuredLogger(event, keys)
                     .log(logger -> logger.error("Exception happens when dispatching event", e)))
                 .onErrorResume(e -> Mono.empty()))
-            .then();
-
-        Mono<byte[]> serializedEvent = Mono.just(event)
-            .publishOn(Schedulers.parallel())
-            .map(this::serializeEvent)
-            .cache();
-
-        Mono<Void> distantDispatchMono = doDispatch(serializedEvent, keys).cache();
+            .cache()
+            .then()
+            .subscribeWith(MonoProcessor.create());
 
         return Flux.concat(localListenerDelivery, distantDispatchMono)
-            .subscribeWith(MonoProcessor.create());
+            .then();
     }
 
     private void executeListener(Event event, MailboxListener mailboxListener, RegistrationKey registrationKey) throws Exception {

http://git-wip-us.apache.org/repos/asf/james-project/blob/ac3d5209/mailbox/event/event-rabbitmq/src/main/java/org/apache/james/mailbox/events/GroupRegistration.java
----------------------------------------------------------------------
diff --git a/mailbox/event/event-rabbitmq/src/main/java/org/apache/james/mailbox/events/GroupRegistration.java b/mailbox/event/event-rabbitmq/src/main/java/org/apache/james/mailbox/events/GroupRegistration.java
index ee3013d..5a9bdf0 100644
--- a/mailbox/event/event-rabbitmq/src/main/java/org/apache/james/mailbox/events/GroupRegistration.java
+++ b/mailbox/event/event-rabbitmq/src/main/java/org/apache/james/mailbox/events/GroupRegistration.java
@@ -142,7 +142,7 @@ class GroupRegistration implements Registration {
         int currentRetryCount = getRetryCount(acknowledgableDelivery);
 
         return delayGenerator.delayIfHaveTo(currentRetryCount)
-            .flatMap(any -> Mono.fromRunnable(Throwing.runnable(() -> runListener(event))))
+            .flatMap(any -> Mono.fromRunnable(Throwing.runnable(() -> runListener(event))).publishOn(Schedulers.elastic()))
             .onErrorResume(throwable -> retryHandler.handleRetry(eventAsBytes, event, currentRetryCount, throwable))
             .then(Mono.fromRunnable(acknowledgableDelivery::ack))
             .subscribeWith(MonoProcessor.create())


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


[7/8] james-project git commit: MAILBOX-374 DockerRabbitMQ should be able to provide a connection factory

Posted by bt...@apache.org.
MAILBOX-374 DockerRabbitMQ should be able to provide a connection factory

This avoids code duplication between JUNIT 4 & JUNIT 5


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

Branch: refs/heads/master
Commit: 2c84e321d681e848cdf666b72e64e56252b1b9ca
Parents: dc25108
Author: Benoit Tellier <bt...@linagora.com>
Authored: Tue Jan 22 16:48:36 2019 +0700
Committer: Benoit Tellier <bt...@linagora.com>
Committed: Thu Jan 24 09:46:04 2019 +0700

----------------------------------------------------------------------
 .../james/backend/rabbitmq/DockerRabbitMQ.java  | 23 +++++++
 .../backend/rabbitmq/RabbitMQExtension.java     | 22 +-----
 .../host/RabbitMQEventBusHostSystem.java        | 72 ++++++--------------
 3 files changed, 46 insertions(+), 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/2c84e321/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/DockerRabbitMQ.java
----------------------------------------------------------------------
diff --git a/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/DockerRabbitMQ.java b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/DockerRabbitMQ.java
index 10f36ab..81567c7 100644
--- a/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/DockerRabbitMQ.java
+++ b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/DockerRabbitMQ.java
@@ -18,13 +18,18 @@
  ****************************************************************/
 package org.apache.james.backend.rabbitmq;
 
+import static org.apache.james.backend.rabbitmq.RabbitMQFixture.DEFAULT_MANAGEMENT_CREDENTIAL;
+
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.time.Duration;
 import java.util.Optional;
 import java.util.UUID;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
 
 import org.apache.http.client.utils.URIBuilder;
+import org.apache.james.util.concurrent.NamedThreadFactory;
 import org.apache.james.util.docker.Images;
 import org.apache.james.util.docker.RateLimiters;
 import org.slf4j.Logger;
@@ -38,12 +43,15 @@ import org.testcontainers.containers.wait.strategy.WaitStrategy;
 
 import com.github.fge.lambdas.consumers.ThrowingConsumer;
 import com.google.common.collect.ImmutableMap;
+import com.nurkiewicz.asyncretry.AsyncRetryExecutor;
 import com.rabbitmq.client.Address;
 import com.rabbitmq.client.ConnectionFactory;
 
 public class DockerRabbitMQ {
     private static final Logger LOGGER = LoggerFactory.getLogger(DockerRabbitMQ.class);
 
+    private static final int MAX_THREE_RETRIES = 3;
+    private static final int MIN_DELAY_OF_ONE_HUNDRED_MILLISECONDS = 100;
     private static final String DEFAULT_RABBIT_HOST_NAME_PREFIX = "my-rabbit";
     private static final String DEFAULT_RABBIT_NODE_NAME_PREFIX = "rabbit";
     private static final int DEFAULT_RABBITMQ_PORT = 5672;
@@ -227,4 +235,19 @@ public class DockerRabbitMQ {
             actionPerform.accept(this);
         }
     }
+
+    public RabbitMQConnectionFactory createRabbitConnectionFactory() throws URISyntaxException {
+        RabbitMQConfiguration rabbitMQConfiguration = RabbitMQConfiguration.builder()
+            .amqpUri(amqpUri())
+            .managementUri(managementUri())
+            .managementCredentials(DEFAULT_MANAGEMENT_CREDENTIAL)
+            .maxRetries(MAX_THREE_RETRIES)
+            .minDelay(MIN_DELAY_OF_ONE_HUNDRED_MILLISECONDS)
+            .build();
+
+        ThreadFactory threadFactory = NamedThreadFactory.withClassName(getClass());
+        return new RabbitMQConnectionFactory(
+            rabbitMQConfiguration,
+            new AsyncRetryExecutor(Executors.newSingleThreadScheduledExecutor(threadFactory)));
+    }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/2c84e321/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/RabbitMQExtension.java
----------------------------------------------------------------------
diff --git a/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/RabbitMQExtension.java b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/RabbitMQExtension.java
index 47e6488..4e3f388 100644
--- a/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/RabbitMQExtension.java
+++ b/backends-common/rabbitmq/src/test/java/org/apache/james/backend/rabbitmq/RabbitMQExtension.java
@@ -21,10 +21,7 @@ package org.apache.james.backend.rabbitmq;
 import static org.apache.james.backend.rabbitmq.RabbitMQFixture.DEFAULT_MANAGEMENT_CREDENTIAL;
 
 import java.net.URISyntaxException;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
 
-import org.apache.james.util.concurrent.NamedThreadFactory;
 import org.junit.jupiter.api.extension.AfterAllCallback;
 import org.junit.jupiter.api.extension.AfterEachCallback;
 import org.junit.jupiter.api.extension.BeforeAllCallback;
@@ -34,13 +31,7 @@ import org.junit.jupiter.api.extension.ParameterContext;
 import org.junit.jupiter.api.extension.ParameterResolutionException;
 import org.junit.jupiter.api.extension.ParameterResolver;
 
-import com.nurkiewicz.asyncretry.AsyncRetryExecutor;
-
 public class RabbitMQExtension implements BeforeAllCallback, BeforeEachCallback, AfterAllCallback, AfterEachCallback, ParameterResolver {
-
-    private static final int THREE_RETRIES = 3;
-    private static final int ONE_HUNDRED_MILLISECONDS = 100;
-
     private DockerRabbitMQ rabbitMQ;
     private SimpleChannelPool simpleChannelPool;
     private RabbitMQConnectionFactory connectionFactory;
@@ -98,17 +89,6 @@ public class RabbitMQExtension implements BeforeAllCallback, BeforeEachCallback,
     }
 
     private RabbitMQConnectionFactory createRabbitConnectionFactory() throws URISyntaxException {
-        RabbitMQConfiguration rabbitMQConfiguration = RabbitMQConfiguration.builder()
-            .amqpUri(rabbitMQ.amqpUri())
-            .managementUri(rabbitMQ.managementUri())
-            .managementCredentials(DEFAULT_MANAGEMENT_CREDENTIAL)
-            .maxRetries(THREE_RETRIES)
-            .minDelay(ONE_HUNDRED_MILLISECONDS)
-            .build();
-
-        ThreadFactory threadFactory = NamedThreadFactory.withClassName(getClass());
-        return new RabbitMQConnectionFactory(
-            rabbitMQConfiguration,
-            new AsyncRetryExecutor(Executors.newSingleThreadScheduledExecutor(threadFactory)));
+        return rabbitMQ.createRabbitConnectionFactory();
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/2c84e321/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/host/RabbitMQEventBusHostSystem.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/host/RabbitMQEventBusHostSystem.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/host/RabbitMQEventBusHostSystem.java
index e6b4760..14b8592 100644
--- a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/host/RabbitMQEventBusHostSystem.java
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/host/RabbitMQEventBusHostSystem.java
@@ -20,15 +20,10 @@
 
 package org.apache.james.mpt.imapmailbox.rabbitmq.host;
 
-import static org.apache.james.backend.rabbitmq.RabbitMQFixture.DEFAULT_MANAGEMENT_CREDENTIAL;
-
 import java.net.URISyntaxException;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.james.backend.rabbitmq.DockerRabbitMQ;
-import org.apache.james.backend.rabbitmq.RabbitMQConfiguration;
 import org.apache.james.backend.rabbitmq.RabbitMQConnectionFactory;
 import org.apache.james.core.quota.QuotaCount;
 import org.apache.james.core.quota.QuotaSize;
@@ -46,19 +41,16 @@ import org.apache.james.mailbox.events.RoutingKeyConverter;
 import org.apache.james.mailbox.inmemory.InMemoryId;
 import org.apache.james.mailbox.inmemory.InMemoryMessageId;
 import org.apache.james.mailbox.inmemory.manager.InMemoryIntegrationResources;
-import org.apache.james.mailbox.store.StoreMailboxManager;
 import org.apache.james.mailbox.store.StoreSubscriptionManager;
+import org.apache.james.metrics.api.NoopMetricFactory;
 import org.apache.james.metrics.logger.DefaultMetricFactory;
 import org.apache.james.mpt.api.ImapFeatures;
 import org.apache.james.mpt.api.ImapFeatures.Feature;
 import org.apache.james.mpt.host.JamesImapHostSystem;
-import org.apache.james.util.concurrent.NamedThreadFactory;
 
 import com.google.common.collect.ImmutableSet;
-import com.nurkiewicz.asyncretry.AsyncRetryExecutor;
 
 public class RabbitMQEventBusHostSystem extends JamesImapHostSystem {
-
     private static final ImapFeatures SUPPORTED_FEATURES = ImapFeatures.of(Feature.NAMESPACE_SUPPORT,
         Feature.MOVE_SUPPORT,
         Feature.USER_FLAGS_SUPPORT,
@@ -66,16 +58,11 @@ public class RabbitMQEventBusHostSystem extends JamesImapHostSystem {
         Feature.ANNOTATION_SUPPORT,
         Feature.MOD_SEQ_SEARCH);
 
-
-    private static final int THREE_RETRIES = 3;
-    private static final int ONE_HUNDRED_MILLISECONDS = 100;
-
     private final DockerRabbitMQ dockerRabbitMQ;
-    private StoreMailboxManager mailboxManager;
     private RabbitMQEventBus eventBus;
-    private InMemoryIntegrationResources integrationResources;
+    private InMemoryIntegrationResources.Resources resources;
 
-    public RabbitMQEventBusHostSystem(DockerRabbitMQ dockerRabbitMQ) {
+    RabbitMQEventBusHostSystem(DockerRabbitMQ dockerRabbitMQ) {
         this.dockerRabbitMQ = dockerRabbitMQ;
     }
 
@@ -83,45 +70,34 @@ public class RabbitMQEventBusHostSystem extends JamesImapHostSystem {
     public void beforeTest() throws Exception {
         super.beforeTest();
 
-        InMemoryMessageId.Factory messageIdFactory = new InMemoryMessageId.Factory();
-        InMemoryId.Factory mailboxIdFactory = new InMemoryId.Factory();
-        EventSerializer eventSerializer = new EventSerializer(mailboxIdFactory, messageIdFactory);
-        RoutingKeyConverter routingKeyConverter = new RoutingKeyConverter(ImmutableSet.of(new MailboxIdRegistrationKey.Factory(mailboxIdFactory)));
-        RabbitMQConnectionFactory rabbitConnectionFactory = createRabbitConnectionFactory();
-        eventBus = new RabbitMQEventBus(rabbitConnectionFactory, eventSerializer, RetryBackoffConfiguration.DEFAULT, routingKeyConverter, new MemoryEventDeadLetters());
+        eventBus = createEventBus();
         eventBus.start();
 
-        integrationResources = new InMemoryIntegrationResources();
-        mailboxManager = integrationResources.createResources(eventBus, authenticator, authorizator).getMailboxManager();
-
+        InMemoryIntegrationResources integrationResources = new InMemoryIntegrationResources();
+        resources = integrationResources.createResources(eventBus, authenticator, authorizator);
 
         ImapProcessor defaultImapProcessorFactory =
             DefaultImapProcessorFactory.createDefaultProcessor(
-                mailboxManager,
+                resources.getMailboxManager(),
                 eventBus,
-                new StoreSubscriptionManager(mailboxManager.getMapperFactory()),
-                integrationResources.retrieveQuotaManager(mailboxManager),
-                integrationResources.retrieveQuotaRootResolver(mailboxManager),
+                new StoreSubscriptionManager(resources.getMailboxManager().getMapperFactory()),
+                integrationResources.retrieveQuotaManager(resources.getMailboxManager()),
+                resources.getDefaultUserQuotaRootResolver(),
                 new DefaultMetricFactory());
+
         configure(new DefaultImapDecoderFactory().buildImapDecoder(),
             new DefaultImapEncoderFactory().buildImapEncoder(),
             defaultImapProcessorFactory);
     }
 
-
-    private RabbitMQConnectionFactory createRabbitConnectionFactory() throws URISyntaxException {
-        RabbitMQConfiguration rabbitMQConfiguration = RabbitMQConfiguration.builder()
-            .amqpUri(dockerRabbitMQ.amqpUri())
-            .managementUri(dockerRabbitMQ.managementUri())
-            .managementCredentials(DEFAULT_MANAGEMENT_CREDENTIAL)
-            .maxRetries(THREE_RETRIES)
-            .minDelay(ONE_HUNDRED_MILLISECONDS)
-            .build();
-
-        ThreadFactory threadFactory = NamedThreadFactory.withClassName(getClass());
-        return new RabbitMQConnectionFactory(
-            rabbitMQConfiguration,
-            new AsyncRetryExecutor(Executors.newSingleThreadScheduledExecutor(threadFactory)));
+    private RabbitMQEventBus createEventBus() throws URISyntaxException {
+        InMemoryMessageId.Factory messageIdFactory = new InMemoryMessageId.Factory();
+        InMemoryId.Factory mailboxIdFactory = new InMemoryId.Factory();
+        EventSerializer eventSerializer = new EventSerializer(mailboxIdFactory, messageIdFactory);
+        RoutingKeyConverter routingKeyConverter = new RoutingKeyConverter(ImmutableSet.of(new MailboxIdRegistrationKey.Factory(mailboxIdFactory)));
+        RabbitMQConnectionFactory rabbitConnectionFactory = dockerRabbitMQ.createRabbitConnectionFactory();
+        return new RabbitMQEventBus(rabbitConnectionFactory, eventSerializer, RetryBackoffConfiguration.DEFAULT,
+            routingKeyConverter, new MemoryEventDeadLetters(), new NoopMetricFactory());
     }
 
     @Override
@@ -131,7 +107,7 @@ public class RabbitMQEventBusHostSystem extends JamesImapHostSystem {
 
     @Override
     protected MailboxManager getMailboxManager() {
-        return mailboxManager;
+        return resources.getMailboxManager();
     }
 
     @Override
@@ -141,12 +117,8 @@ public class RabbitMQEventBusHostSystem extends JamesImapHostSystem {
 
     @Override
     public void setQuotaLimits(QuotaCount maxMessageQuota, QuotaSize maxStorageQuota) {
-        try {
-            integrationResources.retrieveMaxQuotaManager(mailboxManager).setGlobalMaxMessage(maxMessageQuota);
-            integrationResources.retrieveMaxQuotaManager(mailboxManager).setGlobalMaxStorage(maxStorageQuota);
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
+        resources.getMaxQuotaManager().setGlobalMaxMessage(maxMessageQuota);
+        resources.getMaxQuotaManager().setGlobalMaxStorage(maxStorageQuota);
     }
 
     @Override


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


[3/8] james-project git commit: MAILBOX-374 IMAP MPT tests for rabbitmq reactor

Posted by bt...@apache.org.
http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/host/RabbitMQEventBusHostSystem.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/host/RabbitMQEventBusHostSystem.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/host/RabbitMQEventBusHostSystem.java
new file mode 100644
index 0000000..6c3ef49
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/host/RabbitMQEventBusHostSystem.java
@@ -0,0 +1,199 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq.host;
+
+import static org.apache.james.backend.rabbitmq.RabbitMQFixture.DEFAULT_MANAGEMENT_CREDENTIAL;
+
+import java.net.URISyntaxException;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQ;
+import org.apache.james.backend.rabbitmq.RabbitMQConfiguration;
+import org.apache.james.backend.rabbitmq.RabbitMQConnectionFactory;
+import org.apache.james.core.quota.QuotaCount;
+import org.apache.james.core.quota.QuotaSize;
+import org.apache.james.event.json.EventSerializer;
+import org.apache.james.imap.api.process.ImapProcessor;
+import org.apache.james.imap.encode.main.DefaultImapEncoderFactory;
+import org.apache.james.imap.main.DefaultImapDecoderFactory;
+import org.apache.james.imap.processor.main.DefaultImapProcessorFactory;
+import org.apache.james.mailbox.MailboxManager;
+import org.apache.james.mailbox.acl.GroupMembershipResolver;
+import org.apache.james.mailbox.acl.MailboxACLResolver;
+import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver;
+import org.apache.james.mailbox.acl.UnionMailboxACLResolver;
+import org.apache.james.mailbox.events.MailboxIdRegistrationKey;
+import org.apache.james.mailbox.events.MemoryEventDeadLetters;
+import org.apache.james.mailbox.events.RabbitMQEventBus;
+import org.apache.james.mailbox.events.RetryBackoffConfiguration;
+import org.apache.james.mailbox.events.RoutingKeyConverter;
+import org.apache.james.mailbox.inmemory.InMemoryId;
+import org.apache.james.mailbox.inmemory.InMemoryMailboxManager;
+import org.apache.james.mailbox.inmemory.InMemoryMailboxSessionMapperFactory;
+import org.apache.james.mailbox.inmemory.InMemoryMessageId;
+import org.apache.james.mailbox.inmemory.quota.InMemoryCurrentQuotaManager;
+import org.apache.james.mailbox.inmemory.quota.InMemoryPerUserMaxQuotaManager;
+import org.apache.james.mailbox.store.JVMMailboxPathLocker;
+import org.apache.james.mailbox.store.MailboxSessionMapperFactory;
+import org.apache.james.mailbox.store.SessionProvider;
+import org.apache.james.mailbox.store.StoreMailboxAnnotationManager;
+import org.apache.james.mailbox.store.StoreMailboxManager;
+import org.apache.james.mailbox.store.StoreRightManager;
+import org.apache.james.mailbox.store.StoreSubscriptionManager;
+import org.apache.james.mailbox.store.extractor.DefaultTextExtractor;
+import org.apache.james.mailbox.store.mail.model.impl.MessageParser;
+import org.apache.james.mailbox.store.quota.CurrentQuotaCalculator;
+import org.apache.james.mailbox.store.quota.DefaultUserQuotaRootResolver;
+import org.apache.james.mailbox.store.quota.ListeningCurrentQuotaUpdater;
+import org.apache.james.mailbox.store.quota.QuotaComponents;
+import org.apache.james.mailbox.store.quota.StoreQuotaManager;
+import org.apache.james.mailbox.store.search.MessageSearchIndex;
+import org.apache.james.mailbox.store.search.SimpleMessageSearchIndex;
+import org.apache.james.metrics.logger.DefaultMetricFactory;
+import org.apache.james.mpt.api.ImapFeatures;
+import org.apache.james.mpt.api.ImapFeatures.Feature;
+import org.apache.james.mpt.host.JamesImapHostSystem;
+import org.apache.james.util.concurrent.NamedThreadFactory;
+
+import com.google.common.collect.ImmutableSet;
+import com.nurkiewicz.asyncretry.AsyncRetryExecutor;
+
+public class RabbitMQEventBusHostSystem extends JamesImapHostSystem {
+
+    private static final ImapFeatures SUPPORTED_FEATURES = ImapFeatures.of(Feature.NAMESPACE_SUPPORT,
+        Feature.MOVE_SUPPORT,
+        Feature.USER_FLAGS_SUPPORT,
+        Feature.QUOTA_SUPPORT,
+        Feature.ANNOTATION_SUPPORT,
+        Feature.MOD_SEQ_SEARCH);
+
+
+    private static final int THREE_RETRIES = 3;
+    private static final int ONE_HUNDRED_MILLISECONDS = 100;
+
+    private final DockerRabbitMQ dockerRabbitMQ;
+    private StoreMailboxManager mailboxManager;
+    private InMemoryPerUserMaxQuotaManager maxQuotaManager;
+    private RabbitMQConnectionFactory rabbitConnectionFactory;
+    private RabbitMQEventBus eventBus;
+
+    public RabbitMQEventBusHostSystem(DockerRabbitMQ dockerRabbitMQ) {
+        this.dockerRabbitMQ = dockerRabbitMQ;
+    }
+
+    @Override
+    public void beforeTest() throws Exception {
+        super.beforeTest();
+        JVMMailboxPathLocker locker = new JVMMailboxPathLocker();
+        MailboxSessionMapperFactory mailboxSessionMapperFactory = new InMemoryMailboxSessionMapperFactory();
+        StoreSubscriptionManager sm = new StoreSubscriptionManager(mailboxSessionMapperFactory);
+
+        MailboxACLResolver aclResolver = new UnionMailboxACLResolver();
+        GroupMembershipResolver groupMembershipResolver = new SimpleGroupMembershipResolver();
+        MessageParser messageParser = new MessageParser();
+
+
+        InMemoryMessageId.Factory messageIdFactory = new InMemoryMessageId.Factory();
+        InMemoryId.Factory mailboxIdFactory = new InMemoryId.Factory();
+        EventSerializer eventSerializer = new EventSerializer(mailboxIdFactory, messageIdFactory);
+        RoutingKeyConverter routingKeyConverter = new RoutingKeyConverter(ImmutableSet.of(new MailboxIdRegistrationKey.Factory(mailboxIdFactory)));
+        rabbitConnectionFactory = createRabbitConnectionFactory();
+        eventBus = new RabbitMQEventBus(rabbitConnectionFactory, eventSerializer, RetryBackoffConfiguration.DEFAULT, routingKeyConverter, new MemoryEventDeadLetters());
+
+        StoreRightManager storeRightManager = new StoreRightManager(mailboxSessionMapperFactory, aclResolver, groupMembershipResolver, eventBus);
+        StoreMailboxAnnotationManager annotationManager = new StoreMailboxAnnotationManager(mailboxSessionMapperFactory, storeRightManager);
+        SessionProvider sessionProvider = new SessionProvider(authenticator, authorizator);
+
+        maxQuotaManager = new InMemoryPerUserMaxQuotaManager();
+        DefaultUserQuotaRootResolver quotaRootResolver =  new DefaultUserQuotaRootResolver(sessionProvider, mailboxSessionMapperFactory);
+        InMemoryCurrentQuotaManager currentQuotaManager = new InMemoryCurrentQuotaManager(new CurrentQuotaCalculator(mailboxSessionMapperFactory, quotaRootResolver), sessionProvider);
+        StoreQuotaManager quotaManager = new StoreQuotaManager(currentQuotaManager, maxQuotaManager);
+        ListeningCurrentQuotaUpdater listeningCurrentQuotaUpdater = new ListeningCurrentQuotaUpdater(currentQuotaManager, quotaRootResolver, eventBus, quotaManager);
+        QuotaComponents quotaComponents = new QuotaComponents(maxQuotaManager, quotaManager, quotaRootResolver, listeningCurrentQuotaUpdater);
+        MessageSearchIndex index = new SimpleMessageSearchIndex(mailboxSessionMapperFactory, mailboxSessionMapperFactory, new DefaultTextExtractor());
+
+        mailboxManager = new InMemoryMailboxManager(mailboxSessionMapperFactory, sessionProvider, locker, messageParser,
+            messageIdFactory, eventBus, annotationManager,  storeRightManager, quotaComponents, index);
+
+        eventBus.start();
+        eventBus.register(listeningCurrentQuotaUpdater);
+
+        ImapProcessor defaultImapProcessorFactory =
+            DefaultImapProcessorFactory.createDefaultProcessor(
+                mailboxManager,
+                eventBus,
+                sm,
+                quotaComponents.getQuotaManager(),
+                quotaComponents.getQuotaRootResolver(),
+                new DefaultMetricFactory());
+        configure(new DefaultImapDecoderFactory().buildImapDecoder(),
+            new DefaultImapEncoderFactory().buildImapEncoder(),
+            defaultImapProcessorFactory);
+    }
+
+
+    private RabbitMQConnectionFactory createRabbitConnectionFactory() throws URISyntaxException {
+        RabbitMQConfiguration rabbitMQConfiguration = RabbitMQConfiguration.builder()
+            .amqpUri(dockerRabbitMQ.amqpUri())
+            .managementUri(dockerRabbitMQ.managementUri())
+            .managementCredentials(DEFAULT_MANAGEMENT_CREDENTIAL)
+            .maxRetries(THREE_RETRIES)
+            .minDelay(ONE_HUNDRED_MILLISECONDS)
+            .build();
+
+        ThreadFactory threadFactory = NamedThreadFactory.withClassName(getClass());
+        return new RabbitMQConnectionFactory(
+            rabbitMQConfiguration,
+            new AsyncRetryExecutor(Executors.newSingleThreadScheduledExecutor(threadFactory)));
+    }
+
+    @Override
+    public void afterTest() {
+        eventBus.stop();
+    }
+
+    @Override
+    protected MailboxManager getMailboxManager() {
+        return mailboxManager;
+    }
+
+    @Override
+    public boolean supports(Feature... features) {
+        return SUPPORTED_FEATURES.supports(features);
+    }
+
+    @Override
+    public void setQuotaLimits(QuotaCount maxMessageQuota, QuotaSize maxStorageQuota) {
+        maxQuotaManager.setGlobalMaxMessage(maxMessageQuota);
+        maxQuotaManager.setGlobalMaxStorage(maxStorageQuota);
+    }
+
+    @Override
+    protected void await() {
+        try {
+            TimeUnit.SECONDS.sleep(1);
+        } catch (InterruptedException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/6a9554c3/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/host/RabbitMQEventBusHostSystemRule.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/host/RabbitMQEventBusHostSystemRule.java b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/host/RabbitMQEventBusHostSystemRule.java
new file mode 100644
index 0000000..d449eb0
--- /dev/null
+++ b/mpt/impl/imap-mailbox/rabbitmq/src/test/java/org/apache/james/mpt/imapmailbox/rabbitmq/host/RabbitMQEventBusHostSystemRule.java
@@ -0,0 +1,52 @@
+/****************************************************************
+ * 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.mpt.imapmailbox.rabbitmq.host;
+
+import org.apache.james.backend.rabbitmq.DockerRabbitMQTestRule;
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+public class RabbitMQEventBusHostSystemRule implements TestRule {
+
+    private final DockerRabbitMQTestRule dockerRabbitMQTestRule;
+    private RabbitMQEventBusHostSystem hostSystem;
+
+    public RabbitMQEventBusHostSystemRule(DockerRabbitMQTestRule dockerRabbitMQTestRule) {
+        this.dockerRabbitMQTestRule = dockerRabbitMQTestRule;
+    }
+
+    @Override
+    public Statement apply(Statement base, Description description) {
+        return new Statement() {
+            @Override
+            public void evaluate() throws Throwable {
+                hostSystem = new RabbitMQEventBusHostSystem(dockerRabbitMQTestRule.getDockerRabbitMQ());
+                hostSystem.beforeTest();
+                base.evaluate();
+                hostSystem.afterTest();
+            }
+        };
+    }
+
+    public RabbitMQEventBusHostSystem getHostSystem() {
+        return hostSystem;
+    }
+}


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


[8/8] james-project git commit: MAILBOX-374 reuse forks for RabbitMQ MPT testing

Posted by bt...@apache.org.
MAILBOX-374 reuse forks for RabbitMQ MPT testing

This allow to perform all the tests on a single RabbitMQ container


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

Branch: refs/heads/master
Commit: 0e9cd67e19dfed202a6fbdbc09fc115c54487a58
Parents: 2c84e32
Author: Benoit Tellier <bt...@linagora.com>
Authored: Wed Jan 23 10:23:33 2019 +0700
Committer: Benoit Tellier <bt...@linagora.com>
Committed: Thu Jan 24 09:46:04 2019 +0700

----------------------------------------------------------------------
 mpt/impl/imap-mailbox/rabbitmq/pom.xml | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/0e9cd67e/mpt/impl/imap-mailbox/rabbitmq/pom.xml
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/rabbitmq/pom.xml b/mpt/impl/imap-mailbox/rabbitmq/pom.xml
index 90e9520..5f54be4 100644
--- a/mpt/impl/imap-mailbox/rabbitmq/pom.xml
+++ b/mpt/impl/imap-mailbox/rabbitmq/pom.xml
@@ -83,4 +83,16 @@
             <scope>test</scope>
         </dependency>
     </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <reuseForks>true</reuseForks>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>
\ No newline at end of file


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