This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 9b7529d930c709dd9530d30a84da084879ceb5b6 Author: Rémi KOWALSKI <[email protected]> AuthorDate: Wed Mar 11 11:44:10 2020 +0100 JAMES-3082 use a specific RetryBackOffConfiguration for tests with a shorter first backoff delay --- .../org/apache/james/mailbox/events/ErrorHandlingContract.java | 10 ++++++---- .../org/apache/james/mailbox/events/EventBusTestFixture.java | 10 ++++++++++ .../mailbox/cassandra/CassandraCombinationManagerTest.java | 4 +++- .../mailbox/cassandra/CassandraMailboxManagerProvider.java | 4 +++- .../cassandra/CassandraMessageIdManagerStorageTest.java | 4 +++- .../james/mailbox/cassandra/CassandraTestSystemFixture.java | 4 +++- .../cassandra/mail/CassandraMailboxManagerAttachmentTest.java | 4 +++- .../java/org/apache/james/mailbox/events/InVMEventBus.java | 6 ------ .../java/org/apache/james/mailbox/events/InVMEventBusTest.java | 2 +- .../apache/james/mailbox/jpa/JpaMailboxManagerProvider.java | 4 +++- .../james/mailbox/maildir/MaildirMailboxManagerProvider.java | 4 +++- .../mailbox/inmemory/manager/InMemoryIntegrationResources.java | 4 +++- .../mailing/listeners/QuotaThresholdListenersTestSystem.java | 4 +++- .../mailbox/store/AbstractMessageIdManagerSideEffectTest.java | 4 +++- .../apache/james/mailbox/store/StoreMailboxManagerTest.java | 4 +++- mpt/impl/imap-mailbox/cassandra/pom.xml | 6 ++++++ .../mpt/imapmailbox/cassandra/host/CassandraHostSystem.java | 4 +++- mpt/impl/imap-mailbox/jpa/pom.xml | 6 ++++++ .../apache/james/mpt/imapmailbox/jpa/host/JPAHostSystem.java | 4 +++- mpt/impl/imap-mailbox/maildir/pom.xml | 6 ++++++ .../james/mpt/imapmailbox/maildir/host/MaildirHostSystem.java | 4 +++- .../james/imap/processor/base/MailboxEventAnalyserTest.java | 4 +++- server/container/guice/mailbox/pom.xml | 6 ++++++ .../james/modules/mailbox/MailboxListenersLoaderImplTest.java | 4 +++- 24 files changed, 89 insertions(+), 27 deletions(-) diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/events/ErrorHandlingContract.java b/mailbox/api/src/test/java/org/apache/james/mailbox/events/ErrorHandlingContract.java index 35aaea2..4c9612d 100644 --- a/mailbox/api/src/test/java/org/apache/james/mailbox/events/ErrorHandlingContract.java +++ b/mailbox/api/src/test/java/org/apache/james/mailbox/events/ErrorHandlingContract.java @@ -19,12 +19,14 @@ package org.apache.james.mailbox.events; +import static org.apache.james.mailbox.events.EventBusTestFixture.DEFAULT_FIRST_BACKOFF; import static org.apache.james.mailbox.events.EventBusTestFixture.EVENT; import static org.apache.james.mailbox.events.EventBusTestFixture.EVENT_2; import static org.apache.james.mailbox.events.EventBusTestFixture.EVENT_ID; import static org.apache.james.mailbox.events.EventBusTestFixture.GROUP_A; import static org.apache.james.mailbox.events.EventBusTestFixture.KEY_1; import static org.apache.james.mailbox.events.EventBusTestFixture.NO_KEYS; +import static org.apache.james.mailbox.events.EventBusTestFixture.RETRY_BACKOFF_CONFIGURATION; import static org.apache.james.mailbox.events.EventBusTestFixture.WAIT_CONDITION; import static org.apache.james.mailbox.events.EventBusTestFixture.WAIT_CONDITION_LONG; import static org.assertj.core.api.Assertions.assertThat; @@ -178,11 +180,11 @@ interface ErrorHandlingContract extends EventBusContract { TimeUnit.MINUTES.sleep(1); SoftAssertions.assertSoftly(softly -> { List<Instant> timeElapsed = throwingListener.timeElapsed; - softly.assertThat(timeElapsed).hasSize(RetryBackoffConfiguration.DEFAULT.DEFAULT_MAX_RETRIES + 1); + softly.assertThat(timeElapsed).hasSize(RETRY_BACKOFF_CONFIGURATION.getMaxRetries() + 1); - long minFirstDelayAfter = 100; // first backOff - long minSecondDelayAfter = 50; // 50 * jitter factor (50 * 0.5) - long minThirdDelayAfter = 100; // 100 * jitter factor (100 * 0.5) + long minFirstDelayAfter = DEFAULT_FIRST_BACKOFF.toMillis(); // first backOff + long minSecondDelayAfter = DEFAULT_FIRST_BACKOFF.toMillis() / 2; // first_backOff * jitter factor (first_backOff * 0.5) + long minThirdDelayAfter = DEFAULT_FIRST_BACKOFF.toMillis(); // first_backOff * jitter factor (first_backOff * 1) softly.assertThat(timeElapsed.get(1)) .isAfterOrEqualTo(timeElapsed.get(0).plusMillis(minFirstDelayAfter)); diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/events/EventBusTestFixture.java b/mailbox/api/src/test/java/org/apache/james/mailbox/events/EventBusTestFixture.java index 06515e0..1d637b0 100644 --- a/mailbox/api/src/test/java/org/apache/james/mailbox/events/EventBusTestFixture.java +++ b/mailbox/api/src/test/java/org/apache/james/mailbox/events/EventBusTestFixture.java @@ -19,6 +19,8 @@ package org.apache.james.mailbox.events; +import static org.apache.james.mailbox.events.RetryBackoffConfiguration.DEFAULT_JITTER_FACTOR; +import static org.apache.james.mailbox.events.RetryBackoffConfiguration.DEFAULT_MAX_RETRIES; import static org.awaitility.Awaitility.await; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; @@ -119,6 +121,14 @@ public interface EventBusTestFixture { ConditionFactory WAIT_CONDITION = await().timeout(Duration.FIVE_SECONDS); ConditionFactory WAIT_CONDITION_LONG = await().timeout(Duration.ONE_MINUTE); + java.time.Duration DEFAULT_FIRST_BACKOFF = java.time.Duration.ofMillis(20); + //Retry backoff configuration for testing with a shorter first backoff to accommodate the shorter retry interval in tests + RetryBackoffConfiguration RETRY_BACKOFF_CONFIGURATION = RetryBackoffConfiguration.builder() + .maxRetries(DEFAULT_MAX_RETRIES) + .firstBackoff(DEFAULT_FIRST_BACKOFF) + .jitterFactor(DEFAULT_JITTER_FACTOR) + .build(); + static MailboxListener newListener() { MailboxListener listener = mock(MailboxListener.class); when(listener.getExecutionMode()).thenReturn(MailboxListener.ExecutionMode.SYNCHRONOUS); diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraCombinationManagerTest.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraCombinationManagerTest.java index 63871af..88ef7a5 100644 --- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraCombinationManagerTest.java +++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraCombinationManagerTest.java @@ -21,7 +21,9 @@ package org.apache.james.mailbox.cassandra; import org.apache.james.backends.cassandra.CassandraClusterExtension; import org.apache.james.mailbox.cassandra.mail.MailboxAggregateModule; +import org.apache.james.mailbox.events.EventBusTestFixture; import org.apache.james.mailbox.events.InVMEventBus; +import org.apache.james.mailbox.events.MemoryEventDeadLetters; import org.apache.james.mailbox.events.delivery.InVmEventDelivery; import org.apache.james.mailbox.store.AbstractCombinationManagerTest; import org.apache.james.mailbox.store.CombinationManagerTestSystem; @@ -35,7 +37,7 @@ class CassandraCombinationManagerTest extends AbstractCombinationManagerTest { @Override public CombinationManagerTestSystem createTestingData() { - InVMEventBus eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory())); + InVMEventBus eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory()), EventBusTestFixture.RETRY_BACKOFF_CONFIGURATION, new MemoryEventDeadLetters()); return CassandraCombinationManagerTestSystem.createTestingData(cassandraCluster.getCassandraCluster(), new NoQuotaManager(), eventBus); } diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMailboxManagerProvider.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMailboxManagerProvider.java index 1ccb948..0c1b448 100644 --- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMailboxManagerProvider.java +++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMailboxManagerProvider.java @@ -30,7 +30,9 @@ import org.apache.james.mailbox.cassandra.quota.CassandraGlobalMaxQuotaDao; import org.apache.james.mailbox.cassandra.quota.CassandraPerDomainMaxQuotaDao; import org.apache.james.mailbox.cassandra.quota.CassandraPerUserMaxQuotaDao; import org.apache.james.mailbox.cassandra.quota.CassandraPerUserMaxQuotaManager; +import org.apache.james.mailbox.events.EventBusTestFixture; import org.apache.james.mailbox.events.InVMEventBus; +import org.apache.james.mailbox.events.MemoryEventDeadLetters; import org.apache.james.mailbox.events.delivery.InVmEventDelivery; import org.apache.james.mailbox.model.MessageId; import org.apache.james.mailbox.quota.QuotaRootResolver; @@ -77,7 +79,7 @@ public class CassandraMailboxManagerProvider { MailboxACLResolver aclResolver = new UnionMailboxACLResolver(); GroupMembershipResolver groupMembershipResolver = new SimpleGroupMembershipResolver(); MessageParser messageParser = new MessageParser(); - InVMEventBus eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory())); + InVMEventBus eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory()), EventBusTestFixture.RETRY_BACKOFF_CONFIGURATION, new MemoryEventDeadLetters()); StoreRightManager storeRightManager = new StoreRightManager(mapperFactory, aclResolver, groupMembershipResolver, eventBus); Authenticator noAuthenticator = null; diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMessageIdManagerStorageTest.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMessageIdManagerStorageTest.java index ce54298..d536fd4 100644 --- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMessageIdManagerStorageTest.java +++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraMessageIdManagerStorageTest.java @@ -21,7 +21,9 @@ package org.apache.james.mailbox.cassandra; import org.apache.james.backends.cassandra.CassandraClusterExtension; import org.apache.james.mailbox.cassandra.mail.MailboxAggregateModule; +import org.apache.james.mailbox.events.EventBusTestFixture; import org.apache.james.mailbox.events.InVMEventBus; +import org.apache.james.mailbox.events.MemoryEventDeadLetters; import org.apache.james.mailbox.events.delivery.InVmEventDelivery; import org.apache.james.mailbox.extension.PreDeletionHook; import org.apache.james.mailbox.store.AbstractMessageIdManagerStorageTest; @@ -36,7 +38,7 @@ class CassandraMessageIdManagerStorageTest extends AbstractMessageIdManagerStora @Override protected MessageIdManagerTestSystem createTestingData() { - InVMEventBus eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory())); + InVMEventBus eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory()), EventBusTestFixture.RETRY_BACKOFF_CONFIGURATION, new MemoryEventDeadLetters()); return CassandraMessageIdManagerTestSystem.createTestingData(cassandraCluster.getCassandraCluster(), new NoQuotaManager(), eventBus, PreDeletionHook.NO_PRE_DELETION_HOOK); } } diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraTestSystemFixture.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraTestSystemFixture.java index ec3e121..5acf657 100644 --- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraTestSystemFixture.java +++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraTestSystemFixture.java @@ -31,7 +31,9 @@ import org.apache.james.mailbox.cassandra.quota.CassandraPerDomainMaxQuotaDao; import org.apache.james.mailbox.cassandra.quota.CassandraPerUserMaxQuotaDao; import org.apache.james.mailbox.cassandra.quota.CassandraPerUserMaxQuotaManager; import org.apache.james.mailbox.events.EventBus; +import org.apache.james.mailbox.events.EventBusTestFixture; import org.apache.james.mailbox.events.InVMEventBus; +import org.apache.james.mailbox.events.MemoryEventDeadLetters; import org.apache.james.mailbox.events.delivery.InVmEventDelivery; import org.apache.james.mailbox.quota.CurrentQuotaManager; import org.apache.james.mailbox.quota.MaxQuotaManager; @@ -63,7 +65,7 @@ class CassandraTestSystemFixture { } static CassandraMailboxManager createMailboxManager(CassandraMailboxSessionMapperFactory mapperFactory) { - InVMEventBus eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory())); + InVMEventBus eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory()), EventBusTestFixture.RETRY_BACKOFF_CONFIGURATION, new MemoryEventDeadLetters()); StoreRightManager storeRightManager = new StoreRightManager(mapperFactory, new UnionMailboxACLResolver(), new SimpleGroupMembershipResolver(), eventBus); StoreMailboxAnnotationManager annotationManager = new StoreMailboxAnnotationManager(mapperFactory, storeRightManager); diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxManagerAttachmentTest.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxManagerAttachmentTest.java index 05f39ff..63fa332 100644 --- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxManagerAttachmentTest.java +++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxManagerAttachmentTest.java @@ -30,7 +30,9 @@ import org.apache.james.mailbox.cassandra.CassandraMailboxManager; import org.apache.james.mailbox.cassandra.CassandraMailboxSessionMapperFactory; import org.apache.james.mailbox.cassandra.TestCassandraMailboxSessionMapperFactory; import org.apache.james.mailbox.cassandra.ids.CassandraMessageId; +import org.apache.james.mailbox.events.EventBusTestFixture; import org.apache.james.mailbox.events.InVMEventBus; +import org.apache.james.mailbox.events.MemoryEventDeadLetters; import org.apache.james.mailbox.events.delivery.InVmEventDelivery; import org.apache.james.mailbox.store.AbstractMailboxManagerAttachmentTest; import org.apache.james.mailbox.store.Authenticator; @@ -75,7 +77,7 @@ class CassandraMailboxManagerAttachmentTest extends AbstractMailboxManagerAttach messageIdFactory); Authenticator noAuthenticator = null; Authorizator noAuthorizator = null; - InVMEventBus eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory())); + InVMEventBus eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory()), EventBusTestFixture.RETRY_BACKOFF_CONFIGURATION, new MemoryEventDeadLetters()); StoreRightManager storeRightManager = new StoreRightManager(mailboxSessionMapperFactory, new UnionMailboxACLResolver(), new SimpleGroupMembershipResolver(), eventBus); StoreMailboxAnnotationManager annotationManager = new StoreMailboxAnnotationManager(mailboxSessionMapperFactory, storeRightManager); diff --git a/mailbox/event/event-memory/src/main/java/org/apache/james/mailbox/events/InVMEventBus.java b/mailbox/event/event-memory/src/main/java/org/apache/james/mailbox/events/InVMEventBus.java index 50ebcf6..97be8bb 100644 --- a/mailbox/event/event-memory/src/main/java/org/apache/james/mailbox/events/InVMEventBus.java +++ b/mailbox/event/event-memory/src/main/java/org/apache/james/mailbox/events/InVMEventBus.java @@ -30,7 +30,6 @@ import org.apache.james.mailbox.events.delivery.EventDelivery.PermanentFailureHa import org.apache.james.mailbox.events.delivery.EventDelivery.Retryer.BackoffRetryer; import com.github.steveash.guavate.Guavate; -import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; import com.google.common.collect.Multimaps; @@ -56,11 +55,6 @@ public class InVMEventBus implements EventBus { this.groups = new ConcurrentHashMap<>(); } - @VisibleForTesting - public InVMEventBus(EventDelivery eventDelivery) { - this(eventDelivery, RetryBackoffConfiguration.DEFAULT, new MemoryEventDeadLetters()); - } - @Override public Registration register(MailboxListener listener, RegistrationKey key) { registrations.put(key, listener); diff --git a/mailbox/event/event-memory/src/test/java/org/apache/james/mailbox/events/InVMEventBusTest.java b/mailbox/event/event-memory/src/test/java/org/apache/james/mailbox/events/InVMEventBusTest.java index 18e0a19..3195baa 100644 --- a/mailbox/event/event-memory/src/test/java/org/apache/james/mailbox/events/InVMEventBusTest.java +++ b/mailbox/event/event-memory/src/test/java/org/apache/james/mailbox/events/InVMEventBusTest.java @@ -33,7 +33,7 @@ public class InVMEventBusTest implements KeyContract.SingleEventBusKeyContract, void setUp() { deadLetters = new MemoryEventDeadLetters(); eventBus = new InVMEventBus( - new InVmEventDelivery(new RecordingMetricFactory()), RetryBackoffConfiguration.DEFAULT, deadLetters); + new InVmEventDelivery(new RecordingMetricFactory()), EventBusTestFixture.RETRY_BACKOFF_CONFIGURATION, deadLetters); } @Override diff --git a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JpaMailboxManagerProvider.java b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JpaMailboxManagerProvider.java index 5c11441..d881da5 100644 --- a/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JpaMailboxManagerProvider.java +++ b/mailbox/jpa/src/test/java/org/apache/james/mailbox/jpa/JpaMailboxManagerProvider.java @@ -26,7 +26,9 @@ 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.EventBusTestFixture; import org.apache.james.mailbox.events.InVMEventBus; +import org.apache.james.mailbox.events.MemoryEventDeadLetters; import org.apache.james.mailbox.events.delivery.InVmEventDelivery; import org.apache.james.mailbox.jpa.mail.JPAModSeqProvider; import org.apache.james.mailbox.jpa.mail.JPAUidProvider; @@ -60,7 +62,7 @@ public class JpaMailboxManagerProvider { Authenticator noAuthenticator = null; Authorizator noAuthorizator = null; - InVMEventBus eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory())); + InVMEventBus eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory()), EventBusTestFixture.RETRY_BACKOFF_CONFIGURATION, new MemoryEventDeadLetters()); StoreRightManager storeRightManager = new StoreRightManager(mf, aclResolver, groupMembershipResolver, eventBus); StoreMailboxAnnotationManager annotationManager = new StoreMailboxAnnotationManager(mf, storeRightManager, LIMIT_ANNOTATIONS, LIMIT_ANNOTATION_SIZE); diff --git a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxManagerProvider.java b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxManagerProvider.java index 2b67512..c5da05b 100644 --- a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxManagerProvider.java +++ b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxManagerProvider.java @@ -25,7 +25,9 @@ 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.EventBusTestFixture; import org.apache.james.mailbox.events.InVMEventBus; +import org.apache.james.mailbox.events.MemoryEventDeadLetters; import org.apache.james.mailbox.events.delivery.InVmEventDelivery; import org.apache.james.mailbox.store.Authenticator; import org.apache.james.mailbox.store.Authorizator; @@ -54,7 +56,7 @@ public class MaildirMailboxManagerProvider { GroupMembershipResolver groupMembershipResolver = new SimpleGroupMembershipResolver(); MessageParser messageParser = new MessageParser(); - InVMEventBus eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory())); + InVMEventBus eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory()), EventBusTestFixture.RETRY_BACKOFF_CONFIGURATION, new MemoryEventDeadLetters()); StoreRightManager storeRightManager = new StoreRightManager(mf, aclResolver, groupMembershipResolver, eventBus); Authenticator noAuthenticator = null; 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 f80a239..fcb95e7 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 @@ -28,8 +28,10 @@ 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.EventBusTestFixture; import org.apache.james.mailbox.events.InVMEventBus; import org.apache.james.mailbox.events.MailboxListener; +import org.apache.james.mailbox.events.MemoryEventDeadLetters; import org.apache.james.mailbox.events.delivery.InVmEventDelivery; import org.apache.james.mailbox.extension.PreDeletionHook; import org.apache.james.mailbox.inmemory.InMemoryMailboxManager; @@ -101,7 +103,7 @@ public class InMemoryIntegrationResources implements IntegrationResources<StoreM RequireAnnotationLimits eventBus(EventBus eventBus); default RequireAnnotationLimits inVmEventBus() { - return eventBus(new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory()))); + return eventBus(new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory()), EventBusTestFixture.RETRY_BACKOFF_CONFIGURATION, new MemoryEventDeadLetters())); } } diff --git a/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/listeners/QuotaThresholdListenersTestSystem.java b/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/listeners/QuotaThresholdListenersTestSystem.java index 129bf22..7969d46 100644 --- a/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/listeners/QuotaThresholdListenersTestSystem.java +++ b/mailbox/plugin/quota-mailing/src/test/java/org/apache/james/mailbox/quota/mailing/listeners/QuotaThresholdListenersTestSystem.java @@ -24,7 +24,9 @@ import org.apache.james.eventsourcing.eventstore.EventStore; import org.apache.james.filesystem.api.FileSystem; import org.apache.james.mailbox.events.Event; import org.apache.james.mailbox.events.EventBus; +import org.apache.james.mailbox.events.EventBusTestFixture; import org.apache.james.mailbox.events.InVMEventBus; +import org.apache.james.mailbox.events.MemoryEventDeadLetters; import org.apache.james.mailbox.events.RegistrationKey; import org.apache.james.mailbox.events.delivery.InVmEventDelivery; import org.apache.james.mailbox.exception.MailboxException; @@ -44,7 +46,7 @@ class QuotaThresholdListenersTestSystem { private final EventBus eventBus; QuotaThresholdListenersTestSystem(MailetContext mailetContext, EventStore eventStore, QuotaMailingListenerConfiguration configuration) throws MailboxException { - eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory())); + eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory()), EventBusTestFixture.RETRY_BACKOFF_CONFIGURATION, new MemoryEventDeadLetters()); FileSystem fileSystem = new FileSystemImpl(new JamesServerResourceLoader(".")); diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/AbstractMessageIdManagerSideEffectTest.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/AbstractMessageIdManagerSideEffectTest.java index a06bf95..52e7895 100644 --- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/AbstractMessageIdManagerSideEffectTest.java +++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/AbstractMessageIdManagerSideEffectTest.java @@ -47,8 +47,10 @@ import org.apache.james.mailbox.MessageUid; import org.apache.james.mailbox.MetadataWithMailboxId; import org.apache.james.mailbox.ModSeq; import org.apache.james.mailbox.events.EventBus; +import org.apache.james.mailbox.events.EventBusTestFixture; import org.apache.james.mailbox.events.InVMEventBus; import org.apache.james.mailbox.events.MailboxListener; +import org.apache.james.mailbox.events.MemoryEventDeadLetters; import org.apache.james.mailbox.events.MessageMoveEvent; import org.apache.james.mailbox.events.delivery.InVmEventDelivery; import org.apache.james.mailbox.exception.MailboxException; @@ -105,7 +107,7 @@ public abstract class AbstractMessageIdManagerSideEffectTest { @BeforeEach void setUp() throws Exception { - eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory())); + eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory()), EventBusTestFixture.RETRY_BACKOFF_CONFIGURATION, new MemoryEventDeadLetters()); eventCollector = new EventCollector(); quotaManager = mock(QuotaManager.class); diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/StoreMailboxManagerTest.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/StoreMailboxManagerTest.java index 334ebf5..6280122 100644 --- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/StoreMailboxManagerTest.java +++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/StoreMailboxManagerTest.java @@ -31,7 +31,9 @@ import org.apache.james.mailbox.MailboxSessionUtil; import org.apache.james.mailbox.MessageManager; import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver; import org.apache.james.mailbox.acl.UnionMailboxACLResolver; +import org.apache.james.mailbox.events.EventBusTestFixture; import org.apache.james.mailbox.events.InVMEventBus; +import org.apache.james.mailbox.events.MemoryEventDeadLetters; import org.apache.james.mailbox.events.delivery.InVmEventDelivery; import org.apache.james.mailbox.exception.BadCredentialsException; import org.apache.james.mailbox.exception.MailboxException; @@ -84,7 +86,7 @@ class StoreMailboxManagerTest { authenticator.addUser(CURRENT_USER, CURRENT_USER_PASSWORD); authenticator.addUser(ADMIN, ADMIN_PASSWORD); - InVMEventBus eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory())); + InVMEventBus eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory()), EventBusTestFixture.RETRY_BACKOFF_CONFIGURATION, new MemoryEventDeadLetters()); StoreRightManager storeRightManager = new StoreRightManager(mockedMapperFactory, new UnionMailboxACLResolver(), new SimpleGroupMembershipResolver(), eventBus); diff --git a/mpt/impl/imap-mailbox/cassandra/pom.xml b/mpt/impl/imap-mailbox/cassandra/pom.xml index f180712..124b887 100644 --- a/mpt/impl/imap-mailbox/cassandra/pom.xml +++ b/mpt/impl/imap-mailbox/cassandra/pom.xml @@ -43,6 +43,12 @@ </dependency> <dependency> <groupId>${james.groupId}</groupId> + <artifactId>apache-james-mailbox-api</artifactId> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>${james.groupId}</groupId> <artifactId>apache-james-mailbox-cassandra</artifactId> </dependency> <dependency> diff --git a/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/host/CassandraHostSystem.java b/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/host/CassandraHostSystem.java index 6027feb..d2ba763 100644 --- a/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/host/CassandraHostSystem.java +++ b/mpt/impl/imap-mailbox/cassandra/src/test/java/org/apache/james/mpt/imapmailbox/cassandra/host/CassandraHostSystem.java @@ -38,7 +38,9 @@ import org.apache.james.mailbox.cassandra.quota.CassandraGlobalMaxQuotaDao; import org.apache.james.mailbox.cassandra.quota.CassandraPerDomainMaxQuotaDao; import org.apache.james.mailbox.cassandra.quota.CassandraPerUserMaxQuotaDao; import org.apache.james.mailbox.cassandra.quota.CassandraPerUserMaxQuotaManager; +import org.apache.james.mailbox.events.EventBusTestFixture; import org.apache.james.mailbox.events.InVMEventBus; +import org.apache.james.mailbox.events.MemoryEventDeadLetters; import org.apache.james.mailbox.events.delivery.InVmEventDelivery; import org.apache.james.mailbox.quota.QuotaRootResolver; import org.apache.james.mailbox.store.JVMMailboxPathLocker; @@ -91,7 +93,7 @@ public class CassandraHostSystem extends JamesImapHostSystem { cassandra, messageIdFactory); - InVMEventBus eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory())); + InVMEventBus eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory()), EventBusTestFixture.RETRY_BACKOFF_CONFIGURATION, new MemoryEventDeadLetters()); StoreRightManager storeRightManager = new StoreRightManager(mapperFactory, new UnionMailboxACLResolver(), new SimpleGroupMembershipResolver(), eventBus); StoreMailboxAnnotationManager annotationManager = new StoreMailboxAnnotationManager(mapperFactory, storeRightManager); diff --git a/mpt/impl/imap-mailbox/jpa/pom.xml b/mpt/impl/imap-mailbox/jpa/pom.xml index feff9f3..1605137 100644 --- a/mpt/impl/imap-mailbox/jpa/pom.xml +++ b/mpt/impl/imap-mailbox/jpa/pom.xml @@ -39,6 +39,12 @@ </dependency> <dependency> <groupId>${james.groupId}</groupId> + <artifactId>apache-james-mailbox-api</artifactId> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>${james.groupId}</groupId> <artifactId>apache-james-mailbox-event-memory</artifactId> <scope>test</scope> </dependency> diff --git a/mpt/impl/imap-mailbox/jpa/src/test/java/org/apache/james/mpt/imapmailbox/jpa/host/JPAHostSystem.java b/mpt/impl/imap-mailbox/jpa/src/test/java/org/apache/james/mpt/imapmailbox/jpa/host/JPAHostSystem.java index d4be1ce..b8d8aa8 100644 --- a/mpt/impl/imap-mailbox/jpa/src/test/java/org/apache/james/mpt/imapmailbox/jpa/host/JPAHostSystem.java +++ b/mpt/impl/imap-mailbox/jpa/src/test/java/org/apache/james/mpt/imapmailbox/jpa/host/JPAHostSystem.java @@ -34,7 +34,9 @@ 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.EventBusTestFixture; import org.apache.james.mailbox.events.InVMEventBus; +import org.apache.james.mailbox.events.MemoryEventDeadLetters; import org.apache.james.mailbox.events.delivery.InVmEventDelivery; import org.apache.james.mailbox.jpa.JPAMailboxFixture; import org.apache.james.mailbox.jpa.JPAMailboxSessionMapperFactory; @@ -101,7 +103,7 @@ public class JPAHostSystem extends JamesImapHostSystem { MessageParser messageParser = new MessageParser(); - InVMEventBus eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory())); + InVMEventBus eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory()), EventBusTestFixture.RETRY_BACKOFF_CONFIGURATION, new MemoryEventDeadLetters()); StoreRightManager storeRightManager = new StoreRightManager(mapperFactory, aclResolver, groupMembershipResolver, eventBus); StoreMailboxAnnotationManager annotationManager = new StoreMailboxAnnotationManager(mapperFactory, storeRightManager); SessionProviderImpl sessionProvider = new SessionProviderImpl(authenticator, authorizator); diff --git a/mpt/impl/imap-mailbox/maildir/pom.xml b/mpt/impl/imap-mailbox/maildir/pom.xml index 23051f1..6d96db8 100644 --- a/mpt/impl/imap-mailbox/maildir/pom.xml +++ b/mpt/impl/imap-mailbox/maildir/pom.xml @@ -33,6 +33,12 @@ <dependencies> <dependency> <groupId>${james.groupId}</groupId> + <artifactId>apache-james-mailbox-api</artifactId> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>${james.groupId}</groupId> <artifactId>apache-james-mailbox-event-memory</artifactId> <scope>test</scope> </dependency> diff --git a/mpt/impl/imap-mailbox/maildir/src/test/java/org/apache/james/mpt/imapmailbox/maildir/host/MaildirHostSystem.java b/mpt/impl/imap-mailbox/maildir/src/test/java/org/apache/james/mpt/imapmailbox/maildir/host/MaildirHostSystem.java index 86472c1..2f52724 100644 --- a/mpt/impl/imap-mailbox/maildir/src/test/java/org/apache/james/mpt/imapmailbox/maildir/host/MaildirHostSystem.java +++ b/mpt/impl/imap-mailbox/maildir/src/test/java/org/apache/james/mpt/imapmailbox/maildir/host/MaildirHostSystem.java @@ -33,7 +33,9 @@ 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.EventBusTestFixture; import org.apache.james.mailbox.events.InVMEventBus; +import org.apache.james.mailbox.events.MemoryEventDeadLetters; import org.apache.james.mailbox.events.delivery.InVmEventDelivery; import org.apache.james.mailbox.maildir.MaildirMailboxSessionMapperFactory; import org.apache.james.mailbox.maildir.MaildirStore; @@ -77,7 +79,7 @@ public class MaildirHostSystem extends JamesImapHostSystem { GroupMembershipResolver groupMembershipResolver = new SimpleGroupMembershipResolver(); MessageParser messageParser = new MessageParser(); - InVMEventBus eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory())); + InVMEventBus eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory()), EventBusTestFixture.RETRY_BACKOFF_CONFIGURATION, new MemoryEventDeadLetters()); StoreRightManager storeRightManager = new StoreRightManager(mailboxSessionMapperFactory, aclResolver, groupMembershipResolver, eventBus); StoreMailboxAnnotationManager annotationManager = new StoreMailboxAnnotationManager(mailboxSessionMapperFactory, storeRightManager); SessionProviderImpl sessionProvider = new SessionProviderImpl(authenticator, authorizator); diff --git a/protocols/imap/src/test/java/org/apache/james/imap/processor/base/MailboxEventAnalyserTest.java b/protocols/imap/src/test/java/org/apache/james/imap/processor/base/MailboxEventAnalyserTest.java index 736a0f3..8538203 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/processor/base/MailboxEventAnalyserTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/processor/base/MailboxEventAnalyserTest.java @@ -39,8 +39,10 @@ import org.apache.james.mailbox.MessageManager; import org.apache.james.mailbox.MessageUid; import org.apache.james.mailbox.ModSeq; import org.apache.james.mailbox.events.Event; +import org.apache.james.mailbox.events.EventBusTestFixture; import org.apache.james.mailbox.events.InVMEventBus; import org.apache.james.mailbox.events.MailboxListener; +import org.apache.james.mailbox.events.MemoryEventDeadLetters; import org.apache.james.mailbox.events.delivery.InVmEventDelivery; import org.apache.james.mailbox.exception.MailboxException; import org.apache.james.mailbox.model.Mailbox; @@ -131,7 +133,7 @@ public class MailboxEventAnalyserTest { @Before public void setUp() throws MailboxException { FakeImapSession imapSession = new FakeImapSession(); - InVMEventBus eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory())); + InVMEventBus eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory()), EventBusTestFixture.RETRY_BACKOFF_CONFIGURATION, new MemoryEventDeadLetters()); imapSession.setMailboxSession(MAILBOX_SESSION); imapSession.authenticated(); diff --git a/server/container/guice/mailbox/pom.xml b/server/container/guice/mailbox/pom.xml index 1360545..ab283e7 100644 --- a/server/container/guice/mailbox/pom.xml +++ b/server/container/guice/mailbox/pom.xml @@ -38,6 +38,12 @@ </dependency> <dependency> <groupId>${james.groupId}</groupId> + <artifactId>apache-james-mailbox-api</artifactId> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>${james.groupId}</groupId> <artifactId>apache-james-mailbox-event-memory</artifactId> </dependency> <dependency> diff --git a/server/container/guice/mailbox/src/test/java/org/apache/james/modules/mailbox/MailboxListenersLoaderImplTest.java b/server/container/guice/mailbox/src/test/java/org/apache/james/modules/mailbox/MailboxListenersLoaderImplTest.java index 5ae23b0..438d14e 100644 --- a/server/container/guice/mailbox/src/test/java/org/apache/james/modules/mailbox/MailboxListenersLoaderImplTest.java +++ b/server/container/guice/mailbox/src/test/java/org/apache/james/modules/mailbox/MailboxListenersLoaderImplTest.java @@ -33,10 +33,12 @@ import org.apache.commons.configuration2.XMLConfiguration; import org.apache.commons.configuration2.ex.ConfigurationException; import org.apache.commons.lang3.tuple.Pair; import org.apache.james.filesystem.api.FileSystem; +import org.apache.james.mailbox.events.EventBusTestFixture; import org.apache.james.mailbox.events.GenericGroup; import org.apache.james.mailbox.events.Group; import org.apache.james.mailbox.events.InVMEventBus; import org.apache.james.mailbox.events.MailboxListener; +import org.apache.james.mailbox.events.MemoryEventDeadLetters; import org.apache.james.mailbox.events.delivery.InVmEventDelivery; import org.apache.james.metrics.tests.RecordingMetricFactory; import org.apache.james.server.core.configuration.FileConfigurationProvider; @@ -58,7 +60,7 @@ class MailboxListenersLoaderImplTest { when(fileSystem.getFile(anyString())) .thenThrow(new FileNotFoundException()); - eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory())); + eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory()), EventBusTestFixture.RETRY_BACKOFF_CONFIGURATION, new MemoryEventDeadLetters()); GuiceGenericLoader genericLoader = GuiceGenericLoader.forTesting(new ExtendedClassLoader(fileSystem)); testee = new MailboxListenersLoaderImpl(new MailboxListenerFactory(genericLoader), eventBus, ImmutableSet.of()); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
