[jira] [Commented] (JAMES-3171) Port to jmap mailboxes/get (all)
[ https://issues.apache.org/jira/browse/JAMES-3171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17124507#comment-17124507 ] Benoit Tellier commented on JAMES-3171: --- https://github.com/linagora/james-project/pull/3406 solved a bug on draft version, where a shared mailbox was having a role for the sharee. > Port to jmap mailboxes/get (all) > > > Key: JAMES-3171 > URL: https://issues.apache.org/jira/browse/JAMES-3171 > Project: James Server > Issue Type: Improvement >Reporter: Nguyễn Việt Đức >Priority: Major > > when no ids are passed to Mailboxes/get, the list of all mailboxes is > returned. > If some ids are passed -> fail > We need integration tests for it. -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[james-project] 02/04: JAMES-3143 Fix unstable Consistency integration test
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 ad16b8cac6b7963040ba434e729dd4e7d7fe52ff Author: Benoit Tellier AuthorDate: Mon Jun 1 10:44:25 2020 +0700 JAMES-3143 Fix unstable Consistency integration test When sending a mails, localDelivery fails. A bounce is generated for the sender, who is local, thus localDelivery fails again. The time window during which only one email processing had been failing is thus short, we should await that "at least once email delivery" had been failing. --- .../webadmin/integration/rabbitmq/ConsistencyTasksIntegrationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/ConsistencyTasksIntegrationTest.java b/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/ConsistencyTasksIntegrationTest.java index 5475b55..6d9335b 100644 --- a/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/ConsistencyTasksIntegrationTest.java +++ b/server/protocols/webadmin-integration-test/distributed-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/rabbitmq/ConsistencyTasksIntegrationTest.java @@ -266,7 +266,7 @@ class ConsistencyTasksIntegrationTest { Awaitility.await() .untilAsserted(() -> assertThat(server.getProbe(MailRepositoryProbeImpl.class) - .getRepositoryMailCount(MailRepositoryUrl.from("cassandra://var/mail/error/"))).isEqualTo(1)); + .getRepositoryMailCount(MailRepositoryUrl.from("cassandra://var/mail/error/"))).isGreaterThanOrEqualTo(1)); server.getProbe(TestingSessionProbe.class) .getTestingSession().registerScenario(executeNormally() - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[james-project] 01/04: JAMES-3072 Await task completion in Mailbox Export webAdmin tests
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 752cdf259522ac7c4d171f6bb4b1b68ceb9cf617 Author: Benoit Tellier AuthorDate: Tue Jun 2 17:03:19 2020 +0700 JAMES-3072 Await task completion in Mailbox Export webAdmin tests Task completion cannot be expected to be instantaneous. --- .../james/webadmin/service/MailboxesExportRequestToTaskTest.java | 4 1 file changed, 4 insertions(+) diff --git a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/service/MailboxesExportRequestToTaskTest.java b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/service/MailboxesExportRequestToTaskTest.java index ab9eb19..0e856dc 100644 --- a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/service/MailboxesExportRequestToTaskTest.java +++ b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/service/MailboxesExportRequestToTaskTest.java @@ -235,6 +235,10 @@ class MailboxesExportRequestToTaskTest { .jsonPath() .get("taskId"); +with() +.basePath(TasksRoutes.BASE) +.get(taskId + "/await"); + String fileUrl = testSystem.mailetContext.getSentMails().get(0).getMsg().getHeader(CORRESPONDING_FILE_HEADER)[0]; ZipAssert.assertThatZip(new FileInputStream(fileUrl)) .hasNoEntry(); - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[james-project] 04/04: JAMES-3117 PeriodicalHealthChecks cleanup and additional tests
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 0f2742b15b7c12baab909a2265ad8f7842a3b14e Author: LanKhuat AuthorDate: Wed Apr 8 11:12:40 2020 +0700 JAMES-3117 PeriodicalHealthChecks cleanup and additional tests JAMES-3117 Change return type of HealthCheck to Publisher fixup! JAMES-3117 Reactive Healthchecks --- .../cassandra/utils/CassandraAsyncExecutor.java| 8 +- .../cassandra/utils/CassandraHealthCheck.java | 3 +- .../backends/es/ElasticSearchHealthCheck.java | 1 - .../org/apache/james/PeriodicalHealthChecks.java | 6 +- .../apache/james/PeriodicalHealthChecksTest.java | 123 +++-- .../james/webadmin/routes/HealthCheckRoutes.java | 49 6 files changed, 148 insertions(+), 42 deletions(-) diff --git a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/utils/CassandraAsyncExecutor.java b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/utils/CassandraAsyncExecutor.java index 24bf48e..4005cc5 100644 --- a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/utils/CassandraAsyncExecutor.java +++ b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/utils/CassandraAsyncExecutor.java @@ -50,15 +50,9 @@ public class CassandraAsyncExecutor { .publishOn(Schedulers.elastic())); } -public Mono execute(String statement) { -return Mono.defer(() -> Mono.fromFuture(FutureConverter -.toCompletableFuture(session.executeAsync(statement))) -.publishOn(Schedulers.elastic())); -} - public Mono executeReturnApplied(Statement statement) { return execute(statement) -.map(row -> row.wasApplied()); +.map(ResultSet::wasApplied); } public Mono executeVoid(Statement statement) { diff --git a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/utils/CassandraHealthCheck.java b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/utils/CassandraHealthCheck.java index 07f575b..d37060d 100644 --- a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/utils/CassandraHealthCheck.java +++ b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/utils/CassandraHealthCheck.java @@ -26,6 +26,7 @@ import org.apache.james.core.healthcheck.HealthCheck; import org.apache.james.core.healthcheck.Result; import com.datastax.driver.core.Session; +import com.datastax.driver.core.SimpleStatement; import reactor.core.publisher.Mono; @@ -54,7 +55,7 @@ public class CassandraHealthCheck implements HealthCheck { public Mono check() { // execute a simple query to check if cassandra is responding // idea from: https://stackoverflow.com/questions/10246287 -return queryExecutor.execute(SAMPLE_QUERY) +return queryExecutor.execute(new SimpleStatement(SAMPLE_QUERY)) .map(resultSet -> Result.healthy(COMPONENT_NAME)) .onErrorResume(e -> Mono.just(Result.unhealthy(COMPONENT_NAME, "Error checking Cassandra backend", e))); } diff --git a/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/ElasticSearchHealthCheck.java b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/ElasticSearchHealthCheck.java index 1d3f92e..fc23ef5 100644 --- a/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/ElasticSearchHealthCheck.java +++ b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/ElasticSearchHealthCheck.java @@ -36,7 +36,6 @@ import com.google.common.annotations.VisibleForTesting; import reactor.core.publisher.Mono; - public class ElasticSearchHealthCheck implements HealthCheck { private static final ComponentName COMPONENT_NAME = new ComponentName("ElasticSearch Backend"); diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/PeriodicalHealthChecks.java b/server/container/guice/guice-common/src/main/java/org/apache/james/PeriodicalHealthChecks.java index dedddca..8182cc8 100644 --- a/server/container/guice/guice-common/src/main/java/org/apache/james/PeriodicalHealthChecks.java +++ b/server/container/guice/guice-common/src/main/java/org/apache/james/PeriodicalHealthChecks.java @@ -91,12 +91,12 @@ public class PeriodicalHealthChecks implements Startable { if (result.getError().isPresent()) { LOGGER.error("UNHEALTHY: {} : {}", result.getComponentName().getName(), -result.getCause(), +result.getCause().orElse(""), result.getError().get()); } else { LOGGER.error("UNHEALTHY: {} : {}", result.getComponentN
[james-project] 03/04: JAMES-3171 Get mailboxes on jmap-draft should return shared mailboxes without the role
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 e409b11c2ac64aaf006495f2ab7cac97f97dcb9a Author: Rene Cordier AuthorDate: Tue May 26 17:42:12 2020 +0700 JAMES-3171 Get mailboxes on jmap-draft should return shared mailboxes without the role --- .../integration/GetMailboxesMethodTest.java| 20 .../james/jmap/draft/model/MailboxFactory.java | 3 ++- .../jmap/draft/methods/GetMailboxesMethodTest.java | 28 ++ 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/GetMailboxesMethodTest.java b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/GetMailboxesMethodTest.java index a3d4320..1ad34be 100644 --- a/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/GetMailboxesMethodTest.java +++ b/server/protocols/jmap-draft-integration-testing/jmap-draft-integration-testing-common/src/test/java/org/apache/james/jmap/draft/methods/integration/GetMailboxesMethodTest.java @@ -682,6 +682,26 @@ public abstract class GetMailboxesMethodTest { } @Test +public void getMailboxesShouldNotExposeRoleOfSharedMailboxToSharee() throws Exception { +MailboxPath bobMailboxPath = MailboxPath.forUser(BOB, DefaultMailboxes.INBOX); +MailboxId mailboxId = mailboxProbe.createMailbox(bobMailboxPath); + +mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, ALICE.asString(), DefaultMailboxes.INBOX); + +aclProbe.replaceRights(bobMailboxPath, ALICE.asString(), new Rfc4314Rights(Right.Lookup)); + +given() +.header("Authorization", accessToken.asString()) +.body("[[\"getMailboxes\", {\"ids\": [\"" + mailboxId.serialize() + "\"]}, \"#0\"]]") +.when() +.post("/jmap") +.then() +.statusCode(200) +.body(FIRST_MAILBOX + ".role", nullValue()) +.body(FIRST_MAILBOX + ".sortOrder", equalTo(1000)); +} + +@Test public void getMailboxesShouldReturnDelegatedNamespaceWhenSharedMailbox() throws Exception { String sharedMailboxName = "BobShared"; MailboxId mailboxId = mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, BOB.asString(), sharedMailboxName); diff --git a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/model/MailboxFactory.java b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/model/MailboxFactory.java index 11c059a..d4597b7 100644 --- a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/model/MailboxFactory.java +++ b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/model/MailboxFactory.java @@ -168,7 +168,8 @@ public class MailboxFactory { QuotaLoader quotaLoader, MailboxSession mailboxSession) throws MailboxException { boolean isOwner = mailboxPath.belongsTo(mailboxSession); -Optional role = Role.from(mailboxPath.getName()); +Optional role = Role.from(mailboxPath.getName()) +.filter(any -> mailboxPath.belongsTo(mailboxSession)); Rights rights = Rights.fromACL(resolvedAcl) .removeEntriesFor(mailboxPath.getUser()); diff --git a/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/methods/GetMailboxesMethodTest.java b/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/methods/GetMailboxesMethodTest.java index f51721b..f47ede8 100644 --- a/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/methods/GetMailboxesMethodTest.java +++ b/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/methods/GetMailboxesMethodTest.java @@ -45,6 +45,7 @@ import org.apache.james.mailbox.Role; import org.apache.james.mailbox.exception.MailboxException; import org.apache.james.mailbox.inmemory.InMemoryId; import org.apache.james.mailbox.inmemory.manager.InMemoryIntegrationResources; +import org.apache.james.mailbox.model.MailboxACL; import org.apache.james.mailbox.model.MailboxPath; import org.apache.james.mailbox.quota.QuotaManager; import org.apache.james.mailbox.quota.QuotaRootResolver; @@ -412,4 +413,31 @@ public class GetMailboxesMethodTest { Tuple.tuple("Restored-Messages", Optional.of(Role.RESTORED_MESSAGES)), Tuple.tuple("WITHOUT ROLE", Optional.empty())); } + +@Test +public void getMailboxesShouldNotExposeRoleOfSharedMailboxToSharee() throws Exception { +MailboxSession userSession
[james-project] branch master updated (b98f4cf -> 0f2742b)
This is an automated email from the ASF dual-hosted git repository. btellier pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git. from b98f4cf JAMES-3191 Specify the scheduler unregistration should be run on new 752cdf2 JAMES-3072 Await task completion in Mailbox Export webAdmin tests new ad16b8c JAMES-3143 Fix unstable Consistency integration test new e409b11 JAMES-3171 Get mailboxes on jmap-draft should return shared mailboxes without the role new 0f2742b JAMES-3117 PeriodicalHealthChecks cleanup and additional tests The 4 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../cassandra/utils/CassandraAsyncExecutor.java| 8 +- .../cassandra/utils/CassandraHealthCheck.java | 3 +- .../backends/es/ElasticSearchHealthCheck.java | 1 - .../org/apache/james/PeriodicalHealthChecks.java | 6 +- .../apache/james/PeriodicalHealthChecksTest.java | 123 +++-- .../integration/GetMailboxesMethodTest.java| 20 .../james/jmap/draft/model/MailboxFactory.java | 3 +- .../jmap/draft/methods/GetMailboxesMethodTest.java | 28 + .../rabbitmq/ConsistencyTasksIntegrationTest.java | 2 +- .../james/webadmin/routes/HealthCheckRoutes.java | 49 .../service/MailboxesExportRequestToTaskTest.java | 4 + 11 files changed, 203 insertions(+), 44 deletions(-) - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[jira] [Closed] (JAMES-3197) MailetProcessor should handle NoClassDefFoundError
[ https://issues.apache.org/jira/browse/JAMES-3197?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Benoit Tellier closed JAMES-3197. - Fix Version/s: 3.6.0 3.5.0 Resolution: Fixed > MailetProcessor should handle NoClassDefFoundError > -- > > Key: JAMES-3197 > URL: https://issues.apache.org/jira/browse/JAMES-3197 > Project: James Server > Issue Type: Improvement > Components: Mailet Contributions >Reporter: Benoit Tellier >Priority: Major > Labels: bug > Fix For: 3.5.0, 3.6.0 > > > Due to JAMES-3176, we ended up having ExtractMDNOriginalJMAPMessageId > throwing NoClassDefFoundError. > This error is not handled by the mailet processor, resulting in a mailqueue > nack, and generated an infinite loop on top of RabbitMQ. > This error can happen too when a user specifies a custom mailet with > unsatisfied dependencies. > Thus, when a mailet, or a matcher throws a `NoClassDefFoundError` we should > execute mailet error handling normally, and prevent that infinite loop. -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[jira] [Commented] (JAMES-3191) Key registration is slow
[ https://issues.apache.org/jira/browse/JAMES-3191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17123521#comment-17123521 ] Benoit Tellier commented on JAMES-3191: --- https://github.com/linagora/james-project/pull/3408 solved the performance issue du to a rabbitmq overuse due to an infinite processing loop. https://github.com/linagora/james-project/pull/3390 contributed reactive registration to the event bus > Key registration is slow > > > Key: JAMES-3191 > URL: https://issues.apache.org/jira/browse/JAMES-3191 > Project: James Server > Issue Type: Improvement > Components: eventbus, IMAPServer >Affects Versions: master >Reporter: Benoit Tellier >Priority: Major > Labels: perf > > We noticed that on *master* SELECT IMAP command is significatively slow > (several minutes) on top of the distributed profile. (See attached > instrumentation average time and percentiles) > A quick performance review links this to listener registration (by key). > A code review leads to: > - The low channel number (3) maybe this count can be safely raised to a > higher number? Like 10? Maybe even configurable? > - EventBus::Register operation is handling IO but is synchronous. The > reactor scheduler backing it up is unspecifed (thus is likely the parrallel > one). We should let the caller specify the scheduler he whishes to run. -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[jira] [Closed] (JAMES-3191) Key registration is slow
[ https://issues.apache.org/jira/browse/JAMES-3191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Benoit Tellier closed JAMES-3191. - Fix Version/s: 3.6.0 Resolution: Fixed > Key registration is slow > > > Key: JAMES-3191 > URL: https://issues.apache.org/jira/browse/JAMES-3191 > Project: James Server > Issue Type: Improvement > Components: eventbus, IMAPServer >Affects Versions: master >Reporter: Benoit Tellier >Priority: Major > Labels: perf > Fix For: 3.6.0 > > > We noticed that on *master* SELECT IMAP command is significatively slow > (several minutes) on top of the distributed profile. (See attached > instrumentation average time and percentiles) > A quick performance review links this to listener registration (by key). > A code review leads to: > - The low channel number (3) maybe this count can be safely raised to a > higher number? Like 10? Maybe even configurable? > - EventBus::Register operation is handling IO but is synchronous. The > reactor scheduler backing it up is unspecifed (thus is likely the parrallel > one). We should let the caller specify the scheduler he whishes to run. -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[jira] [Commented] (JAMES-3197) MailetProcessor should handle NoClassDefFoundError
[ https://issues.apache.org/jira/browse/JAMES-3197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17123519#comment-17123519 ] Benoit Tellier commented on JAMES-3197: --- https://github.com/linagora/james-project/pull/3408 is merged > MailetProcessor should handle NoClassDefFoundError > -- > > Key: JAMES-3197 > URL: https://issues.apache.org/jira/browse/JAMES-3197 > Project: James Server > Issue Type: Improvement > Components: Mailet Contributions >Reporter: Benoit Tellier >Priority: Major > Labels: bug > > Due to JAMES-3176, we ended up having ExtractMDNOriginalJMAPMessageId > throwing NoClassDefFoundError. > This error is not handled by the mailet processor, resulting in a mailqueue > nack, and generated an infinite loop on top of RabbitMQ. > This error can happen too when a user specifies a custom mailet with > unsatisfied dependencies. > Thus, when a mailet, or a matcher throws a `NoClassDefFoundError` we should > execute mailet error handling normally, and prevent that infinite loop. -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[james-project] 01/07: JAMES-3093 Apply JWT authntication strategy before access token one
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 0ace0860a9a4b44c3f992f7f52d65e3e919a5b09 Author: Benoit Tellier AuthorDate: Mon Jun 1 09:14:17 2020 +0700 JAMES-3093 Apply JWT authntication strategy before access token one --- .../src/main/java/org/apache/james/jmap/draft/DraftMethodsModule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/draft/DraftMethodsModule.java b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/draft/DraftMethodsModule.java index 18edfe4..72488fd 100644 --- a/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/draft/DraftMethodsModule.java +++ b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/draft/DraftMethodsModule.java @@ -102,8 +102,8 @@ public class DraftMethodsModule extends AbstractModule { JWTAuthenticationStrategy jwtAuthenticationStrategy, QueryParameterAccessTokenAuthenticationStrategy queryParameterAuthenticationStrategy) { return Authenticator.of(metricFactory, -accessTokenAuthenticationStrategy, jwtAuthenticationStrategy, +accessTokenAuthenticationStrategy, queryParameterAuthenticationStrategy); } } - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[james-project] 06/07: JAMES-3191 Specify scheduler for EventBus key registration
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 b3ea48605e656ee2074fa1b47020f61528b235bf Author: Benoit Tellier AuthorDate: Wed May 20 11:21:50 2020 +0700 JAMES-3191 Specify scheduler for EventBus key registration --- .../org/apache/james/mailbox/events/EventBus.java | 6 +- .../mailbox/MailboxManagerStressContract.java | 12 +-- .../apache/james/mailbox/MailboxManagerTest.java | 26 +++ .../mailbox/events/ErrorHandlingContract.java | 8 +- .../events/EventBusConcurrentTestContract.java | 38 - .../apache/james/mailbox/events/KeyContract.java | 90 +++--- .../apache/james/mailbox/events/InVMEventBus.java | 4 +- .../mailbox/events/KeyRegistrationHandler.java | 27 --- .../james/mailbox/events/RabbitMQEventBus.java | 2 +- .../james/mailbox/events/RabbitMQEventBusTest.java | 14 ++-- .../apache/james/imap/processor/IdleProcessor.java | 7 +- .../imap/processor/base/SelectedMailboxImpl.java | 7 +- .../processor/base/SelectedMailboxImplTest.java| 8 +- 13 files changed, 137 insertions(+), 112 deletions(-) diff --git a/mailbox/api/src/main/java/org/apache/james/mailbox/events/EventBus.java b/mailbox/api/src/main/java/org/apache/james/mailbox/events/EventBus.java index 752740e..c07cfb9 100644 --- a/mailbox/api/src/main/java/org/apache/james/mailbox/events/EventBus.java +++ b/mailbox/api/src/main/java/org/apache/james/mailbox/events/EventBus.java @@ -21,6 +21,8 @@ package org.apache.james.mailbox.events; import java.util.Set; +import org.reactivestreams.Publisher; + import com.google.common.collect.ImmutableSet; import reactor.core.publisher.Mono; @@ -44,11 +46,11 @@ public interface EventBus { } } -default Registration register(MailboxListener listener, RegistrationKey key) { +default Publisher register(MailboxListener listener, RegistrationKey key) { return register(MailboxListener.wrapReactive(listener), key); } -Registration register(MailboxListener.ReactiveMailboxListener listener, RegistrationKey key); +Publisher register(MailboxListener.ReactiveMailboxListener listener, RegistrationKey key); Registration register(MailboxListener.ReactiveMailboxListener listener, Group group) throws GroupAlreadyRegistered; diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerStressContract.java b/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerStressContract.java index c32b854..192140f 100644 --- a/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerStressContract.java +++ b/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerStressContract.java @@ -32,7 +32,6 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import org.apache.james.core.Username; -import org.apache.james.mailbox.events.Event; import org.apache.james.mailbox.events.EventBus; import org.apache.james.mailbox.events.MailboxIdRegistrationKey; import org.apache.james.mailbox.events.MailboxListener; @@ -46,6 +45,8 @@ import org.junit.jupiter.api.Test; import com.google.common.collect.ImmutableSet; +import reactor.core.publisher.Mono; + public interface MailboxManagerStressContract { int APPEND_OPERATIONS = 200; @@ -66,13 +67,12 @@ public interface MailboxManagerStressContract { getManager().startProcessingRequest(session); MailboxPath path = MailboxPath.forUser(username, "INBOX"); MailboxId mailboxId = getManager().createMailbox(path, session).get(); -retrieveEventBus().register(new MailboxListener() { -@Override -public void event(Event event) { +Mono.from(retrieveEventBus() +.register(event -> { MessageUid u = ((MailboxListener.Added) event).getUids().iterator().next(); uList.add(u); -} -}, new MailboxIdRegistrationKey(mailboxId)); +}, new MailboxIdRegistrationKey(mailboxId))) +.block(); getManager().endProcessingRequest(session); getManager().logout(session); diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java b/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java index 15ab35d..c262c91 100644 --- a/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java +++ b/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java @@ -719,7 +719,7 @@ public abstract class MailboxManagerTest { @Test void deleteMailboxShouldFireMailboxDeletionEvent() throws Exception { assumeTrue(mailboxManager.hasCapability(MailboxCapabilities.Quota)); -retrieveEventBus(mailboxManager).register(listener, new MailboxIdRegistrationKey(inboxId)); +M
[james-project] 05/07: JAMES-3197 Document mailet pipeline error handling
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 e9321f2d730c74d556fc1c903faa17419a9db655 Author: Benoit Tellier AuthorDate: Fri May 29 14:14:51 2020 +0700 JAMES-3197 Document mailet pipeline error handling --- src/site/xdoc/server/config-mailetcontainer.xml | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/site/xdoc/server/config-mailetcontainer.xml b/src/site/xdoc/server/config-mailetcontainer.xml index c20f9a2..8660a21 100644 --- a/src/site/xdoc/server/config-mailetcontainer.xml +++ b/src/site/xdoc/server/config-mailetcontainer.xml @@ -48,8 +48,13 @@ Set this to the appropriate email address for error reports If this is set to a non-local email address, the mail server will still function, but will generate a warning on startup. - spooler.threads - Number of simultaneous threads used to spool the mails. + spooler.threads + Number of simultaneous threads used to spool the mails. + spooler.errorRepository + Mail repository to store email in after several unrecoverable errors. Mails failing processing, for which + the Mailet Container could not handle Error, will be stored there after their processing had been attempted + 5 times. Note that if standard java Exception occurs, Error handling section below will be applied + instead. - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[james-project] branch master updated (90933d5 -> b98f4cf)
This is an automated email from the ASF dual-hosted git repository. btellier pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git. from 90933d5 JAMES-3187 Removed obsolete file new 0ace086 JAMES-3093 Apply JWT authntication strategy before access token one new 6016a56 JAMES-3197 Provide a default protocol for MailRepositoryStore new 5d6fc84 JAMES-3197 Prevent infinite loop upon Error of Mail Processing new b73bfba JAMES-3197 Configuration examples for Spooler errorRepository new e9321f2 JAMES-3197 Document mailet pipeline error handling new b3ea486 JAMES-3191 Specify scheduler for EventBus key registration new b98f4cf JAMES-3191 Specify the scheduler unregistration should be run on The 7 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../destination/conf/mailetcontainer.xml | 1 + .../destination/conf/mailetcontainer.xml | 1 + .../destination/conf/mailetcontainer.xml | 1 + .../cassandra/destination/conf/mailetcontainer.xml | 1 + .../jpa-smtp/destination/conf/mailetcontainer.xml | 1 + .../guice/jpa/destination/conf/mailetcontainer.xml | 1 + .../memory/destination/conf/mailetcontainer.xml| 1 + .../spring/destination/conf/mailetcontainer.xml| 1 + .../org/apache/james/mailbox/events/EventBus.java | 6 +- .../mailbox/MailboxManagerStressContract.java | 12 +- .../apache/james/mailbox/MailboxManagerTest.java | 26 ++-- .../mailbox/events/ErrorHandlingContract.java | 8 +- .../events/EventBusConcurrentTestContract.java | 38 ++--- .../apache/james/mailbox/events/KeyContract.java | 90 ++-- .../apache/james/mailbox/events/InVMEventBus.java | 4 +- .../mailbox/events/KeyRegistrationHandler.java | 28 ++-- .../james/mailbox/events/RabbitMQEventBus.java | 2 +- .../james/mailbox/events/RabbitMQEventBusTest.java | 14 +- .../apache/james/imap/processor/IdleProcessor.java | 7 +- .../imap/processor/base/SelectedMailboxImpl.java | 7 +- .../processor/base/SelectedMailboxImplTest.java| 8 +- server/app/src/main/resources/mailetcontainer.xml | 1 + .../src/test/resources/mailetcontainer.xml | 1 + .../src/test/resources/mailetcontainer.xml | 1 + .../src/test/resources/mailetcontainer.xml | 1 + .../src/test/resources/mailetcontainer.xml | 1 + .../src/test/resources/mailetcontainer.xml | 1 + .../sample-configuration/mailetcontainer.xml | 1 + .../src/test/resources/mailetcontainer.xml | 1 + .../james/jmap/draft/DraftMethodsModule.java | 2 +- .../MailRepositoryStoreBeanFactory.java| 5 + .../mailrepository/api/MailRepositoryStore.java| 2 + .../memory/MemoryMailRepositoryStore.java | 5 + .../org/apache/james/mailets/MailetErrorsTest.java | 86 +-- .../transport/mailets/OneRuntimeErrorMailet.java} | 18 +-- ...NoopMailet.java => OneThreadSuicideMailet.java} | 12 +- .../transport/mailets/RuntimeErrorMailet.java | 2 +- ...rrorMailet.java => RuntimeExceptionMailet.java} | 2 +- ...orMatcher.java => RuntimeExceptionMatcher.java} | 2 +- .../mailetcontainer/impl/JamesMailSpooler.java | 80 +- .../mailetcontainer/impl/JamesMailSpoolerTest.java | 163 - .../src/test/resources/mailetcontainer.xml | 1 + .../src/test/resources/mailetcontainer.xml | 1 + .../src/test/resources/mailetcontainer.xml | 1 + .../src/test/resources/mailetcontainer.xml | 1 + .../src/test/resources/mailetcontainer.xml | 1 + .../src/test/resources/mailetcontainer.xml | 1 + .../src/test/resources/mailetcontainer.xml | 1 + src/site/xdoc/server/config-mailetcontainer.xml| 9 +- 49 files changed, 350 insertions(+), 311 deletions(-) copy server/{container/guice/testing/custom-mailets/src/main/java/org/apache/james/transport/mailets/CustomMailet.java => mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/OneRuntimeErrorMailet.java} (84%) copy server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/{NoopMailet.java => OneThreadSuicideMailet.java} (80%) copy server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/{RuntimeErrorMailet.java => RuntimeExceptionMailet.java} (96%) rename server/mailet/integration-testing/src/test/java/org/apache/james/transport/mailets/{RuntimeErrorMatcher.java => RuntimeExceptionMatcher.java} (96%) delete mode 100644 server/mailet/mailetcontainer-camel/src/test/java/org/apache/james/mailetcontainer/impl/JamesMailSpoolerTest.java ---
[james-project] 07/07: JAMES-3191 Specify the scheduler unregistration should be run on
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 b98f4cf57c26550f24d7d67c89f60f02fa2a8c53 Author: Benoit Tellier AuthorDate: Mon May 25 18:09:44 2020 +0700 JAMES-3191 Specify the scheduler unregistration should be run on --- .../java/org/apache/james/mailbox/events/KeyRegistrationHandler.java | 1 + 1 file changed, 1 insertion(+) diff --git a/mailbox/event/event-rabbitmq/src/main/java/org/apache/james/mailbox/events/KeyRegistrationHandler.java b/mailbox/event/event-rabbitmq/src/main/java/org/apache/james/mailbox/events/KeyRegistrationHandler.java index 1d5fdd9..5add858 100644 --- a/mailbox/event/event-rabbitmq/src/main/java/org/apache/james/mailbox/events/KeyRegistrationHandler.java +++ b/mailbox/event/event-rabbitmq/src/main/java/org/apache/james/mailbox/events/KeyRegistrationHandler.java @@ -133,6 +133,7 @@ class KeyRegistrationHandler { if (registration.unregister().lastListenerRemoved()) { registrationBinder.unbind(key) .retryWhen(Retry.backoff(retryBackoff.getMaxRetries(), retryBackoff.getFirstBackoff()).jitter(retryBackoff.getJitterFactor()).scheduler(Schedulers.elastic())) +.subscribeOn(Schedulers.elastic()) .block(); } })); - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org
[james-project] 03/07: JAMES-3197 Prevent infinite loop upon Error of Mail Processing
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 5d6fc84b6ac290e2c4025ec0d8709e7c83f7f118 Author: Benoit Tellier AuthorDate: Fri May 29 14:01:17 2020 +0700 JAMES-3197 Prevent infinite loop upon Error of Mail Processing Leverage a failure count on top of the mailQueue, and use error mail repository. --- .../org/apache/james/mailets/MailetErrorsTest.java | 86 +-- ...ErrorMailet.java => OneRuntimeErrorMailet.java} | 10 +- ...rrorMailet.java => OneThreadSuicideMailet.java} | 12 +- .../transport/mailets/RuntimeErrorMailet.java | 2 +- ...rrorMailet.java => RuntimeExceptionMailet.java} | 2 +- ...orMatcher.java => RuntimeExceptionMatcher.java} | 2 +- .../mailetcontainer/impl/JamesMailSpooler.java | 80 +- .../mailetcontainer/impl/JamesMailSpoolerTest.java | 163 - 8 files changed, 170 insertions(+), 187 deletions(-) diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/MailetErrorsTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/MailetErrorsTest.java index b1cc490..646fe0b 100644 --- a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/MailetErrorsTest.java +++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/MailetErrorsTest.java @@ -38,8 +38,11 @@ import org.apache.james.transport.mailets.ErrorMatcher; import org.apache.james.transport.mailets.NoClassDefFoundErrorMatcher; import org.apache.james.transport.mailets.NoopMailet; import org.apache.james.transport.mailets.Null; +import org.apache.james.transport.mailets.OneRuntimeErrorMailet; +import org.apache.james.transport.mailets.OneThreadSuicideMailet; import org.apache.james.transport.mailets.RuntimeErrorMailet; -import org.apache.james.transport.mailets.RuntimeErrorMatcher; +import org.apache.james.transport.mailets.RuntimeExceptionMailet; +import org.apache.james.transport.mailets.RuntimeExceptionMatcher; import org.apache.james.transport.mailets.ToRepository; import org.apache.james.transport.matchers.All; import org.apache.james.transport.matchers.HasException; @@ -135,6 +138,71 @@ public class MailetErrorsTest { .putProcessor(ProcessorConfiguration.root() .addMailet(MailetConfiguration.builder() .matcher(All.class) +.mailet(RuntimeExceptionMailet.class +.build(temporaryFolder.newFolder()); +MailRepositoryProbeImpl probe = jamesServer.getProbe(MailRepositoryProbeImpl.class); + +smtpMessageSender.connect(LOCALHOST_IP, jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort()).sendMessage(FROM, FROM); + +awaitAtMostOneMinute.until(() -> probe.getRepositoryMailCount(ERROR_REPOSITORY) == 1); +} + +@Test +public void spoolerShouldEventuallyProcessUponTemporaryError() throws Exception { +jamesServer = TemporaryJamesServer.builder() +.withBase(SMTP_ONLY_MODULE) +.withMailetContainer(MailetContainer.builder() +.putProcessor(CommonProcessors.deliverOnlyTransport()) +.putProcessor(errorProcessor()) +.putProcessor(ProcessorConfiguration.root() +.addMailet(MailetConfiguration.builder() +.matcher(All.class) +.mailet(OneRuntimeErrorMailet.class)) +.addMailet(MailetConfiguration.builder() +.matcher(All.class) +.mailet(ToRepository.class) +.addProperty("repositoryPath", CUSTOM_REPOSITORY.asString() +.build(temporaryFolder.newFolder()); +MailRepositoryProbeImpl probe = jamesServer.getProbe(MailRepositoryProbeImpl.class); + +smtpMessageSender.connect(LOCALHOST_IP, jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort()).sendMessage(FROM, FROM); + +awaitAtMostOneMinute.until(() -> probe.getRepositoryMailCount(CUSTOM_REPOSITORY) == 1); +} + +@Test +public void spoolerShouldEventuallyProcessMailsAfterThreadSuicide() throws Exception { +jamesServer = TemporaryJamesServer.builder() +.withBase(SMTP_ONLY_MODULE) +.withMailetContainer(MailetContainer.builder() +.putProcessor(CommonProcessors.deliverOnlyTransport()) +.putProcessor(errorProcessor()) +.putProcessor(ProcessorConfiguration.root() +.addMailet(MailetConfiguration.builder() +.matcher(All.class) +.mailet(OneThreadSuicideMailet.class)) +.addMailet(MailetConfiguration.builder() +.matcher(All.class) +.mailet(ToRepository.class) +
[james-project] 04/07: JAMES-3197 Configuration examples for Spooler errorRepository
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 b73bfba79e5306cfea78b386f2d4cea2d8102f45 Author: Benoit Tellier AuthorDate: Fri May 29 14:09:46 2020 +0700 JAMES-3197 Configuration examples for Spooler errorRepository --- .../run/guice/cassandra-ldap/destination/conf/mailetcontainer.xml| 1 + .../guice/cassandra-rabbitmq-ldap/destination/conf/mailetcontainer.xml | 1 + .../run/guice/cassandra-rabbitmq/destination/conf/mailetcontainer.xml| 1 + dockerfiles/run/guice/cassandra/destination/conf/mailetcontainer.xml | 1 + dockerfiles/run/guice/jpa-smtp/destination/conf/mailetcontainer.xml | 1 + dockerfiles/run/guice/jpa/destination/conf/mailetcontainer.xml | 1 + dockerfiles/run/guice/memory/destination/conf/mailetcontainer.xml| 1 + dockerfiles/run/spring/destination/conf/mailetcontainer.xml | 1 + server/app/src/main/resources/mailetcontainer.xml| 1 + .../guice/cassandra-guice/src/test/resources/mailetcontainer.xml | 1 + .../guice/cassandra-ldap-guice/src/test/resources/mailetcontainer.xml| 1 + .../cassandra-rabbitmq-guice/src/test/resources/mailetcontainer.xml | 1 + .../cassandra-rabbitmq-ldap-guice/src/test/resources/mailetcontainer.xml | 1 + server/container/guice/jpa-guice/src/test/resources/mailetcontainer.xml | 1 + server/container/guice/jpa-smtp/sample-configuration/mailetcontainer.xml | 1 + .../container/guice/memory-guice/src/test/resources/mailetcontainer.xml | 1 + .../src/test/resources/mailetcontainer.xml | 1 + .../src/test/resources/mailetcontainer.xml | 1 + .../src/test/resources/mailetcontainer.xml | 1 + .../src/test/resources/mailetcontainer.xml | 1 + .../src/test/resources/mailetcontainer.xml | 1 + .../src/test/resources/mailetcontainer.xml | 1 + .../src/test/resources/mailetcontainer.xml | 1 + 23 files changed, 23 insertions(+) diff --git a/dockerfiles/run/guice/cassandra-ldap/destination/conf/mailetcontainer.xml b/dockerfiles/run/guice/cassandra-ldap/destination/conf/mailetcontainer.xml index 2972e3d..c022be2 100644 --- a/dockerfiles/run/guice/cassandra-ldap/destination/conf/mailetcontainer.xml +++ b/dockerfiles/run/guice/cassandra-ldap/destination/conf/mailetcontainer.xml @@ -29,6 +29,7 @@ 20 +cassandra://var/mail/error/ diff --git a/dockerfiles/run/guice/cassandra-rabbitmq-ldap/destination/conf/mailetcontainer.xml b/dockerfiles/run/guice/cassandra-rabbitmq-ldap/destination/conf/mailetcontainer.xml index 794f325..28aa44e 100644 --- a/dockerfiles/run/guice/cassandra-rabbitmq-ldap/destination/conf/mailetcontainer.xml +++ b/dockerfiles/run/guice/cassandra-rabbitmq-ldap/destination/conf/mailetcontainer.xml @@ -29,6 +29,7 @@ 20 +cassandra://var/mail/error/ diff --git a/dockerfiles/run/guice/cassandra-rabbitmq/destination/conf/mailetcontainer.xml b/dockerfiles/run/guice/cassandra-rabbitmq/destination/conf/mailetcontainer.xml index 794f325..28aa44e 100644 --- a/dockerfiles/run/guice/cassandra-rabbitmq/destination/conf/mailetcontainer.xml +++ b/dockerfiles/run/guice/cassandra-rabbitmq/destination/conf/mailetcontainer.xml @@ -29,6 +29,7 @@ 20 +cassandra://var/mail/error/ diff --git a/dockerfiles/run/guice/cassandra/destination/conf/mailetcontainer.xml b/dockerfiles/run/guice/cassandra/destination/conf/mailetcontainer.xml index 794f325..28aa44e 100644 --- a/dockerfiles/run/guice/cassandra/destination/conf/mailetcontainer.xml +++ b/dockerfiles/run/guice/cassandra/destination/conf/mailetcontainer.xml @@ -29,6 +29,7 @@ 20 +cassandra://var/mail/error/ diff --git a/dockerfiles/run/guice/jpa-smtp/destination/conf/mailetcontainer.xml b/dockerfiles/run/guice/jpa-smtp/destination/conf/mailetcontainer.xml index e873098..6a90e85 100644 --- a/dockerfiles/run/guice/jpa-smtp/destination/conf/mailetcontainer.xml +++ b/dockerfiles/run/guice/jpa-smtp/destination/conf/mailetcontainer.xml @@ -29,6 +29,7 @@ 20 +file://var/mail/error/ diff --git a/dockerfiles/run/guice/jpa/destination/conf/mailetcontainer.xml b/dockerfiles/run/guice/jpa/destination/conf/mailetcontainer.xml index 6d91a78..062093d 100644 --- a/dockerfiles/run/guice/jpa/destination/conf/mailetcontainer.xml +++ b/dockerfiles/run/guice/jpa/destination/conf/mailetcontainer.xml @@ -29,6 +29,7 @@ 20 +file://var/mail/error/ diff --git a/dockerfiles/run/guice/memory/destination/conf/mailetcontainer.xml b/dockerfiles/run/guice/memory/destination/conf/mailet
[james-project] 02/07: JAMES-3197 Provide a default protocol for MailRepositoryStore
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 6016a56a38aebd2fbc8103517f51f2303afc4594 Author: Benoit Tellier AuthorDate: Fri May 29 13:25:44 2020 +0700 JAMES-3197 Provide a default protocol for MailRepositoryStore --- .../factory/mailrepositorystore/MailRepositoryStoreBeanFactory.java | 5 + .../org/apache/james/mailrepository/api/MailRepositoryStore.java | 2 ++ .../james/mailrepository/memory/MemoryMailRepositoryStore.java | 5 + 3 files changed, 12 insertions(+) diff --git a/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factory/mailrepositorystore/MailRepositoryStoreBeanFactory.java b/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factory/mailrepositorystore/MailRepositoryStoreBeanFactory.java index 91002ba..be08add 100644 --- a/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factory/mailrepositorystore/MailRepositoryStoreBeanFactory.java +++ b/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factory/mailrepositorystore/MailRepositoryStoreBeanFactory.java @@ -75,6 +75,11 @@ public class MailRepositoryStoreBeanFactory extends AbstractBeanFactory implemen this.configuration = configuration; } +@Override +public Optional defaultProtocol() { +return Optional.of(new Protocol("file")); +} + @PostConstruct @SuppressWarnings("unchecked") public void init() throws Exception { diff --git a/server/data/data-api/src/main/java/org/apache/james/mailrepository/api/MailRepositoryStore.java b/server/data/data-api/src/main/java/org/apache/james/mailrepository/api/MailRepositoryStore.java index f220775..fa79c3c 100644 --- a/server/data/data-api/src/main/java/org/apache/james/mailrepository/api/MailRepositoryStore.java +++ b/server/data/data-api/src/main/java/org/apache/james/mailrepository/api/MailRepositoryStore.java @@ -32,6 +32,8 @@ public interface MailRepositoryStore { */ MailRepository select(MailRepositoryUrl url) throws MailRepositoryStoreException; +Optional defaultProtocol(); + /** * Create the {@link MailRepository} for the given url and return it. If the repository already exists, * then no new repository is created, the old one will be returned. diff --git a/server/data/data-memory/src/main/java/org/apache/james/mailrepository/memory/MemoryMailRepositoryStore.java b/server/data/data-memory/src/main/java/org/apache/james/mailrepository/memory/MemoryMailRepositoryStore.java index da5d546..1ef76a2 100644 --- a/server/data/data-memory/src/main/java/org/apache/james/mailrepository/memory/MemoryMailRepositoryStore.java +++ b/server/data/data-memory/src/main/java/org/apache/james/mailrepository/memory/MemoryMailRepositoryStore.java @@ -66,6 +66,11 @@ public class MemoryMailRepositoryStore implements MailRepositoryStore, Startable this.perProtocolMailRepositoryDefaultConfiguration = new HashMap<>(); } +@Override +public Optional defaultProtocol() { +return configuration.getDefaultProtocol(); +} + public void init() throws Exception { LOGGER.info("JamesMailStore init... {}", this); - To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org