[GitHub] [james-project] chibenwa opened a new pull request, #1596: [BACKPORT] JPA enhancements and test stability enhancements
chibenwa opened a new pull request, #1596: URL: https://github.com/apache/james-project/pull/1596 (no comment) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-project] branch master updated: FIX Proxy for SMTPS (#1594)
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 The following commit(s) were added to refs/heads/master by this push: new 41090084a2 FIX Proxy for SMTPS (#1594) 41090084a2 is described below commit 41090084a209e29e69c413dbee8beac84fe8fcf3 Author: Benoit TELLIER AuthorDate: Thu Jun 15 12:06:45 2023 +0700 FIX Proxy for SMTPS (#1594) --- .../james/protocols/netty/AbstractSSLAwareChannelPipelineFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractSSLAwareChannelPipelineFactory.java b/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractSSLAwareChannelPipelineFactory.java index c04acb83f1..7fe9804fdb 100644 --- a/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractSSLAwareChannelPipelineFactory.java +++ b/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractSSLAwareChannelPipelineFactory.java @@ -57,7 +57,7 @@ public abstract class AbstractSSLAwareChannelPipelineFactory
[GitHub] [james-project] chibenwa merged pull request #1594: FIX Proxy for SMTPS
chibenwa merged PR #1594: URL: https://github.com/apache/james-project/pull/1594 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-project] branch master updated (d573881e15 -> 7c4610c50f)
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 d573881e15 JAMES-3438 - remove println in test add 7c4610c50f JAMES-3911 JPA: optimize applicable flags with a native query (#1593) No new revisions were added by this update. Summary of changes: .../org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java | 12 1 file changed, 8 insertions(+), 4 deletions(-) - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[GitHub] [james-project] chibenwa merged pull request #1593: JAMES-3911 JPA: optimize applicable flags with a native query
chibenwa merged PR #1593: URL: https://github.com/apache/james-project/pull/1593 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-project] 03/03: JAMES-3438 - remove println in 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 d573881e152d581dd46b953947dfdd3aad197866 Author: Tung Tran AuthorDate: Mon Jun 12 11:23:04 2023 +0700 JAMES-3438 - remove println in test --- .../org/apache/james/jmap/rfc8621/contract/EmailSetMethodContract.scala | 2 -- 1 file changed, 2 deletions(-) diff --git a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailSetMethodContract.scala b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailSetMethodContract.scala index 3f4c9ae537..03ae3905ff 100644 --- a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailSetMethodContract.scala +++ b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailSetMethodContract.scala @@ -2632,7 +2632,6 @@ trait EmailSetMethodContract { .body .asString -println(response) assertThatJson(response) .inPath("methodResponses[0][1].notCreated.aa") .isEqualTo( @@ -2693,7 +2692,6 @@ trait EmailSetMethodContract { .body .asString -println(response) assertThatJson(response) .inPath("methodResponses[0][1].notCreated.aa") .isEqualTo( - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-project] 01/03: RightManager should support reactive api - listRightReactive
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 4d03e6d0183eae0c970462bb05cfee3ba0a461ad Author: Tung Van TRAN AuthorDate: Fri Jun 9 10:14:09 2023 +0700 RightManager should support reactive api - listRightReactive --- .../org/apache/james/mailbox/RightManager.java | 4 .../james/mailbox/store/StoreMailboxManager.java | 10 + .../james/mailbox/store/StoreRightManager.java | 26 +++--- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/mailbox/api/src/main/java/org/apache/james/mailbox/RightManager.java b/mailbox/api/src/main/java/org/apache/james/mailbox/RightManager.java index 01fa333a44..7476f11301 100644 --- a/mailbox/api/src/main/java/org/apache/james/mailbox/RightManager.java +++ b/mailbox/api/src/main/java/org/apache/james/mailbox/RightManager.java @@ -91,8 +91,12 @@ public interface RightManager { MailboxACL listRights(MailboxPath mailboxPath, MailboxSession session) throws MailboxException; +Publisher listRightsReactive(MailboxPath mailboxPath, MailboxSession session); + MailboxACL listRights(MailboxId mailboxId, MailboxSession session) throws MailboxException; +Publisher listRightsReactive(MailboxId mailboxId, MailboxSession session); + /** * Returns the rights applicable to the user who has sent the current * request on the mailbox designated by this mailboxPath. diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java index e1d272c5f8..67edc9ed46 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java @@ -987,11 +987,21 @@ public class StoreMailboxManager implements MailboxManager { return storeRightManager.listRights(mailboxPath, session); } +@Override +public Publisher listRightsReactive(MailboxPath mailboxPath, MailboxSession session) { +return storeRightManager.listRightsReactive(mailboxPath, session); +} + @Override public MailboxACL listRights(MailboxId mailboxId, MailboxSession session) throws MailboxException { return storeRightManager.listRights(mailboxId, session); } +@Override +public Publisher listRightsReactive(MailboxId mailboxId, MailboxSession session) { +return storeRightManager.listRightsReactive(mailboxId, session); +} + @Override public void applyRightsCommand(MailboxPath mailboxPath, MailboxACL.ACLCommand mailboxACLCommand, MailboxSession session) throws MailboxException { storeRightManager.applyRightsCommand(mailboxPath, mailboxACLCommand, session); diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreRightManager.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreRightManager.java index 5c4b20b07f..b74d2c9dc8 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreRightManager.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreRightManager.java @@ -153,18 +153,28 @@ public class StoreRightManager implements RightManager { @Override public MailboxACL listRights(MailboxPath mailboxPath, MailboxSession session) throws MailboxException { -MailboxMapper mapper = mailboxSessionMapperFactory.getMailboxMapper(session); -Mailbox mailbox = blockOptional(mapper.findMailboxByPath(mailboxPath)) -.orElseThrow(() -> new MailboxNotFoundException(mailboxPath)); -return mailbox.getACL(); +return MailboxReactorUtils.block(listRightsReactive(mailboxPath, session)); +} + +@Override +public Mono listRightsReactive(MailboxPath mailboxPath, MailboxSession session) { +return Mono.fromCallable(() -> mailboxSessionMapperFactory.getMailboxMapper(session)) +.flatMap(mapper -> mapper.findMailboxByPath(mailboxPath)) +.switchIfEmpty(Mono.error(new MailboxNotFoundException(mailboxPath))) +.map(Mailbox::getACL); } @Override public MailboxACL listRights(MailboxId mailboxId, MailboxSession session) throws MailboxException { -MailboxMapper mapper = mailboxSessionMapperFactory.getMailboxMapper(session); -Mailbox mailbox = blockOptional(mapper.findMailboxById(mailboxId)) -.orElseThrow(() -> new MailboxNotFoundException(mailboxId)); -return mailbox.getACL(); + return MailboxReactorUtils.block(listRightsReactive(mailboxId, session)); +} + +@Override +public Mono listRightsReactive(MailboxId mailboxId, MailboxSession session) { +return Mono.fromCallable(() -> mailboxSessionMapperFactory.getMailboxMapper(session)) +
[james-project] 02/03: [REFACTOR] PropagateLookupRightListener implement Reactive group event listener
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 67f389e6195969850e9c6005a01907bdee83b758 Author: Tung Van TRAN AuthorDate: Fri Jun 9 10:15:04 2023 +0700 [REFACTOR] PropagateLookupRightListener implement Reactive group event listener --- .../jmap/event/PropagateLookupRightListener.java | 110 +++-- 1 file changed, 56 insertions(+), 54 deletions(-) diff --git a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/event/PropagateLookupRightListener.java b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/event/PropagateLookupRightListener.java index e91e81481e..0d02571e19 100644 --- a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/event/PropagateLookupRightListener.java +++ b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/event/PropagateLookupRightListener.java @@ -19,6 +19,8 @@ package org.apache.james.jmap.event; +import java.util.List; +import java.util.function.Predicate; import java.util.stream.Stream; import javax.inject.Inject; @@ -28,19 +30,23 @@ import org.apache.james.events.EventListener; import org.apache.james.events.Group; import org.apache.james.mailbox.MailboxManager; import org.apache.james.mailbox.MailboxSession; +import org.apache.james.mailbox.MessageManager; import org.apache.james.mailbox.RightManager; import org.apache.james.mailbox.acl.ACLDiff; import org.apache.james.mailbox.events.MailboxEvents.MailboxACLUpdated; import org.apache.james.mailbox.events.MailboxEvents.MailboxRenamed; -import org.apache.james.mailbox.exception.MailboxException; import org.apache.james.mailbox.model.MailboxACL; import org.apache.james.mailbox.model.MailboxACL.Entry; import org.apache.james.mailbox.model.MailboxACL.Right; import org.apache.james.mailbox.model.MailboxPath; +import org.reactivestreams.Publisher; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class PropagateLookupRightListener implements EventListener.GroupEventListener { +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public class PropagateLookupRightListener implements EventListener.ReactiveGroupEventListener { public static class PropagateLookupRightListenerGroup extends Group { } @@ -63,75 +69,71 @@ public class PropagateLookupRightListener implements EventListener.GroupEventLis } @Override -public void event(Event event) throws MailboxException { -MailboxSession mailboxSession = createMailboxSession(event); +public boolean isHandling(Event event) { +return event instanceof MailboxACLUpdated || event instanceof MailboxRenamed; +} +@Override +public Publisher reactiveEvent(Event event) { if (event instanceof MailboxACLUpdated) { -MailboxACLUpdated aclUpdateEvent = (MailboxACLUpdated) event; -MailboxPath mailboxPath = mailboxManager.getMailbox(aclUpdateEvent.getMailboxId(), mailboxSession).getMailboxPath(); - -updateLookupRightOnParent(mailboxSession, mailboxPath, aclUpdateEvent.getAclDiff()); +return updateLookupRightOnParent((MailboxACLUpdated) event); } else if (event instanceof MailboxRenamed) { -MailboxRenamed renamedEvent = (MailboxRenamed) event; -updateLookupRightOnParent(mailboxSession, renamedEvent.getNewPath()); +return updateLookupRightOnParent((MailboxRenamed) event); } +return Mono.empty(); } -@Override -public boolean isHandling(Event event) { -return event instanceof MailboxACLUpdated || event instanceof MailboxRenamed; +private Mono updateLookupRightOnParent(MailboxACLUpdated aclUpdateEvent) { +MailboxSession mailboxSession = createMailboxSession(aclUpdateEvent); +return Mono.from(mailboxManager.getMailboxReactive(aclUpdateEvent.getMailboxId(), mailboxSession)) +.map(MessageManager::getMailboxPath) +.flatMapIterable(mailboxPath -> mailboxPath.getParents(mailboxSession.getPathDelimiter())) +.flatMap(parentPath -> updateLookupRight(mailboxSession, parentPath, aclUpdateEvent.getAclDiff())) +.then(); } -private MailboxSession createMailboxSession(Event event) { -return mailboxManager.createSystemSession(event.getUsername()); +private Mono updateLookupRightOnParent(MailboxRenamed mailboxRenamed) { +MailboxSession mailboxSession = createMailboxSession(mailboxRenamed); +return Mono.from(rightManager.listRightsReactive(mailboxRenamed.getNewPath(), mailboxSession)) +.flatMapIterable(acl -> acl.getEntries().entrySet()) +.map(mapEntry -> new Entry(mapEntry.getKey(), mapEntry.getValue())) +.filter(updateLookupRightPredicate()) +.collectList() +
[james-project] branch master updated (55afb3235c -> d573881e15)
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 55afb3235c Fix awssdk SdkClientException: Duplicate handler name: HttpStreamsClientHandler in S3BlobStoreDAOTest new 4d03e6d018 RightManager should support reactive api - listRightReactive new 67f389e619 [REFACTOR] PropagateLookupRightListener implement Reactive group event listener new d573881e15 JAMES-3438 - remove println in test The 3 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: .../org/apache/james/mailbox/RightManager.java | 4 + .../james/mailbox/store/StoreMailboxManager.java | 10 ++ .../james/mailbox/store/StoreRightManager.java | 26 +++-- .../jmap/event/PropagateLookupRightListener.java | 110 +++-- .../rfc8621/contract/EmailSetMethodContract.scala | 2 - 5 files changed, 88 insertions(+), 64 deletions(-) - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[GitHub] [james-project] chibenwa merged pull request #1586: [REFACTOR] PropagateLookupRightListener implement Reactive group event listener
chibenwa merged PR #1586: URL: https://github.com/apache/james-project/pull/1586 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[GitHub] [james-project] chibenwa opened a new pull request, #1595: JAMES-3911 JPA: position messages index correctly
chibenwa opened a new pull request, #1595: URL: https://github.com/apache/james-project/pull/1595 (no comment) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-site] branch asf-staging updated: Site checkin for project Apache James: Jenkins Tools
This is an automated email from the ASF dual-hosted git repository. git-site-role pushed a commit to branch asf-staging in repository https://gitbox.apache.org/repos/asf/james-site.git The following commit(s) were added to refs/heads/asf-staging by this push: new dbe5f8b85 Site checkin for project Apache James: Jenkins Tools dbe5f8b85 is described below commit dbe5f8b85bc906da12e48625895e654693727aaf Author: jenkins AuthorDate: Wed Jun 14 10:31:38 2023 + Site checkin for project Apache James: Jenkins Tools --- _/js/site.js | 2 +- sitemap-james-distributed-app.xml | 136 +- sitemap-james-project.xml | 286 +++--- sitemap-james-site.xml| 4 +- 4 files changed, 214 insertions(+), 214 deletions(-) diff --git a/_/js/site.js b/_/js/site.js index c3e14757e..74a8b5fd0 100644 --- a/_/js/site.js +++ b/_/js/site.js @@ -1,6 +1,6 @@ !function(){"use strict";var e,o,r,s=/^sect(\d)$/,i=document.querySelector(".nav-container"),a=document.querySelector(".nav-toggle"),c=i.querySelector(".nav"),l=(a.addEventListener("click",function(e){if(a.classList.contains("is-active"))return u(e);v(e);var e=document.documentElement,t=(e.classList.add("is-clipped--nav"),a.classList.add("is-active"),i.classList.add("is-active"),c.getBoundingClientRect()),n=window.innerHeight-Math.round(t.top);Math.round(t.height)!==n&&(c.style.height=n+ [...] !function(){"use strict";var e=document.querySelector("aside.toc.sidebar");if(e){if(document.querySelector("body.-toc"))return e.parentNode.removeChild(e);var t=parseInt(e.dataset.levels||2,10);if(!(t<0)){for(var o="article.doc",d=document.querySelector(o),n=[],i=0;i<=t;i++){var r=[o];if(i){for(var c=1;c<=i;c++)r.push((2===c?".sectionbody>":"")+".sect"+c);r.push("h"+(i+1)+"[id]")}else r.push("h1[id].sect0");n.push(r.join(">"))}m=n.join(","),f=d.parentNode;var a,s=[].slice.call((f||docume [...] -!function(){"use strict";var o=document.querySelector("article.doc"),n=document.querySelector(".toolbar"),i="scrollTo"in document.documentElement;function c(e){return e&&(~e.indexOf("%")?decodeURIComponent(e):e).slice(1)}function r(e){if(e){if(e.altKey||e.ctrlKey)return;window.location.hash="#"+this.id,e.preventDefault()}var t=function e(t,n){return o.contains(t)?e(t.offsetParent,t.offsetTop+n):n}(this,0)-n.getBoundingClientRect().bottom;!1===e&?window.scrollTo({left:0,top:t,behavior:" [...] +!function(){"use strict";var o=document.querySelector("article.doc"),t=document.querySelector(".toolbar");function i(e){return e&&(~e.indexOf("%")?decodeURIComponent(e):e).slice(1)}function r(e){if(e){if(e.altKey||e.ctrlKey)return;window.location.hash="#"+this.id,e.preventDefault()}window.scrollTo(0,function e(t,n){return o.contains(t)?e(t.offsetParent,t.offsetTop+n):n}(this,0)-t.getBoundingClientRect().bottom)}window.addEventListener("load",function e(t){var n;(n=i(window.location.hash) [...] !function(){"use strict";var t,e=document.querySelector(".page-versions .version-menu-toggle");e&&(t=document.querySelector(".page-versions"),e.addEventListener("click",function(e){t.classList.toggle("is-active"),e.stopPropagation()}),document.documentElement.addEventListener("click",function(){t.classList.remove("is-active")}))}(); !function(){"use strict";var t=document.querySelector(".navbar-burger");t&("click",function(t){t.stopPropagation(),document.documentElement.classList.toggle("is-clipped--navbar"),this.classList.toggle("is-active");t=document.getElementById(this.dataset.target);{var e;t.classList.toggle("is-active")&&(t.style.maxHeight="",e=window.innerHeight-Math.round(t.getBoundingClientRect().top),parseInt(window.getComputedStyle(t).maxHeight,10)!==e)&&(t.style.maxHeight=e+"px")}}.bi [...] !function(){"use strict";var o=/^\$ (\S[^\\\n]*(\\\n(?!\$ )[^\\\n]*)*)(?=\n|$)/gm,s=/( ) *\\\n *|\\\n( ?) */g,l=/ +$/gm,e=(document.getElementById("site-script")||{dataset:{}}).dataset,d=null==e.uiRootPath?".":e.uiRootPath,r=e.svgAs,p=window.navigator.clipboard;[].slice.call(document.querySelectorAll(".doc pre.highlight, .doc .literalblock pre")).forEach(function(e){var t,n,a,c;if(e.classList.contains("highlight"))(i=(t=e.querySelector("code")).dataset.lang)&&"console"!==i&&((a=document. [...] \ No newline at end of file diff --git a/sitemap-james-distributed-app.xml b/sitemap-james-distributed-app.xml index 6b4227b33..6accdb170 100644 --- a/sitemap-james-distributed-app.xml +++ b/sitemap-james-distributed-app.xml @@ -2,274 +2,274 @@ http://www.sitemaps.org/schemas/sitemap/0.9;> https://james.apache.org/james-distributed-app/3.8.0/architecture/consistency-model.html -2023-06-09T13:06:34.551Z +2023-06-14T10:29:50.516Z https://james.apache.org/james-distributed-app/3.8.0/architecture/implemented-standards.html -2023-06-09T13:06:34.551Z +2023-06-14T10:29:50.516Z https://james.apache.org/james-distributed-app/3.8.0/architecture/index.html -2023-06-09T13:06:34.551Z
[GitHub] [james-project] chibenwa opened a new pull request, #1594: FIX Proxy for SMTPS
chibenwa opened a new pull request, #1594: URL: https://github.com/apache/james-project/pull/1594 CF https://github.com/apache/james-project/tree/master/examples/proxy-smtp on port 465 ## Before ``` james | 03:01:57.543 [WARN ] i.n.c.ChannelInitializer - Failed to initialize a channel. Closing: [id: 0xab45804e, L:/172.18.0.2:465 - R:/172.18.0.3:35036] james | java.util.NoSuchElementException: proxyInformationHandler james |at io.netty.channel.DefaultChannelPipeline.getContextOrDie(DefaultChannelPipeline.java:1073) james |at io.netty.channel.DefaultChannelPipeline.addAfter(DefaultChannelPipeline.java:302) james |at io.netty.channel.DefaultChannelPipeline.addAfter(DefaultChannelPipeline.java:290) james |at org.apache.james.protocols.netty.AbstractSSLAwareChannelPipelineFactory.initChannel(AbstractSSLAwareChannelPipelineFactory.java:58) james |at org.apache.james.protocols.netty.AbstractSSLAwareChannelPipelineFactory.initChannel(AbstractSSLAwareChannelPipelineFactory.java:30) james |at io.netty.channel.ChannelInitializer.initChannel(ChannelInitializer.java:129) james |at io.netty.channel.ChannelInitializer.handlerAdded(ChannelInitializer.java:112) james |at io.netty.channel.AbstractChannelHandlerContext.callHandlerAdded(AbstractChannelHandlerContext.java:1114) james |at io.netty.channel.DefaultChannelPipeline.callHandlerAdded0(DefaultChannelPipeline.java:609) james |at io.netty.channel.DefaultChannelPipeline.access$100(DefaultChannelPipeline.java:46) james |at io.netty.channel.DefaultChannelPipeline$PendingHandlerAddedTask.execute(DefaultChannelPipeline.java:1463) james |at io.netty.channel.DefaultChannelPipeline.callHandlerAddedForAllHandlers(DefaultChannelPipeline.java:1115) james |at io.netty.channel.DefaultChannelPipeline.invokeHandlerAddedIfNeeded(DefaultChannelPipeline.java:650) james |at io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:514) james |at io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:429) james |at io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:486) james |at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174) james |at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167) james |at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470) james |at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569) james |at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) james |at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) james |at java.base/java.lang.Thread.run(Unknown Source) ``` ## After Works Note: I did not succeed wiritng a non regression test: writing both the PROXY message then initializing SSL connection was overwhelming in Java... -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-project] 02/04: [CLEAN CODE] Replace dinkel/openldap -> osixia/openldap in test (no maintained long time)
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 207d9cb7f48aeb4e6ad26307396822ef81e7d1e7 Author: Tung Tran AuthorDate: Wed Jun 7 16:06:56 2023 +0700 [CLEAN CODE] Replace dinkel/openldap -> osixia/openldap in test (no maintained long time) --- .../src/test/resources/ldif-files/Dockerfile | 3 -- .../james/user/ldap/LdapGenericContainer.java | 48 +- .../user/ldap/ReadOnlyUsersLDAPRepositoryTest.java | 4 +- .../test/resources/invalid/ldif-files/Dockerfile | 3 -- .../src/test/resources/ldif-files/Dockerfile | 3 -- .../apache/james/util/docker/DockerContainer.java | 18 +++- .../java/org/apache/james/util/docker/Images.java | 1 + 7 files changed, 48 insertions(+), 32 deletions(-) diff --git a/server/apps/cassandra-app/src/test/resources/ldif-files/Dockerfile b/server/apps/cassandra-app/src/test/resources/ldif-files/Dockerfile deleted file mode 100644 index d889a35fb7..00 --- a/server/apps/cassandra-app/src/test/resources/ldif-files/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM dinkel/openldap:latest - -COPY populate.ldif /etc/ldap/prepopulate/prepop.ldif diff --git a/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/LdapGenericContainer.java b/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/LdapGenericContainer.java index 2182311b12..335e2d65a6 100644 --- a/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/LdapGenericContainer.java +++ b/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/LdapGenericContainer.java @@ -18,16 +18,21 @@ / package org.apache.james.user.ldap; -import com.google.common.base.Preconditions; -import com.google.common.base.Strings; +import java.time.Duration; +import java.util.Optional; +import java.util.UUID; + +import org.apache.http.client.utils.URIBuilder; import org.apache.james.util.docker.DockerContainer; -import org.apache.james.util.docker.RateLimiters; +import org.apache.james.util.docker.Images; import org.junit.rules.ExternalResource; -import org.testcontainers.containers.wait.strategy.HostPortWaitStrategy; -import org.testcontainers.images.builder.ImageFromDockerfile; +import org.testcontainers.containers.BindMode; +import org.testcontainers.containers.startupcheck.MinimumDurationRunningStartupCheckStrategy; +import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy; -import java.util.Optional; -import java.util.UUID; +import com.github.fge.lambdas.Throwing; +import com.google.common.base.Preconditions; +import com.google.common.base.Strings; public class LdapGenericContainer extends ExternalResource { @@ -67,17 +72,19 @@ public class LdapGenericContainer extends ExternalResource { } private DockerContainer createContainer() { -return DockerContainer.fromDockerfile( -new ImageFromDockerfile("openldap_" + UUID.randomUUID()) -.withFileFromClasspath("populate.ldif", dockerFilePrefix.orElse("") + "ldif-files/populate.ldif") -.withFileFromClasspath("Dockerfile", dockerFilePrefix.orElse("") + "ldif-files/Dockerfile")) +return DockerContainer.fromName(Images.OPEN_LDAP) +.withClasspathResourceMapping(dockerFilePrefix.orElse("") + "ldif-files/populate.ldif", + "/container/service/slapd/assets/config/bootstrap/ldif/data.ldif", BindMode.READ_ONLY) .withAffinityToContainer() -.withEnv("SLAPD_DOMAIN", domain) -.withEnv("SLAPD_PASSWORD", password) -.withEnv("SLAPD_CONFIG_PASSWORD", password) -.withExposedPorts(LdapGenericContainer.DEFAULT_LDAP_PORT) +.withEnv("LDAP_DOMAIN", domain) +.withEnv("LDAP_ADMIN_PASSWORD", password) +.withEnv("LDAP_CONFIG_PASSWORD", password) +.withExposedPorts(DEFAULT_LDAP_PORT) +.withCommands("--copy-service", "--loglevel", "debug") .withName("james-testing-openldap-" + UUID.randomUUID()) -.waitingFor(new HostPortWaitStrategy().withRateLimiter(RateLimiters.TWENTIES_PER_SECOND)); +.waitingFor(new LogMessageWaitStrategy().withRegEx(".*slapd starting\\n").withTimes(1) +.withStartupTimeout(Duration.ofMinutes(3))) +.withStartupCheckStrategy(new MinimumDurationRunningStartupCheckStrategy(Duration.ofSeconds(10))); } } @@ -116,10 +123,11 @@ public class LdapGenericContainer extends ExternalResource { } public String getLdapHost() { -return "ldap://; + -container.getContainerIp() + -":" + -LdapGenericContainer.DEFAULT_LDAP_PORT; +return
[james-project] 03/04: [CLEAN CODE] Remove unused SpamAssassinWaitStrategy class
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 ce3faf0f32380a207f9f289fe869a850673f26dc Author: Tung Tran AuthorDate: Wed Jun 7 16:09:27 2023 +0700 [CLEAN CODE] Remove unused SpamAssassinWaitStrategy class --- .../spamassassin/SpamAssassinWaitStrategy.java | 67 -- 1 file changed, 67 deletions(-) diff --git a/third-party/spamassassin/src/test/java/org/apache/james/spamassassin/SpamAssassinWaitStrategy.java b/third-party/spamassassin/src/test/java/org/apache/james/spamassassin/SpamAssassinWaitStrategy.java deleted file mode 100644 index 8947a2cbfd..00 --- a/third-party/spamassassin/src/test/java/org/apache/james/spamassassin/SpamAssassinWaitStrategy.java +++ /dev/null @@ -1,67 +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.spamassassin; - -import java.io.IOException; -import java.time.Duration; -import java.util.concurrent.TimeUnit; - -import org.rnorth.ducttape.unreliables.Unreliables; -import org.testcontainers.containers.GenericContainer; -import org.testcontainers.containers.wait.strategy.WaitStrategy; -import org.testcontainers.containers.wait.strategy.WaitStrategyTarget; - -import com.google.common.primitives.Ints; - -public class SpamAssassinWaitStrategy implements WaitStrategy { - -private static final Duration DEFAULT_TIMEOUT = Duration.ofMinutes(1); -private final GenericContainer spamAssassinContainer; -private final Duration timeout; - -public SpamAssassinWaitStrategy(GenericContainer spamAssassinContainer) { -this(spamAssassinContainer, DEFAULT_TIMEOUT); -} - -public SpamAssassinWaitStrategy(GenericContainer spamAssassinContainer, Duration timeout) { -this.spamAssassinContainer = spamAssassinContainer; -this.timeout = timeout; -} - -@Override -public void waitUntilReady(WaitStrategyTarget waitStrategyTarget) { -Unreliables.retryUntilTrue(Ints.checkedCast(timeout.getSeconds()), TimeUnit.SECONDS, () -> { -try { -return spamAssassinContainer -.execInContainer("spamassassin", "-V") -.getStdout() -.contains("SpamAssassin version 3.4.2"); -} catch (IOException | InterruptedException e) { -return false; -} -} -); -} - -@Override -public WaitStrategy withStartupTimeout(Duration startupTimeout) { -return new SpamAssassinWaitStrategy(spamAssassinContainer, startupTimeout); -} -} - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-project] 04/04: Fix awssdk SdkClientException: Duplicate handler name: HttpStreamsClientHandler in S3BlobStoreDAOTest
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 55afb3235c3de5d8f06c9b0f752e131eef4efe8b Author: Tung Tran AuthorDate: Thu Jun 8 16:26:40 2023 +0700 Fix awssdk SdkClientException: Duplicate handler name: HttpStreamsClientHandler in S3BlobStoreDAOTest --- .../org/apache/james/blob/objectstorage/aws/S3BlobStoreDAOTest.java| 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/blob/blob-s3/src/test/java/org/apache/james/blob/objectstorage/aws/S3BlobStoreDAOTest.java b/server/blob/blob-s3/src/test/java/org/apache/james/blob/objectstorage/aws/S3BlobStoreDAOTest.java index 5f19f46694..43b7cf7818 100644 --- a/server/blob/blob-s3/src/test/java/org/apache/james/blob/objectstorage/aws/S3BlobStoreDAOTest.java +++ b/server/blob/blob-s3/src/test/java/org/apache/james/blob/objectstorage/aws/S3BlobStoreDAOTest.java @@ -82,7 +82,8 @@ public class S3BlobStoreDAOTest implements BlobStoreDAOContract { final int count = 1500; Flux.range(0, count) -.flatMap(i -> store.save(TEST_BUCKET_NAME, new TestBlobId("test-blob-id-" + i), ByteSource.wrap(ELEVEN_KILOBYTES))) +.concatMap(i -> store.save(TEST_BUCKET_NAME, new TestBlobId("test-blob-id-" + i), +ByteSource.wrap(ELEVEN_KILOBYTES))) .blockLast(); assertThat(Flux.from(testee().listBlobs(TEST_BUCKET_NAME)).count().block()) - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-project] 01/04: [CLEAN CODE] data-ldap test - avoid start twice ldap container
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 c0f54afd004d0d39cfe2386732a136428fc416f4 Author: Tung Tran AuthorDate: Wed Jun 7 10:17:46 2023 +0700 [CLEAN CODE] data-ldap test - avoid start twice ldap container --- .../java/org/apache/james/user/ldap/DockerLdapSingleton.java | 3 --- .../java/org/apache/james/user/ldap/LdapHealthCheckTest.java | 10 ++ .../user/ldap/ReadOnlyUsersLDAPRepositoryEmptyListTest.java| 5 + .../james/user/ldap/ReadOnlyUsersLDAPRepositoryTest.java | 10 +++--- 4 files changed, 6 insertions(+), 22 deletions(-) diff --git a/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/DockerLdapSingleton.java b/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/DockerLdapSingleton.java index 9de0fa7107..262101484d 100644 --- a/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/DockerLdapSingleton.java +++ b/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/DockerLdapSingleton.java @@ -34,7 +34,4 @@ public class DockerLdapSingleton { .password(ADMIN_PASSWORD) .build(); -static { -ldapContainer.start(); -} } diff --git a/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/LdapHealthCheckTest.java b/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/LdapHealthCheckTest.java index 61c2d8f3c0..f0204c3c5a 100644 --- a/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/LdapHealthCheckTest.java +++ b/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/LdapHealthCheckTest.java @@ -18,8 +18,6 @@ / package org.apache.james.user.ldap; -import static org.apache.james.user.ldap.DockerLdapSingleton.ADMIN_PASSWORD; -import static org.apache.james.user.ldap.DockerLdapSingleton.DOMAIN; import static org.assertj.core.api.Assertions.assertThat; import org.apache.james.core.healthcheck.Result; @@ -30,13 +28,9 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; class LdapHealthCheckTest { -static LdapGenericContainer ldapContainer = LdapGenericContainer.builder() -.domain(DOMAIN) -.password(ADMIN_PASSWORD) -.build(); - -LdapHealthCheck ldapHealthCheck; +static LdapGenericContainer ldapContainer = DockerLdapSingleton.ldapContainer; +private LdapHealthCheck ldapHealthCheck; @BeforeAll static void setUpAll() { ldapContainer.start(); diff --git a/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/ReadOnlyUsersLDAPRepositoryEmptyListTest.java b/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/ReadOnlyUsersLDAPRepositoryEmptyListTest.java index 0f9e17c35a..90cb77aed6 100644 --- a/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/ReadOnlyUsersLDAPRepositoryEmptyListTest.java +++ b/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/ReadOnlyUsersLDAPRepositoryEmptyListTest.java @@ -39,10 +39,7 @@ import org.junit.jupiter.api.Test; import com.google.common.collect.ImmutableList; class ReadOnlyUsersLDAPRepositoryEmptyListTest { -static LdapGenericContainer ldapContainer = LdapGenericContainer.builder() -.domain(DOMAIN) -.password(ADMIN_PASSWORD) -.build(); +static LdapGenericContainer ldapContainer = DockerLdapSingleton.ldapContainer; DomainList domainList; private ReadOnlyUsersLDAPRepository ldapRepository; diff --git a/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/ReadOnlyUsersLDAPRepositoryTest.java b/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/ReadOnlyUsersLDAPRepositoryTest.java index 01d791f665..7253854708 100644 --- a/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/ReadOnlyUsersLDAPRepositoryTest.java +++ b/server/data/data-ldap/src/test/java/org/apache/james/user/ldap/ReadOnlyUsersLDAPRepositoryTest.java @@ -26,7 +26,6 @@ import static org.apache.james.user.ldap.DockerLdapSingleton.DOMAIN; import static org.apache.james.user.ldap.DockerLdapSingleton.JAMES_USER; import static org.apache.james.user.ldap.DockerLdapSingleton.PASSWORD; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatThrownBy; import java.util.Optional; @@ -63,10 +62,7 @@ class ReadOnlyUsersLDAPRepositoryTest { static final String BAD_PASSWORD = "badpassword"; public static final String SUPPORTS_VIRTUAL_HOSTING = "supportsVirtualHosting"; -static LdapGenericContainer ldapContainer = LdapGenericContainer.builder() -.domain(DOMAIN) -.password(ADMIN_PASSWORD) -.build(); +static LdapGenericContainer ldapContainer =
[james-project] branch master updated (5834996ba2 -> 55afb3235c)
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 5834996ba2 [DOCUMENTATION] Fix some broken links in README.adoc (#1591) new c0f54afd00 [CLEAN CODE] data-ldap test - avoid start twice ldap container new 207d9cb7f4 [CLEAN CODE] Replace dinkel/openldap -> osixia/openldap in test (no maintained long time) new ce3faf0f32 [CLEAN CODE] Remove unused SpamAssassinWaitStrategy class new 55afb3235c Fix awssdk SdkClientException: Duplicate handler name: HttpStreamsClientHandler in S3BlobStoreDAOTest 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: .../src/test/resources/ldif-files/Dockerfile | 3 - .../blob/objectstorage/aws/S3BlobStoreDAOTest.java | 3 +- .../james/user/ldap/DockerLdapSingleton.java | 3 - .../james/user/ldap/LdapGenericContainer.java | 48 +--- .../james/user/ldap/LdapHealthCheckTest.java | 10 +--- .../ReadOnlyUsersLDAPRepositoryEmptyListTest.java | 5 +- .../user/ldap/ReadOnlyUsersLDAPRepositoryTest.java | 14 ++--- .../test/resources/invalid/ldif-files/Dockerfile | 3 - .../src/test/resources/ldif-files/Dockerfile | 3 - .../apache/james/util/docker/DockerContainer.java | 18 +- .../java/org/apache/james/util/docker/Images.java | 1 + .../spamassassin/SpamAssassinWaitStrategy.java | 67 -- 12 files changed, 56 insertions(+), 122 deletions(-) delete mode 100644 server/apps/cassandra-app/src/test/resources/ldif-files/Dockerfile delete mode 100644 server/data/data-ldap/src/test/resources/invalid/ldif-files/Dockerfile delete mode 100644 server/data/data-ldap/src/test/resources/ldif-files/Dockerfile delete mode 100644 third-party/spamassassin/src/test/java/org/apache/james/spamassassin/SpamAssassinWaitStrategy.java - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[GitHub] [james-project] chibenwa merged pull request #1584: [CLEAN CODE] openldap in testcontainer
chibenwa merged PR #1584: URL: https://github.com/apache/james-project/pull/1584 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-project] 12/28: JAMES-3906 Add hot reloading/updating of the certificate: new interface with reloadSSLCertificate() method; new abstract class AbstractServerRoutes with implementation for all a
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit 666e32e275a1c7d80800eb9f48a5c2c0ed2df659 Author: Wojciech Kapcia AuthorDate: Thu May 11 17:35:22 2023 -0400 JAMES-3906 Add hot reloading/updating of the certificate: new interface with reloadSSLCertificate() method; new abstract class AbstractServerRoutes with implementation for all available/known servers; fix issue with `ManageSieveServerFactory` not being singleton causing issues --- .../james/modules/protocols/IMAPServerModule.java | 4 +++ .../james/modules/protocols/LMTPServerModule.java | 4 +++ .../modules/protocols/ManageSieveServerModule.java | 4 +++ .../james/modules/protocols/POP3ServerModule.java | 4 +++ .../james/modules/protocols/SMTPServerModule.java | 4 +++ .../james/imapserver/webadmin/ImapRoutes.java | 22 server/protocols/protocols-library/pom.xml | 4 +++ .../lib/netty/AbstractConfigurableAsyncServer.java | 9 - .../protocols/lib/netty/AbstractServerFactory.java | 2 ++ .../protocols/lib/netty/CertificateReloadable.java | 6 .../lib/webadmin/AbstractServerRoutes.java | 42 ++ .../james/lmtpserver/webadmin/LMTPRoutes.java | 21 +++ .../webadmin/ManageSieveRoutes.java| 21 +++ .../james/pop3server/webadmin/POP3Routes.java | 21 +++ .../james/smtpserver/webadmin/SmtpRoutes.java | 21 +++ 15 files changed, 188 insertions(+), 1 deletion(-) diff --git a/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java b/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java index 082240b01e..0d84991d97 100644 --- a/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java +++ b/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java @@ -57,6 +57,7 @@ import org.apache.james.imap.processor.SelectProcessor; import org.apache.james.imap.processor.base.AbstractProcessor; import org.apache.james.imap.processor.base.UnknownRequestProcessor; import org.apache.james.imapserver.netty.IMAPServerFactory; +import org.apache.james.imapserver.webadmin.ImapRoutes; import org.apache.james.lifecycle.api.ConfigurationSanitizer; import org.apache.james.metrics.api.GaugeRegistry; import org.apache.james.metrics.api.MetricFactory; @@ -67,6 +68,7 @@ import org.apache.james.utils.GuiceProbe; import org.apache.james.utils.InitializationOperation; import org.apache.james.utils.InitilizationOperationBuilder; import org.apache.james.utils.KeystoreCreator; +import org.apache.james.webadmin.Routes; import com.github.fge.lambdas.Throwing; import com.google.common.collect.ImmutableList; @@ -99,6 +101,8 @@ public class IMAPServerModule extends AbstractModule { bind(MailboxTyper.class).to(DefaultMailboxTyper.class).in(Scopes.SINGLETON); Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(ImapGuiceProbe.class); + +Multibinder.newSetBinder(binder(), Routes.class).addBinding().to(ImapRoutes.class); } @Provides diff --git a/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java b/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java index 60ed8c28fd..168d2f7027 100644 --- a/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java +++ b/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java @@ -24,12 +24,14 @@ import org.apache.james.RunArguments; import org.apache.james.filesystem.api.FileSystem; import org.apache.james.lifecycle.api.ConfigurationSanitizer; import org.apache.james.lmtpserver.netty.LMTPServerFactory; +import org.apache.james.lmtpserver.webadmin.LMTPRoutes; import org.apache.james.server.core.configuration.ConfigurationProvider; import org.apache.james.util.LoggingLevel; import org.apache.james.utils.GuiceProbe; import org.apache.james.utils.InitializationOperation; import org.apache.james.utils.InitilizationOperationBuilder; import org.apache.james.utils.KeystoreCreator; +import org.apache.james.webadmin.Routes; import com.google.inject.AbstractModule; import com.google.inject.Scopes; @@ -42,6 +44,8 @@ public class LMTPServerModule extends AbstractModule { bind(LMTPServerFactory.class).in(Scopes.SINGLETON); Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(LmtpGuiceProbe.class); + +Multibinder.newSetBinder(binder(), Routes.class).addBinding().to(LMTPRoutes.class); } @ProvidesIntoSet diff --git
[james-project] 23/28: JAMES-3914 Sieve Redirect: support several recipients
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit e4fe48829088789b6cfe852d2e533b2778302ef7 Author: Benoit Tellier AuthorDate: Mon Jun 12 16:00:24 2023 +0700 JAMES-3914 Sieve Redirect: support several recipients --- .../mailets/delivery/SieveIntegrationTest.java | 20 1 file changed, 20 insertions(+) diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java index 2b7bd165ae..8ea6611774 100644 --- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java +++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java @@ -463,6 +463,26 @@ class SieveIntegrationTest { .containsExactly(expectedSentMail); } +@Test +void redirectShouldWorkWhenSeveralRecipients() throws Exception { + prepareTestUsingScript("org/apache/james/transport/mailets/delivery/redirect.script"); +when(usersRepository.getUsername(new MailAddress("ot...@domain.tld"))).thenReturn(Username.of("ot...@domain.tld")); +when(resourceLocator.get(new MailAddress("ot...@domain.tld"))).thenThrow(new ScriptNotFoundException()); + +FakeMail mail = createMail(); +mail.setRecipients(ImmutableList.of(new MailAddress(RECEIVER_DOMAIN_COM), new MailAddress("ot...@domain.tld"))); +testee.service(mail); + +assertThat(mail.getRecipients()).containsOnly(new MailAddress("ot...@domain.tld")); +FakeMailContext.SentMail expectedSentMail = FakeMailContext.sentMailBuilder() +.sender("sen...@any.com") +.recipient(new MailAddress("redir...@apache.org")) +.fromMailet() +.build(); +assertThat(fakeMailContext.getSentMails()) +.containsExactly(expectedSentMail); +} + @Test void addressCcAllShouldNotMatchOtherHeaders() throws Exception { prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllCc.script"); - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-project] 21/28: JAMES-3914 Sieve FileIntoAction: support several recipients
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit 1f67caf387d209da90509974547b140e3940055a Author: Benoit Tellier AuthorDate: Mon Jun 12 15:02:49 2023 +0700 JAMES-3914 Sieve FileIntoAction: support several recipients --- .../transport/mailets/jsieve/FileIntoAction.java | 25 +- .../mailets/delivery/SieveIntegrationTest.java | 13 +++ 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/FileIntoAction.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/FileIntoAction.java index a42c4e6f66..fe9a770840 100644 --- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/FileIntoAction.java +++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/FileIntoAction.java @@ -20,7 +20,6 @@ package org.apache.james.transport.mailets.jsieve; import javax.mail.MessagingException; -import org.apache.james.core.MailAddress; import org.apache.jsieve.mail.Action; import org.apache.jsieve.mail.ActionFileInto; import org.apache.mailet.Mail; @@ -64,26 +63,22 @@ public class FileIntoAction implements MailAction { * When IMAP support is added to James, it will be possible to support * sub-folders of INBOX fully. * - * - * @param anAction - * @param aMail + * * @param context not null - * @throws MessagingException */ public void execute(ActionFileInto anAction, Mail aMail, final ActionContext context) throws MessagingException { -String destinationMailbox = anAction.getDestination(); -MailAddress recipient; -recipient = ActionUtils.getSoleRecipient(aMail); - -if (!(destinationMailbox.length() > 0 -&& destinationMailbox.charAt(0) == HIERARCHY_DELIMITER)) { -destinationMailbox = HIERARCHY_DELIMITER + destinationMailbox; -} - +String destinationMailbox = getDestinationMailbox(anAction); String mailbox = destinationMailbox.replace(HIERARCHY_DELIMITER, '/'); -String url = "mailbox://" + recipient.asString() + mailbox; +String url = "mailbox://" + context.getRecipient().asString() + mailbox; context.post(url, aMail); LOGGER.debug("Filed Message ID: {} into destination: \"{}\"", aMail.getMessage().getMessageID(), destinationMailbox); } + +private String getDestinationMailbox(ActionFileInto anAction) { +if (!(anAction.getDestination().length() > 0 && anAction.getDestination().charAt(0) == HIERARCHY_DELIMITER)) { +return HIERARCHY_DELIMITER + anAction.getDestination(); +} +return anAction.getDestination(); +} } diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java index c2eeffbb95..029ccaf8b9 100644 --- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java +++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java @@ -156,6 +156,19 @@ class SieveIntegrationTest { assertThat(mail.getAttribute(ATTRIBUTE_NAME)).contains(ATTRIBUTE_INBOX_ANY); } +@Test +void shouldSupportSeveralRecipientsWhenFileInto() throws Exception { + prepareTestUsingScript("org/apache/james/transport/mailets/delivery/fileinto.script"); +when(usersRepository.getUsername(new MailAddress("ot...@domain.tld"))).thenReturn(Username.of("ot...@domain.tld")); +when(resourceLocator.get(new MailAddress("ot...@domain.tld"))).thenThrow(new ScriptNotFoundException()); + +FakeMail mail = createMail(); +mail.setRecipients(ImmutableList.of(new MailAddress(RECEIVER_DOMAIN_COM), new MailAddress("ot...@domain.tld"))); +testee.service(mail); + + assertThatAttribute(mail.getAttribute(ATTRIBUTE_NAME)).isEqualTo(ATTRIBUTE_INBOX_ANY); +} + @Test void allOfAllFalseScriptShouldWork() throws Exception { prepareTestUsingScript("org/apache/james/transport/mailets/delivery/allofAllFalse.script"); - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-project] 07/28: JAMES-3911 JPA: Propose a dedicated query for UID listing (#1583)
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit 5766ed851042450a333fe9b266b7d4acbb91e467 Author: Benoit TELLIER AuthorDate: Fri Jun 9 13:52:07 2023 +0700 JAMES-3911 JPA: Propose a dedicated query for UID listing (#1583) Avoids loading all mail metadata --- .../apache/james/mailbox/jpa/mail/JPAMessageMapper.java | 17 +++-- .../mail/model/openjpa/AbstractJPAMailboxMessage.java | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java index 39fba12976..c9a05f7cc9 100644 --- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java +++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java @@ -59,6 +59,8 @@ import com.github.fge.lambdas.Throwing; import com.google.common.collect.ImmutableList; import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.core.scheduler.Schedulers; /** * JPA implementation of a {@link MessageMapper}. This class is not thread-safe! @@ -89,8 +91,17 @@ public class JPAMessageMapper extends JPATransactionalMapper implements MessageM @Override public Flux listAllMessageUids(Mailbox mailbox) { -return findInMailboxReactive(mailbox, MessageRange.all(), FetchType.METADATA, UNLIMITED) -.map(MailboxMessage::getUid); +return Mono.fromCallable(() -> { +try { +JPAId mailboxId = (JPAId) mailbox.getMailboxId(); +Query query = getEntityManager().createNamedQuery("listUidsInMailbox") +.setParameter("idParam", mailboxId.getRawId()); +return query.getResultStream().map(result -> MessageUid.of((Long) result)); +} catch (PersistenceException e) { +throw new MailboxException("Search of recent messages failed in mailbox " + mailbox, e); +} +}).flatMapMany(Flux::fromStream) +.subscribeOn(Schedulers.boundedElastic()); } @Override @@ -208,6 +219,8 @@ public class JPAMessageMapper extends JPATransactionalMapper implements MessageM } } + + @Override public List retrieveMessagesMarkedForDeletion(Mailbox mailbox, MessageRange messageRange) throws MailboxException { try { diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/AbstractJPAMailboxMessage.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/AbstractJPAMailboxMessage.java index 2b9887f18b..6de70c6d8c 100644 --- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/AbstractJPAMailboxMessage.java +++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/model/openjpa/AbstractJPAMailboxMessage.java @@ -80,6 +80,7 @@ import com.google.common.collect.ImmutableList; @IdClass(AbstractJPAMailboxMessage.MailboxIdUidKey.class) @NamedQueries({ @NamedQuery(name = "findRecentMessageUidsInMailbox", query = "SELECT message.uid FROM MailboxMessage message WHERE message.mailbox.mailboxId = :idParam AND message.recent = TRUE ORDER BY message.uid ASC"), +@NamedQuery(name = "listUidsInMailbox", query = "SELECT message.uid FROM MailboxMessage message WHERE message.mailbox.mailboxId = :idParam ORDER BY message.uid ASC"), @NamedQuery(name = "findUnseenMessagesInMailboxOrderByUid", query = "SELECT message FROM MailboxMessage message WHERE message.mailbox.mailboxId = :idParam AND message.seen = FALSE ORDER BY message.uid ASC"), @NamedQuery(name = "findMessagesInMailbox", query = "SELECT message FROM MailboxMessage message WHERE message.mailbox.mailboxId = :idParam ORDER BY message.uid ASC"), @NamedQuery(name = "findMessagesInMailboxBetweenUIDs", query = "SELECT message FROM MailboxMessage message WHERE message.mailbox.mailboxId = :idParam AND message.uid BETWEEN :fromParam AND :toParam ORDER BY message.uid ASC"), - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-project] branch 3.8.x updated (b967e3640f -> 1a045fabd8)
This is an automated email from the ASF dual-hosted git repository. btellier pushed a change to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git from b967e3640f [maven-release-plugin] prepare release james-project-3.8.0 new 7c1dd88896 [RELEASE] Switch to 3.8.1-SNAPSHOT new 6855334242 [PERF] Avoid using Non-Preemptive authentication for OpenSearch (#1564) new e0e6f24bd0 [FIX] Correctly close JPA EntityManager in a couple of places (#1574) new 3aee16ab18 [FIX] Update JPA version in demo container (#1576) new bb9cebc6c5 [FIX] JPA: avoid leaks in entity manager new d53c432022 [FIX] JPA: add DBCP2 to reuse connections new 5766ed8510 JAMES-3911 JPA: Propose a dedicated query for UID listing (#1583) new 859cd50d7f [PERF] JPA: reuse EntityManager where possible (#1582) new 534a784818 Allow passing openjpa and underlying datasource (DBCP2) properties (#1580) new fab19c3df5 [FIX] JPA blocking calls should be moved to bounded elastic new 2533185267 JAMES-3911 JPA: Prevent concurrent operations on the same EntityManager new 666e32e275 JAMES-3906 Add hot reloading/updating of the certificate: new interface with reloadSSLCertificate() method; new abstract class AbstractServerRoutes with implementation for all available/known servers; fix issue with `ManageSieveServerFactory` not being singleton causing issues new 162dc0 JAMES-3906 fix issue with `ManageSieveServerFactory` not being singleton causing issues new 49fc45c593 JAMES-3906 fix issue with `ManageSieveServerFactory` not being singleton causing issues new e0178ad314 JAMES-3906 Add a missing license new 4d360f65a0 JAMES-3906 Respect orthogonal architecture + centralise certificate renewal management new a8d36a520f JAMES-3906 Allow SSL reload of a specific server via the port number new 341f2570af JAMES-3906 Tests (and fix) for certificate reload new 50aff7b189 JAMES-3906 Documentation new c283255d68 JAMES-3906 Use an interface dedicated for certificate reload in bindings new 1f67caf387 JAMES-3914 Sieve FileIntoAction: support several recipients new 437cae047e JAMES-3914 Sieve Vacation: support several recipients new e4fe488290 JAMES-3914 Sieve Redirect: support several recipients new 8f8af3a1e9 JAMES-3913 Sieve Reject should discard email new d5bad56ca5 JAMES-3914 Sieve Reject: support several recipients new e8d9fc6760 JAMES-3914 ActionUtils: drop no longer used method new 804f369dd6 [RELEASE] Bump to 3.8.1-SNAPSHOT in examples new 1a045fabd8 JAMES-3914 Fix SieveIntegrationTest The 28 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: backends-common/cassandra/pom.xml | 2 +- backends-common/jpa/pom.xml| 7 +- backends-common/opensearch/pom.xml | 2 +- .../james/backends/opensearch/ClientProvider.java | 1 - backends-common/pom.xml| 2 +- backends-common/pulsar/pom.xml | 2 +- backends-common/rabbitmq/pom.xml | 2 +- code-coverage-report/pom.xml | 2 +- core/pom.xml | 2 +- event-bus/api/pom.xml | 2 +- event-bus/cassandra/pom.xml| 2 +- event-bus/distributed/pom.xml | 2 +- event-bus/in-vm/pom.xml| 2 +- event-bus/pom.xml | 2 +- event-sourcing/event-sourcing-core/pom.xml | 2 +- event-sourcing/event-sourcing-pojo/pom.xml | 2 +- event-sourcing/event-store-api/pom.xml | 2 +- event-sourcing/event-store-cassandra/pom.xml | 2 +- event-sourcing/event-store-memory/pom.xml | 2 +- event-sourcing/pom.xml | 2 +- examples/custom-healthcheck/pom.xml| 4 +- examples/custom-imap/pom.xml | 4 +- examples/custom-james-assembly/pom.xml | 4 +- examples/custom-listeners/pom.xml | 2 +- .../listeners/SetCustomFlagOnBigMessages.java | 1 + examples/custom-mailets/pom.xml| 2 +- examples/custom-smtp-command/pom.xml | 4 +- examples/custom-smtp-hooks/pom.xml | 4 +- examples/custom-webadmin-route/pom.xml | 4 +- examples/metrics-graphite/pom.xml | 4 +- examples/pom.xml | 2 +- javax-mail-extension/pom.xml | 2 +- json/pom.xml | 2 +- mailbox/api/pom.xml| 2 +-
[james-project] 26/28: JAMES-3914 ActionUtils: drop no longer used method
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit e8d9fc67604cb5399e013fd763d2d37d95432f16 Author: Benoit Tellier AuthorDate: Mon Jun 12 16:26:41 2023 +0700 JAMES-3914 ActionUtils: drop no longer used method --- .../james/transport/mailets/jsieve/ActionUtils.java | 15 --- 1 file changed, 15 deletions(-) diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/ActionUtils.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/ActionUtils.java index 94884c1261..692ef0e9e1 100644 --- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/ActionUtils.java +++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/ActionUtils.java @@ -40,21 +40,6 @@ public class ActionUtils { private static final String ATTRIBUTE_PREFIX = ActionUtils.class.getPackage().getName() + "."; -/** - * Answers the sole intended recipient for aMail. - */ -public static MailAddress getSoleRecipient(Mail aMail) throws MessagingException { -if (aMail.getRecipients() == null) { -throw new MessagingException("Invalid number of recipients - 0" -+ ". Exactly 1 recipient is expected."); -} else if (1 != aMail.getRecipients().size()) { -throw new MessagingException("Invalid number of recipients - " -+ aMail.getRecipients().size() -+ ". Exactly 1 recipient is expected."); -} -return aMail.getRecipients().iterator().next(); -} - /** * Detect and handle locally looping mail. External loop detection is left * to the MTA. - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-project] 15/28: JAMES-3906 Add a missing license
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit e0178ad314eb774edaeb601b1daf56f8108fe682 Author: Benoit Tellier AuthorDate: Thu May 25 11:10:20 2023 +0700 JAMES-3906 Add a missing license --- .../apache/james/imapserver/webadmin/ImapRoutes.java | 18 ++ .../protocols/lib/netty/CertificateReloadable.java| 18 ++ .../james/pop3server/netty/POP3ServerFactory.java | 19 +++ 3 files changed, 55 insertions(+) diff --git a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/webadmin/ImapRoutes.java b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/webadmin/ImapRoutes.java index 843106583c..77cb9375f8 100644 --- a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/webadmin/ImapRoutes.java +++ b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/webadmin/ImapRoutes.java @@ -1,3 +1,21 @@ +/ + * 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.imapserver.webadmin; import javax.inject.Inject; diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/CertificateReloadable.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/CertificateReloadable.java index 7ac6f2a44b..248de22857 100644 --- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/CertificateReloadable.java +++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/CertificateReloadable.java @@ -1,3 +1,21 @@ +/ + * 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.protocols.lib.netty; public interface CertificateReloadable { diff --git a/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/netty/POP3ServerFactory.java b/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/netty/POP3ServerFactory.java index d146360152..fcce3b306e 100644 --- a/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/netty/POP3ServerFactory.java +++ b/server/protocols/protocols-pop3/src/main/java/org/apache/james/pop3server/netty/POP3ServerFactory.java @@ -1,3 +1,22 @@ +/ + * 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
[james-project] 14/28: JAMES-3906 fix issue with `ManageSieveServerFactory` not being singleton causing issues
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit 49fc45c5934bf797b53556ff41b5a8c7729f5747 Author: Wojciech Kapcia AuthorDate: Thu May 11 19:15:24 2023 -0400 JAMES-3906 fix issue with `ManageSieveServerFactory` not being singleton causing issues --- .../org/apache/james/protocols/lib/netty/AbstractServerFactory.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractServerFactory.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractServerFactory.java index 1a9d3d202f..bf672d5efa 100644 --- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractServerFactory.java +++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractServerFactory.java @@ -23,7 +23,6 @@ import java.util.List; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; -import javax.inject.Singleton; import org.apache.commons.configuration2.HierarchicalConfiguration; import org.apache.commons.configuration2.tree.ImmutableNode; @@ -32,7 +31,6 @@ import org.apache.james.lifecycle.api.Configurable; /** * Abstract base class for Factories that need to create {@link AbstractConfigurableAsyncServer}'s via configuration files */ -@Singleton public abstract class AbstractServerFactory implements Configurable { private List servers; - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-project] 22/28: JAMES-3914 Sieve Vacation: support several recipients
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit 437cae047ea820b6230cc55f85d7dd98b8bc3cf5 Author: Benoit Tellier AuthorDate: Mon Jun 12 15:08:31 2023 +0700 JAMES-3914 Sieve Vacation: support several recipients --- .../transport/mailets/jsieve/ActionUtils.java | 5 ++--- .../transport/mailets/jsieve/RedirectAction.java | 2 +- .../transport/mailets/jsieve/RejectAction.java | 2 +- .../transport/mailets/jsieve/VacationReply.java| 2 +- .../mailets/delivery/SieveIntegrationTest.java | 22 ++ 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/ActionUtils.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/ActionUtils.java index c013e92906..94884c1261 100644 --- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/ActionUtils.java +++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/ActionUtils.java @@ -59,9 +59,8 @@ public class ActionUtils { * Detect and handle locally looping mail. External loop detection is left * to the MTA. */ -public static void detectAndHandleLocalLooping(Mail aMail, String anAttributeSuffix) -throws MessagingException { -MailAddress thisRecipient = getSoleRecipient(aMail); +public static void detectAndHandleLocalLooping(Mail aMail, ActionContext context, String anAttributeSuffix) { +MailAddress thisRecipient = context.getRecipient(); AttributeName attributeName = AttributeName.of(ATTRIBUTE_PREFIX + anAttributeSuffix); AttributeUtils .getValueAndCastFromMail(aMail, attributeName, String.class) diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RedirectAction.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RedirectAction.java index 83773d236f..ec9c6d4de1 100644 --- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RedirectAction.java +++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RedirectAction.java @@ -56,7 +56,7 @@ public class RedirectAction implements MailAction { * @throws MessagingException */ public void execute(ActionRedirect anAction, Mail aMail, ActionContext context) throws MessagingException { -ActionUtils.detectAndHandleLocalLooping(aMail, "redirect"); +ActionUtils.detectAndHandleLocalLooping(aMail, context, "redirect"); MailImpl redirectedMail = MailImpl.builder() .name("redirect-" + aMail.getName()) diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java index a35ebc6270..b9a81a57f2 100644 --- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java +++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java @@ -81,7 +81,7 @@ public class RejectAction implements MailAction { * @throws MessagingException */ public void execute(ActionReject anAction, Mail aMail, ActionContext context) throws MessagingException { -ActionUtils.detectAndHandleLocalLooping(aMail, "reject"); +ActionUtils.detectAndHandleLocalLooping(aMail, context, "reject"); // Create the MDN part StringBuilder humanText = new StringBuilder(128); diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/VacationReply.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/VacationReply.java index 5caf2f40bd..8845fdc1cf 100644 --- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/VacationReply.java +++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/VacationReply.java @@ -81,7 +81,7 @@ public class VacationReply { public VacationReply build() throws MessagingException { Preconditions.checkState(eitherReasonOrMime()); -ActionUtils.detectAndHandleLocalLooping(originalMail, "vacation"); +ActionUtils.detectAndHandleLocalLooping(originalMail, context, "vacation"); MimeMessage reply = (MimeMessage) originalMail.getMessage().reply(false); reply.setSubject(generateNotificationSubject()); diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java index 029ccaf8b9..2b7bd165ae 100644 ---
[james-project] 27/28: [RELEASE] Bump to 3.8.1-SNAPSHOT in examples
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit 804f369dd6a270c4e78f13cf00399bf0030d3d25 Author: Benoit Tellier AuthorDate: Wed Jun 14 09:28:13 2023 +0700 [RELEASE] Bump to 3.8.1-SNAPSHOT in examples --- examples/custom-healthcheck/pom.xml| 4 ++-- examples/custom-imap/pom.xml | 4 ++-- examples/custom-james-assembly/pom.xml | 4 ++-- examples/custom-listeners/pom.xml | 2 +- examples/custom-mailets/pom.xml| 2 +- examples/custom-smtp-command/pom.xml | 4 ++-- examples/custom-smtp-hooks/pom.xml | 4 ++-- examples/custom-webadmin-route/pom.xml | 4 ++-- examples/metrics-graphite/pom.xml | 4 ++-- examples/pom.xml | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/examples/custom-healthcheck/pom.xml b/examples/custom-healthcheck/pom.xml index 5d2e4254d3..659dc0efcc 100644 --- a/examples/custom-healthcheck/pom.xml +++ b/examples/custom-healthcheck/pom.xml @@ -21,7 +21,7 @@ examples org.apache.james.examples -3.8.0 +3.8.1-SNAPSHOT 4.0.0 @@ -57,4 +57,4 @@ - \ No newline at end of file + diff --git a/examples/custom-imap/pom.xml b/examples/custom-imap/pom.xml index bde530a3a6..613d674284 100644 --- a/examples/custom-imap/pom.xml +++ b/examples/custom-imap/pom.xml @@ -23,7 +23,7 @@ org.apache.james.examples examples -3.8.0 +3.8.1-SNAPSHOT custom-imap @@ -110,4 +110,4 @@ - \ No newline at end of file + diff --git a/examples/custom-james-assembly/pom.xml b/examples/custom-james-assembly/pom.xml index ec6a4f0588..f6dc8ad703 100644 --- a/examples/custom-james-assembly/pom.xml +++ b/examples/custom-james-assembly/pom.xml @@ -22,7 +22,7 @@ org.apache.james.examples examples -3.8.0 +3.8.1-SNAPSHOT custom-james-assembly @@ -95,4 +95,4 @@ - \ No newline at end of file + diff --git a/examples/custom-listeners/pom.xml b/examples/custom-listeners/pom.xml index bdc842460a..80281efde6 100644 --- a/examples/custom-listeners/pom.xml +++ b/examples/custom-listeners/pom.xml @@ -22,7 +22,7 @@ org.apache.james.examples examples -3.8.0 +3.8.1-SNAPSHOT custom-listeners Apache James :: Examples :: Custom Listeners diff --git a/examples/custom-mailets/pom.xml b/examples/custom-mailets/pom.xml index 58419fe268..075f91fce4 100644 --- a/examples/custom-mailets/pom.xml +++ b/examples/custom-mailets/pom.xml @@ -22,7 +22,7 @@ org.apache.james.examples examples -3.8.0 +3.8.1-SNAPSHOT custom-mailets Apache James :: Examples :: Custom Mailets diff --git a/examples/custom-smtp-command/pom.xml b/examples/custom-smtp-command/pom.xml index 3ad0630c3f..5e86d31bab 100644 --- a/examples/custom-smtp-command/pom.xml +++ b/examples/custom-smtp-command/pom.xml @@ -22,7 +22,7 @@ org.apache.james.examples examples -3.8.0 +3.8.1-SNAPSHOT custom-smtp-command @@ -51,4 +51,4 @@ - \ No newline at end of file + diff --git a/examples/custom-smtp-hooks/pom.xml b/examples/custom-smtp-hooks/pom.xml index 267f6dbb6c..a01a5b1cd2 100644 --- a/examples/custom-smtp-hooks/pom.xml +++ b/examples/custom-smtp-hooks/pom.xml @@ -22,7 +22,7 @@ org.apache.james.examples examples -3.8.0 +3.8.1-SNAPSHOT custom-smtp-hooks @@ -51,4 +51,4 @@ - \ No newline at end of file + diff --git a/examples/custom-webadmin-route/pom.xml b/examples/custom-webadmin-route/pom.xml index 243be775dc..0119c3c113 100644 --- a/examples/custom-webadmin-route/pom.xml +++ b/examples/custom-webadmin-route/pom.xml @@ -22,7 +22,7 @@ org.apache.james.examples examples -3.8.0 +3.8.1-SNAPSHOT custom-webadmin-route @@ -51,4 +51,4 @@ - \ No newline at end of file + diff --git a/examples/metrics-graphite/pom.xml b/examples/metrics-graphite/pom.xml index 0662c2987e..d02ed4edd8 100644 --- a/examples/metrics-graphite/pom.xml +++ b/examples/metrics-graphite/pom.xml @@ -22,7 +22,7 @@ org.apache.james.examples examples -3.8.0 +3.8.1-SNAPSHOT metrics-graphite @@ -88,4 +88,4 @@ - \ No newline at end of file + diff --git a/examples/pom.xml b/examples/pom.xml index 3ca894602e..d8fdd8690a 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -28,7 +28,7 @@ org.apache.james.examples examples - 3.8.0 + 3.8.1-SNAPSHOT pom Apache James :: Examples - To unsubscribe, e-mail:
[james-project] 20/28: JAMES-3906 Use an interface dedicated for certificate reload in bindings
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit c283255d68b3e4c14a47a71eeeb33f822d86ff62 Author: Benoit Tellier AuthorDate: Tue May 30 08:51:00 2023 +0700 JAMES-3906 Use an interface dedicated for certificate reload in bindings --- .../java/org/apache/james/CertificateReloadTest.java | 2 +- .../james/modules/protocols/IMAPServerModule.java | 4 ++-- .../james/modules/protocols/LMTPServerModule.java | 4 ++-- .../modules/protocols/ManageSieveServerModule.java| 4 ++-- .../james/modules/protocols/POP3ServerModule.java | 4 ++-- .../james/modules/protocols/SMTPServerModule.java | 4 ++-- .../james/modules/protocols/SmtpGuiceProbe.java | 5 + .../protocols/lib/netty/AbstractServerFactory.java| 10 -- .../protocols/lib/netty/CertificateReloadable.java| 7 +++ .../protocols/webadmin/ProtocolServerRoutes.java | 19 +-- 10 files changed, 36 insertions(+), 27 deletions(-) diff --git a/server/apps/memory-app/src/test/java/org/apache/james/CertificateReloadTest.java b/server/apps/memory-app/src/test/java/org/apache/james/CertificateReloadTest.java index 8de9a48892..7b084f45d7 100644 --- a/server/apps/memory-app/src/test/java/org/apache/james/CertificateReloadTest.java +++ b/server/apps/memory-app/src/test/java/org/apache/james/CertificateReloadTest.java @@ -203,7 +203,7 @@ class CertificateReloadTest { .then() .statusCode(204); -System.out.println(readBytes(channel)); +readBytes(channel); channel.getOutputStream().write("EHLO toto.com\r\n".getBytes(StandardCharsets.UTF_8)); assertThat(readBytes(channel)) .contains("250 8BITMIME"); diff --git a/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java b/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java index 603fdc7a15..fa478b0b6a 100644 --- a/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java +++ b/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java @@ -60,7 +60,7 @@ import org.apache.james.imapserver.netty.IMAPServerFactory; import org.apache.james.lifecycle.api.ConfigurationSanitizer; import org.apache.james.metrics.api.GaugeRegistry; import org.apache.james.metrics.api.MetricFactory; -import org.apache.james.protocols.lib.netty.AbstractServerFactory; +import org.apache.james.protocols.lib.netty.CertificateReloadable; import org.apache.james.server.core.configuration.ConfigurationProvider; import org.apache.james.utils.ClassName; import org.apache.james.utils.GuiceGenericLoader; @@ -101,7 +101,7 @@ public class IMAPServerModule extends AbstractModule { Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(ImapGuiceProbe.class); -Multibinder.newSetBinder(binder(), AbstractServerFactory.class).addBinding().to(IMAPServerFactory.class); +Multibinder.newSetBinder(binder(), CertificateReloadable.Factory.class).addBinding().to(IMAPServerFactory.class); } @Provides diff --git a/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java b/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java index 9e198cf843..e16e9cf945 100644 --- a/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java +++ b/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java @@ -24,7 +24,7 @@ import org.apache.james.RunArguments; import org.apache.james.filesystem.api.FileSystem; import org.apache.james.lifecycle.api.ConfigurationSanitizer; import org.apache.james.lmtpserver.netty.LMTPServerFactory; -import org.apache.james.protocols.lib.netty.AbstractServerFactory; +import org.apache.james.protocols.lib.netty.CertificateReloadable; import org.apache.james.server.core.configuration.ConfigurationProvider; import org.apache.james.util.LoggingLevel; import org.apache.james.utils.GuiceProbe; @@ -44,7 +44,7 @@ public class LMTPServerModule extends AbstractModule { Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(LmtpGuiceProbe.class); -Multibinder.newSetBinder(binder(), AbstractServerFactory.class).addBinding().to(LMTPServerFactory.class); +Multibinder.newSetBinder(binder(), CertificateReloadable.Factory.class).addBinding().to(LMTPServerFactory.class); } @ProvidesIntoSet diff --git a/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java
[james-project] 24/28: JAMES-3913 Sieve Reject should discard email
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit 8f8af3a1e93ff9d2f86d77079c71a400912b10ca Author: Benoit Tellier AuthorDate: Mon Jun 12 16:23:42 2023 +0700 JAMES-3913 Sieve Reject should discard email --- .../james/transport/mailets/jsieve/RejectAction.java | 2 +- .../mailets/delivery/SieveIntegrationTest.java| 16 .../james/transport/mailets/delivery/reject.script| 19 +++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java index b9a81a57f2..9d0bdb7e59 100644 --- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java +++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java @@ -62,8 +62,8 @@ public class RejectAction implements MailAction { if (action instanceof ActionReject) { final ActionReject actionReject = (ActionReject) action; execute(actionReject, mail, context); +DiscardAction.removeRecipient(mail, context); } - } /** diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java index 8ea6611774..47ede08af8 100644 --- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java +++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java @@ -463,6 +463,22 @@ class SieveIntegrationTest { .containsExactly(expectedSentMail); } +@Test +void rejectShouldWork() throws Exception { + prepareTestUsingScript("org/apache/james/transport/mailets/delivery/reject.script"); + +FakeMail mail = createMail(); +testee.service(mail); + +FakeMailContext.SentMail expectedSentMail = FakeMailContext.sentMailBuilder() +.recipient("sen...@any.com") +.fromMailet() +.build(); +assertThat(fakeMailContext.getSentMails()) +.containsExactly(expectedSentMail); +assertThat(mail.getRecipients()).isEmpty(); +} + @Test void redirectShouldWorkWhenSeveralRecipients() throws Exception { prepareTestUsingScript("org/apache/james/transport/mailets/delivery/redirect.script"); diff --git a/server/mailet/mailets/src/test/resources/org/apache/james/transport/mailets/delivery/reject.script b/server/mailet/mailets/src/test/resources/org/apache/james/transport/mailets/delivery/reject.script new file mode 100644 index 00..11e53e3eb1 --- /dev/null +++ b/server/mailet/mailets/src/test/resources/org/apache/james/transport/mailets/delivery/reject.script @@ -0,0 +1,19 @@ + +# 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. # + +reject "Spam not consumed here!"; \ No newline at end of file - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-project] 10/28: [FIX] JPA blocking calls should be moved to bounded elastic
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit fab19c3df55bef1ab2044b9ff175ce58340b0ce9 Author: Benoit Tellier AuthorDate: Fri Jun 2 14:27:19 2023 +0700 [FIX] JPA blocking calls should be moved to bounded elastic --- mailbox/jpa/pom.xml| 11 ++ .../james/mailbox/jpa/mail/JPAMailboxMapper.java | 20 +++--- .../james/mailbox/jpa/mail/JPAMessageMapper.java | 6 +++ .../james/mailbox/store/StoreMailboxManager.java | 2 +- .../james/mailbox/store/mail/AnnotationMapper.java | 27 + .../james/mailbox/store/mail/MessageMapper.java| 46 +- .../james/mailbox/store/mail/ModSeqProvider.java | 7 +++- .../james/mailbox/store/mail/UidProvider.java | 7 +++- .../mailbox/store/user/SubscriptionMapper.java | 12 -- mpt/impl/imap-mailbox/jpa/pom.xml | 3 ++ server/apps/jpa-app/pom.xml| 3 ++ .../jpa-app/sample-configuration/jvm.properties| 3 +- server/apps/jpa-smtp-app/pom.xml | 13 ++ .../sample-configuration/jvm.properties| 3 +- server/apps/spring-app/pom.xml | 3 +- 15 files changed, 124 insertions(+), 42 deletions(-) diff --git a/mailbox/jpa/pom.xml b/mailbox/jpa/pom.xml index 67b76c21f6..aae6618699 100644 --- a/mailbox/jpa/pom.xml +++ b/mailbox/jpa/pom.xml @@ -133,6 +133,17 @@ + +org.apache.maven.plugins +maven-surefire-plugin + +false +1 +-Djava.library.path= + -javaagent:"${settings.localRepository}"/org/jacoco/org.jacoco.agent/${jacoco-maven-plugin.version}/org.jacoco.agent-${jacoco-maven-plugin.version}-runtime.jar=destfile=${basedir}/target/jacoco.exec +-Xms512m -Xmx1024m -Dopenjpa.Multithreaded=true + + org.apache.openjpa openjpa-maven-plugin diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMailboxMapper.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMailboxMapper.java index f9c9f449a3..f691f5c1c3 100644 --- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMailboxMapper.java +++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMailboxMapper.java @@ -19,6 +19,8 @@ package org.apache.james.mailbox.jpa.mail; +import java.util.NoSuchElementException; + import javax.persistence.EntityExistsException; import javax.persistence.EntityManagerFactory; import javax.persistence.NoResultException; @@ -48,6 +50,7 @@ import com.google.common.base.Preconditions; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import reactor.core.scheduler.Schedulers; /** * Data access management for mailbox. @@ -92,7 +95,7 @@ public class JPAMailboxMapper extends JPATransactionalMapper implements MailboxM getEntityManager().persist(persistedMailbox); return new Mailbox(mailboxPath, uidValidity, persistedMailbox.getMailboxId()); -})) +}).subscribeOn(Schedulers.boundedElastic())) .onErrorMap(PersistenceException.class, e -> new MailboxException("Save of mailbox " + mailboxPath.getName() + " failed", e)); } @@ -107,7 +110,7 @@ public class JPAMailboxMapper extends JPATransactionalMapper implements MailboxM getEntityManager().persist(persistedMailbox); return (MailboxId) persistedMailbox.getMailboxId(); -})) +}).subscribeOn(Schedulers.boundedElastic())) .onErrorMap(PersistenceException.class, e -> new MailboxException("Save of mailbox " + mailbox.getName() + " failed", e)); } @@ -133,12 +136,15 @@ public class JPAMailboxMapper extends JPATransactionalMapper implements MailboxM .getSingleResult() .toMailbox()) .onErrorResume(NoResultException.class, e -> Mono.empty()) -.onErrorResume(PersistenceException.class, e -> Mono.error(new MailboxException("Exception upon JPA execution", e))); +.onErrorResume(NoSuchElementException.class, e -> Mono.empty()) +.onErrorResume(PersistenceException.class, e -> Mono.error(new MailboxException("Exception upon JPA execution", e))) +.subscribeOn(Schedulers.boundedElastic()); } @Override public Mono findMailboxById(MailboxId id) { return Mono.fromCallable(() -> loadJpaMailbox(id).toMailbox()) +.subscribeOn(Schedulers.boundedElastic()) .onErrorMap(PersistenceException.class, e -> new MailboxException("Search of mailbox " + id.serialize() + " failed", e)); } @@ -161,6 +167,7
[james-project] 09/28: Allow passing openjpa and underlying datasource (DBCP2) properties (#1580)
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit 534a7848183c7172d155b52ba0431f5adfc996b5 Author: Wojtek AuthorDate: Mon Jun 12 04:25:44 2023 -0400 Allow passing openjpa and underlying datasource (DBCP2) properties (#1580) --- .../james/modules/data/JPAConfiguration.java | 87 -- .../james/modules/data/JPAEntityManagerModule.java | 53 + src/site/xdoc/server/config-system.xml | 9 ++- 3 files changed, 126 insertions(+), 23 deletions(-) diff --git a/server/container/guice/jpa-common/src/main/java/org/apache/james/modules/data/JPAConfiguration.java b/server/container/guice/jpa-common/src/main/java/org/apache/james/modules/data/JPAConfiguration.java index bed6c9041a..62419c1bb2 100644 --- a/server/container/guice/jpa-common/src/main/java/org/apache/james/modules/data/JPAConfiguration.java +++ b/server/container/guice/jpa-common/src/main/java/org/apache/james/modules/data/JPAConfiguration.java @@ -19,11 +19,17 @@ package org.apache.james.modules.data; import static org.apache.james.modules.data.JPAConfiguration.Credential.NO_CREDENTIAL; +import static org.apache.james.modules.data.JPAConfiguration.ReadyToBuild.CUSTOM_DATASOURCE_PROPERTIES; +import static org.apache.james.modules.data.JPAConfiguration.ReadyToBuild.CUSTOM_OPENJPA_PROPERTIES; import static org.apache.james.modules.data.JPAConfiguration.ReadyToBuild.NO_MAX_CONNECTIONS; +import static org.apache.james.modules.data.JPAConfiguration.ReadyToBuild.NO_MULTITHREADED; import static org.apache.james.modules.data.JPAConfiguration.ReadyToBuild.NO_TEST_ON_BORROW; import static org.apache.james.modules.data.JPAConfiguration.ReadyToBuild.NO_VALIDATION_QUERY; import static org.apache.james.modules.data.JPAConfiguration.ReadyToBuild.NO_VALIDATION_QUERY_TIMEOUT_SEC; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.Optional; import org.apache.commons.lang3.StringUtils; @@ -34,6 +40,23 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; public class JPAConfiguration { +static final String JPA_CONNECTION_DRIVER_NAME = "openjpa.ConnectionDriverName"; +static final String JPA_CONNECTION_USERNAME = "openjpa.ConnectionUserName"; +static final String JPA_CONNECTION_PASSWORD = "openjpa.ConnectionPassword"; +static final String JPA_CONNECTION_PROPERTIES = "openjpa.ConnectionProperties"; +static final String JPA_CONNECTION_URL = "openjpa.ConnectionURL"; +static final String JPA_MULTITHREADED = "openjpa.Multithreaded"; +static List DEFAULT_JPA_PROPERTIES = List.of(JPA_CONNECTION_DRIVER_NAME, JPA_CONNECTION_URL, JPA_MULTITHREADED, JPA_CONNECTION_USERNAME, JPA_CONNECTION_PASSWORD); + +static final String DATASOURCE_TEST_ON_BORROW = "datasource.testOnBorrow"; +static final String DATASOURCE_VALIDATION_QUERY_TIMEOUT_SEC = "datasource.validationQueryTimeoutSec"; +static final String DATASOURCE_VALIDATION_QUERY = "datasource.validationQuery"; +static final String DATASOURCE_MAX_TOTAL = "datasource.maxTotal"; +static List DEFAULT_DATASOURCE_PROPERTIES = List.of(DATASOURCE_TEST_ON_BORROW, DATASOURCE_VALIDATION_QUERY_TIMEOUT_SEC, DATASOURCE_VALIDATION_QUERY, DATASOURCE_MAX_TOTAL); + +static { +} + public static class Credential { private static final Logger LOGGER = LoggerFactory.getLogger(Credential.class); static final Optional NO_CREDENTIAL = Optional.empty(); @@ -78,40 +101,50 @@ public class JPAConfiguration { public static class ReadyToBuild { static final Optional NO_TEST_ON_BORROW = Optional.empty(); +static final Optional NO_MULTITHREADED = Optional.empty(); static final Optional NO_VALIDATION_QUERY_TIMEOUT_SEC = Optional.empty(); static final Optional NO_VALIDATION_QUERY = Optional.empty(); static final Optional NO_MAX_CONNECTIONS = Optional.empty(); +static final Map CUSTOM_OPENJPA_PROPERTIES = Map.of(); +static final Map CUSTOM_DATASOURCE_PROPERTIES = Map.of(); private final String driverName; private final String driverURL; private Optional credential; private Optional testOnBorrow; +private Optional multithreaded; private Optional validationQueryTimeoutSec; private Optional validationQuery; private Optional maxConnections; +private Map customDatasourceProperties; +private Map customOpenjpaProperties; private ReadyToBuild(String driverName, String driverURL, Optional credential, -Optional testOnBorrow, Optional validationQueryTimeoutSec, -Optional validationQuery,Optional maxConnections +Optional testOnBorrow,
[james-project] 16/28: JAMES-3906 Respect orthogonal architecture + centralise certificate renewal management
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit 4d360f65a0ba1858c16ee8aa32a0c29b9471d1f0 Author: Benoit Tellier AuthorDate: Thu May 25 11:19:47 2023 +0700 JAMES-3906 Respect orthogonal architecture + centralise certificate renewal management --- pom.xml| 5 ++ .../james/modules/protocols/IMAPServerModule.java | 5 +- .../james/modules/protocols/LMTPServerModule.java | 5 +- .../modules/protocols/ManageSieveServerModule.java | 5 +- .../james/modules/protocols/POP3ServerModule.java | 5 +- .../james/modules/protocols/SMTPServerModule.java | 5 +- server/container/guice/protocols/webadmin/pom.xml | 4 ++ .../james/modules/server/ServerRouteModule.java} | 30 .../james/modules/server/WebAdminServerModule.java | 7 +- server/protocols/protocols-library/pom.xml | 4 -- .../lib/webadmin/AbstractServerRoutes.java | 42 --- .../james/lmtpserver/webadmin/LMTPRoutes.java | 21 -- .../webadmin/ManageSieveRoutes.java| 21 -- .../james/pop3server/webadmin/POP3Routes.java | 21 -- .../james/smtpserver/webadmin/SmtpRoutes.java | 21 -- server/protocols/webadmin/pom.xml | 1 + .../webadmin/webadmin-protocols}/pom.xml | 31 + .../protocols/webadmin/ProtocolServerRoutes.java | 81 ++ 18 files changed, 133 insertions(+), 181 deletions(-) diff --git a/pom.xml b/pom.xml index 5abb95fa18..ad6608245f 100644 --- a/pom.xml +++ b/pom.xml @@ -1938,6 +1938,11 @@ james-server-webadmin-mailrepository ${project.version} + +${james.groupId} +james-server-webadmin-protocols +${project.version} + ${james.groupId} james-server-webadmin-rabbitmq diff --git a/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java b/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java index 0d84991d97..603fdc7a15 100644 --- a/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java +++ b/server/container/guice/protocols/imap/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java @@ -57,10 +57,10 @@ import org.apache.james.imap.processor.SelectProcessor; import org.apache.james.imap.processor.base.AbstractProcessor; import org.apache.james.imap.processor.base.UnknownRequestProcessor; import org.apache.james.imapserver.netty.IMAPServerFactory; -import org.apache.james.imapserver.webadmin.ImapRoutes; import org.apache.james.lifecycle.api.ConfigurationSanitizer; import org.apache.james.metrics.api.GaugeRegistry; import org.apache.james.metrics.api.MetricFactory; +import org.apache.james.protocols.lib.netty.AbstractServerFactory; import org.apache.james.server.core.configuration.ConfigurationProvider; import org.apache.james.utils.ClassName; import org.apache.james.utils.GuiceGenericLoader; @@ -68,7 +68,6 @@ import org.apache.james.utils.GuiceProbe; import org.apache.james.utils.InitializationOperation; import org.apache.james.utils.InitilizationOperationBuilder; import org.apache.james.utils.KeystoreCreator; -import org.apache.james.webadmin.Routes; import com.github.fge.lambdas.Throwing; import com.google.common.collect.ImmutableList; @@ -102,7 +101,7 @@ public class IMAPServerModule extends AbstractModule { Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(ImapGuiceProbe.class); -Multibinder.newSetBinder(binder(), Routes.class).addBinding().to(ImapRoutes.class); +Multibinder.newSetBinder(binder(), AbstractServerFactory.class).addBinding().to(IMAPServerFactory.class); } @Provides diff --git a/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java b/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java index 168d2f7027..9e198cf843 100644 --- a/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java +++ b/server/container/guice/protocols/lmtp/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java @@ -24,14 +24,13 @@ import org.apache.james.RunArguments; import org.apache.james.filesystem.api.FileSystem; import org.apache.james.lifecycle.api.ConfigurationSanitizer; import org.apache.james.lmtpserver.netty.LMTPServerFactory; -import org.apache.james.lmtpserver.webadmin.LMTPRoutes; +import org.apache.james.protocols.lib.netty.AbstractServerFactory; import org.apache.james.server.core.configuration.ConfigurationProvider;
[james-project] 13/28: JAMES-3906 fix issue with `ManageSieveServerFactory` not being singleton causing issues
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit 162dc00a4083d4c7882be61131d0fa85186f Author: Wojciech Kapcia AuthorDate: Thu May 11 19:06:39 2023 -0400 JAMES-3906 fix issue with `ManageSieveServerFactory` not being singleton causing issues --- .../org/apache/james/modules/protocols/ManageSieveServerModule.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java b/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java index 9ec6101d8e..cd10b994f2 100644 --- a/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java +++ b/server/container/guice/protocols/managedsieve/src/main/java/org/apache/james/modules/protocols/ManageSieveServerModule.java @@ -35,6 +35,7 @@ import org.apache.james.utils.KeystoreCreator; import org.apache.james.webadmin.Routes; import com.google.inject.AbstractModule; +import com.google.inject.Scopes; import com.google.inject.multibindings.Multibinder; import com.google.inject.multibindings.ProvidesIntoSet; @@ -43,6 +44,7 @@ public class ManageSieveServerModule extends AbstractModule { @Override protected void configure() { install(new SieveModule()); +bind(ManageSieveServerFactory.class).in(Scopes.SINGLETON); bind(CoreCommands.class).to(CoreProcessor.class); Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(SieveProbeImpl.class); - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-project] 18/28: JAMES-3906 Tests (and fix) for certificate reload
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit 341f2570afaea76d90629b1fa71c2dda69ce2bab Author: Benoit Tellier AuthorDate: Thu May 25 17:55:49 2023 +0700 JAMES-3906 Tests (and fix) for certificate reload --- .../AbstractSSLAwareChannelPipelineFactory.java| 12 +- .../apache/james/protocols/netty/NettyServer.java | 2 +- .../apache/james/JamesServerConcreteContract.java | 2 +- .../apache/james/JamesServerConcreteContract.java | 2 +- .../org/apache/james/CertificateReloadTest.java| 218 + .../org/apache/james/MemoryJamesServerTest.java| 2 +- .../memory-app/src/test/resources/imapserver2.xml | 73 +++ .../memory-app/src/test/resources/jwt_publickey| 9 + .../apps/memory-app/src/test/resources/keystore2 | Bin 0 -> 2726 bytes .../memory-app/src/test/resources/smtpserver2.xml | 136 + .../org/apache/james/TemporaryJamesServer.java | 18 +- .../james/modules/protocols/ImapGuiceProbe.java| 7 +- .../james/modules/protocols/SmtpGuiceProbe.java| 7 + .../lib/netty/AbstractConfigurableAsyncServer.java | 2 +- 14 files changed, 468 insertions(+), 22 deletions(-) diff --git a/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractSSLAwareChannelPipelineFactory.java b/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractSSLAwareChannelPipelineFactory.java index 8152aaeeed..dc7e4330a4 100644 --- a/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractSSLAwareChannelPipelineFactory.java +++ b/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractSSLAwareChannelPipelineFactory.java @@ -18,6 +18,8 @@ / package org.apache.james.protocols.netty; +import java.util.function.Supplier; + import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelPipeline; import io.netty.channel.socket.SocketChannel; @@ -30,7 +32,7 @@ import io.netty.util.concurrent.EventExecutorGroup; @ChannelHandler.Sharable public abstract class AbstractSSLAwareChannelPipelineFactory extends AbstractChannelPipelineFactory { private final boolean proxyRequired; -private Encryption secure; +private Supplier secure; public AbstractSSLAwareChannelPipelineFactory(int timeout, int maxConnections, int maxConnectsPerIp, @@ -42,7 +44,7 @@ public abstract class AbstractSSLAwareChannelPipelineFactory secure, ChannelHandlerFactory frameHandlerFactory, EventExecutorGroup eventExecutorGroup) { this(timeout, maxConnections, maxConnectsPerIp, proxyRequired, frameHandlerFactory, eventExecutorGroup); @@ -55,9 +57,9 @@ public abstract class AbstractSSLAwareChannelPipelineFactory secure, getFrameHandlerFactory(), new DefaultEventLoopGroup(16)) { diff --git a/server/apps/cassandra-app/src/test/java/org/apache/james/JamesServerConcreteContract.java b/server/apps/cassandra-app/src/test/java/org/apache/james/JamesServerConcreteContract.java index ee6b338e87..3ac19242ee 100644 --- a/server/apps/cassandra-app/src/test/java/org/apache/james/JamesServerConcreteContract.java +++ b/server/apps/cassandra-app/src/test/java/org/apache/james/JamesServerConcreteContract.java @@ -32,7 +32,7 @@ public interface JamesServerConcreteContract extends JamesServerContract { @Override default int imapsPort(GuiceJamesServer server) { -return server.getProbe(ImapGuiceProbe.class).getImapsPort(); +return server.getProbe(ImapGuiceProbe.class).getImapStartTLSPort(); } @Override diff --git a/server/apps/jpa-app/src/test/java/org/apache/james/JamesServerConcreteContract.java b/server/apps/jpa-app/src/test/java/org/apache/james/JamesServerConcreteContract.java index ee6b338e87..3ac19242ee 100644 --- a/server/apps/jpa-app/src/test/java/org/apache/james/JamesServerConcreteContract.java +++ b/server/apps/jpa-app/src/test/java/org/apache/james/JamesServerConcreteContract.java @@ -32,7 +32,7 @@ public interface JamesServerConcreteContract extends JamesServerContract { @Override default int imapsPort(GuiceJamesServer server) { -return server.getProbe(ImapGuiceProbe.class).getImapsPort(); +return server.getProbe(ImapGuiceProbe.class).getImapStartTLSPort(); } @Override diff --git a/server/apps/memory-app/src/test/java/org/apache/james/CertificateReloadTest.java b/server/apps/memory-app/src/test/java/org/apache/james/CertificateReloadTest.java new file mode 100644 index 00..8de9a48892 --- /dev/null +++ b/server/apps/memory-app/src/test/java/org/apache/james/CertificateReloadTest.java @@ -0,0 +1,218 @@ +/ + * Licensed to the Apache
[james-project] 03/28: [FIX] Correctly close JPA EntityManager in a couple of places (#1574)
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit e0e6f24bd0563d9a556c7ed8cd60dd984d0cb556 Author: Benoit TELLIER AuthorDate: Tue May 30 08:56:18 2023 +0700 [FIX] Correctly close JPA EntityManager in a couple of places (#1574) --- .../mailbox/jpa/quota/JPAPerUserMaxQuotaDAO.java | 73 +++--- .../mailbox/jpa/quota/JpaCurrentQuotaManager.java | 10 ++- .../james/jpa/healthcheck/JPAHealthCheck.java | 17 ++--- 3 files changed, 65 insertions(+), 35 deletions(-) diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaDAO.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaDAO.java index dcd23bae35..fa1fcffaca 100644 --- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaDAO.java +++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/quota/JPAPerUserMaxQuotaDAO.java @@ -26,6 +26,7 @@ import javax.inject.Inject; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; +import org.apache.james.backends.jpa.EntityManagerUtils; import org.apache.james.backends.jpa.TransactionRunner; import org.apache.james.core.Domain; import org.apache.james.core.quota.QuotaCountLimit; @@ -163,56 +164,80 @@ public class JPAPerUserMaxQuotaDAO { public Optional getGlobalMaxStorage() { EntityManager entityManager = entityManagerFactory.createEntityManager(); -MaxGlobalStorage storedValue = entityManager.find(MaxGlobalStorage.class, MaxGlobalStorage.DEFAULT_KEY); -if (storedValue == null) { -return Optional.empty(); +try { +MaxGlobalStorage storedValue = entityManager.find(MaxGlobalStorage.class, MaxGlobalStorage.DEFAULT_KEY); +if (storedValue == null) { +return Optional.empty(); +} +return longToQuotaSize(storedValue.getValue()); +} finally { +EntityManagerUtils.safelyClose(entityManager); } -return longToQuotaSize(storedValue.getValue()); } public Optional getGlobalMaxMessage() { EntityManager entityManager = entityManagerFactory.createEntityManager(); -MaxGlobalMessageCount storedValue = entityManager.find(MaxGlobalMessageCount.class, MaxGlobalMessageCount.DEFAULT_KEY); -if (storedValue == null) { -return Optional.empty(); +try { +MaxGlobalMessageCount storedValue = entityManager.find(MaxGlobalMessageCount.class, MaxGlobalMessageCount.DEFAULT_KEY); +if (storedValue == null) { +return Optional.empty(); +} +return longToQuotaCount(storedValue.getValue()); +} finally { +EntityManagerUtils.safelyClose(entityManager); } -return longToQuotaCount(storedValue.getValue()); } public Optional getMaxStorage(QuotaRoot quotaRoot) { EntityManager entityManager = entityManagerFactory.createEntityManager(); -MaxUserStorage storedValue = entityManager.find(MaxUserStorage.class, quotaRoot.getValue()); -if (storedValue == null) { -return Optional.empty(); +try { +MaxUserStorage storedValue = entityManager.find(MaxUserStorage.class, quotaRoot.getValue()); +if (storedValue == null) { +return Optional.empty(); +} +return longToQuotaSize(storedValue.getValue()); +} finally { +EntityManagerUtils.safelyClose(entityManager); } -return longToQuotaSize(storedValue.getValue()); } public Optional getMaxMessage(QuotaRoot quotaRoot) { EntityManager entityManager = entityManagerFactory.createEntityManager(); -MaxUserMessageCount storedValue = entityManager.find(MaxUserMessageCount.class, quotaRoot.getValue()); -if (storedValue == null) { -return Optional.empty(); +try { +MaxUserMessageCount storedValue = entityManager.find(MaxUserMessageCount.class, quotaRoot.getValue()); +if (storedValue == null) { +return Optional.empty(); +} +return longToQuotaCount(storedValue.getValue()); +} finally { +EntityManagerUtils.safelyClose(entityManager); } -return longToQuotaCount(storedValue.getValue()); } public Optional getDomainMaxMessage(Domain domain) { EntityManager entityManager = entityManagerFactory.createEntityManager(); -MaxDomainMessageCount storedValue = entityManager.find(MaxDomainMessageCount.class, domain.asString()); -if (storedValue == null) { -return Optional.empty(); +try { +MaxDomainMessageCount storedValue =
[james-project] 19/28: JAMES-3906 Documentation
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit 50aff7b1890a31e91fe6aabdb51841e4c97381b5 Author: Benoit Tellier AuthorDate: Fri May 26 09:37:09 2023 +0700 JAMES-3906 Documentation --- .../AbstractSSLAwareChannelPipelineFactory.java| 3 ++- .../docs/modules/ROOT/pages/operate/webadmin.adoc | 23 ++ src/site/markdown/server/manage-webadmin.md| 23 ++ 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractSSLAwareChannelPipelineFactory.java b/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractSSLAwareChannelPipelineFactory.java index dc7e4330a4..c04acb83f1 100644 --- a/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractSSLAwareChannelPipelineFactory.java +++ b/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractSSLAwareChannelPipelineFactory.java @@ -68,6 +68,7 @@ public abstract class AbstractSSLAwareChannelPipelineFactoryhttp://ip:port/servers?reload-certificate + + +Optional query parameters: + + - `port`: positive integer (valid port number). Only reload certificates for the specific port. + +Return code: + + - 204: the certificate is reloaded + - 400: Invalid request. \ No newline at end of file diff --git a/src/site/markdown/server/manage-webadmin.md b/src/site/markdown/server/manage-webadmin.md index 4f59df86d3..f091d3c0a3 100644 --- a/src/site/markdown/server/manage-webadmin.md +++ b/src/site/markdown/server/manage-webadmin.md @@ -4514,3 +4514,26 @@ Response codes : - 201: the taskId of the created task - 400: Invalid action argument for performing operation on mappings data + +## Reloading server certificates + +Certificates for TCP based protocols (IMAP, SMTP, POP3, LMTP and ManageSieve) can be updated at +runtime, without service interuption and without closing existing connections. + +In order to do so: + + - Generate / retrieve your cryptographic materials and replace the ones specified in James configuration. + - Then call the following endpoint: + +``` +curl -XPOST http://ip:port/servers?reload-certificate +``` + +Optional query parameters: + + - `port`: positive integer (valid port number). Only reload certificates for the specific port. + +Return code: + + - 204: the certificate is reloaded + - 400: Invalid request. \ No newline at end of file - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-project] 25/28: JAMES-3914 Sieve Reject: support several recipients
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit d5bad56ca55ec067e392f05f36e7b19fab6125de Author: Benoit Tellier AuthorDate: Mon Jun 12 16:26:04 2023 +0700 JAMES-3914 Sieve Reject: support several recipients --- .../james/transport/mailets/jsieve/RejectAction.java | 5 ++--- .../mailets/delivery/SieveIntegrationTest.java| 19 +++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java index 9d0bdb7e59..32e3680404 100644 --- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java +++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java @@ -109,8 +109,7 @@ public class RejectAction implements MailAction { originalRecipient = originalRecipients[0]; } -MailAddress soleRecipient = ActionUtils.getSoleRecipient(aMail); -String finalRecipient = soleRecipient.asString(); +String finalRecipient = context.getRecipient().asString(); String originalMessageId = aMail.getMessage().getMessageID(); Multipart multipart = MDN.builder() @@ -133,7 +132,7 @@ public class RejectAction implements MailAction { // Send the message MimeMessage reply = (MimeMessage) aMail.getMessage().reply(false); -soleRecipient.toInternetAddress() +context.getRecipient().toInternetAddress() .ifPresent(Throwing.consumer(reply::setFrom).sneakyThrow()); reply.setContent(multipart); reply.saveChanges(); diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java index 47ede08af8..884dbfe606 100644 --- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java +++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java @@ -479,6 +479,25 @@ class SieveIntegrationTest { assertThat(mail.getRecipients()).isEmpty(); } +@Test +void rejectShouldWorkWhenMultipleRecipients() throws Exception { + prepareTestUsingScript("org/apache/james/transport/mailets/delivery/reject.script"); +when(usersRepository.getUsername(new MailAddress("ot...@domain.tld"))).thenReturn(Username.of("ot...@domain.tld")); +when(resourceLocator.get(new MailAddress("ot...@domain.tld"))).thenThrow(new ScriptNotFoundException()); + +FakeMail mail = createMail(); +mail.setRecipients(ImmutableList.of(new MailAddress(RECEIVER_DOMAIN_COM), new MailAddress("ot...@domain.tld"))); +testee.service(mail); + +FakeMailContext.SentMail expectedSentMail = FakeMailContext.sentMailBuilder() +.recipient("sen...@any.com") +.fromMailet() +.build(); +assertThat(fakeMailContext.getSentMails()) +.containsExactly(expectedSentMail); +assertThat(mail.getRecipients()).containsOnly(new MailAddress("ot...@domain.tld")); +} + @Test void redirectShouldWorkWhenSeveralRecipients() throws Exception { prepareTestUsingScript("org/apache/james/transport/mailets/delivery/redirect.script"); - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-project] 02/28: [PERF] Avoid using Non-Preemptive authentication for OpenSearch (#1564)
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit 6855334242d0f60df6e5f2919766dd11982f9617 Author: Trần Hồng Quân <55171818+quantranhong1...@users.noreply.github.com> AuthorDate: Thu May 18 17:10:21 2023 +0700 [PERF] Avoid using Non-Preemptive authentication for OpenSearch (#1564) Before, we were using Non-Preemptive authentication for OpenSearch that makes 1 normal OpenSearch request to be 2 round trips (1 authenticated 401 request and 1 normal request). This likely negatively affected our search performance. We should avoid that. rf: https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/master/_basic_authentication.html --- .../main/java/org/apache/james/backends/opensearch/ClientProvider.java | 1 - 1 file changed, 1 deletion(-) diff --git a/backends-common/opensearch/src/main/java/org/apache/james/backends/opensearch/ClientProvider.java b/backends-common/opensearch/src/main/java/org/apache/james/backends/opensearch/ClientProvider.java index 28b09fa383..d253fc6d6b 100644 --- a/backends-common/opensearch/src/main/java/org/apache/james/backends/opensearch/ClientProvider.java +++ b/backends-common/opensearch/src/main/java/org/apache/james/backends/opensearch/ClientProvider.java @@ -169,7 +169,6 @@ public class ClientProvider implements Provider { } private void configureAuthentication(HttpAsyncClientBuilder builder) { -builder.disableAuthCaching(); configuration.getCredential() .ifPresent(credential -> { CredentialsProvider credentialsProvider = new BasicCredentialsProvider(); - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-project] 04/28: [FIX] Update JPA version in demo container (#1576)
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit 3aee16ab1820923215fcbb5348e4684e2739e0e8 Author: Benoit TELLIER AuthorDate: Thu Jun 1 16:50:29 2023 +0700 [FIX] Update JPA version in demo container (#1576) --- server/apps/demo/startup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/apps/demo/startup.sh b/server/apps/demo/startup.sh index 2a8510fd76..04f3aaa9b9 100644 --- a/server/apps/demo/startup.sh +++ b/server/apps/demo/startup.sh @@ -8,6 +8,6 @@ wait-for-it.sh --host=localhost --port= --strict --timeout=0 -- ./initialdat java -Djdk.tls.ephemeralDHKeySize=2048 \ -classpath '/root/resources:/root/classes:/root/libs/*' \ - -javaagent:/root/libs/openjpa-3.1.2.jar \ + -javaagent:/root/libs/openjpa-3.2.0.jar \ -Dlogback.configurationFile=/root/conf/logback.xml \ - -Dworking.directory=/root/ org.apache.james.JPAJamesServerMain \ No newline at end of file + -Dworking.directory=/root/ org.apache.james.JPAJamesServerMain - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-project] 11/28: JAMES-3911 JPA: Prevent concurrent operations on the same EntityManager
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit 2533185267c747825ad245043fc034232dcb80b9 Author: Benoit Tellier AuthorDate: Fri Jun 9 18:41:57 2023 +0700 JAMES-3911 JPA: Prevent concurrent operations on the same EntityManager --- .../mailbox/jpa/openjpa/OpenJPAMessageManager.java | 37 +- .../james/mailbox/store/StoreMailboxManager.java | 2 +- .../james/mailbox/store/StoreMessageManager.java | 10 +++--- 3 files changed, 42 insertions(+), 7 deletions(-) diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/openjpa/OpenJPAMessageManager.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/openjpa/OpenJPAMessageManager.java index 567e8d5ac6..7226fb046a 100644 --- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/openjpa/OpenJPAMessageManager.java +++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/openjpa/OpenJPAMessageManager.java @@ -20,14 +20,18 @@ package org.apache.james.mailbox.jpa.openjpa; import java.time.Clock; +import java.util.EnumSet; import javax.mail.Flags; import org.apache.james.events.EventBus; import org.apache.james.mailbox.MailboxPathLocker; import org.apache.james.mailbox.MailboxSession; +import org.apache.james.mailbox.exception.MailboxException; import org.apache.james.mailbox.model.Mailbox; +import org.apache.james.mailbox.model.MailboxACL; import org.apache.james.mailbox.model.MessageId; +import org.apache.james.mailbox.model.UidValidity; import org.apache.james.mailbox.quota.QuotaManager; import org.apache.james.mailbox.quota.QuotaRootResolver; import org.apache.james.mailbox.store.BatchSizes; @@ -37,23 +41,35 @@ import org.apache.james.mailbox.store.PreDeletionHooks; import org.apache.james.mailbox.store.StoreMailboxManager; import org.apache.james.mailbox.store.StoreMessageManager; import org.apache.james.mailbox.store.StoreRightManager; +import org.apache.james.mailbox.store.mail.MessageMapper; import org.apache.james.mailbox.store.mail.ThreadIdGuessingAlgorithm; import org.apache.james.mailbox.store.search.MessageSearchIndex; +import com.github.fge.lambdas.Throwing; + +import reactor.core.publisher.Mono; + /** * OpenJPA implementation of Mailbox */ public class OpenJPAMessageManager extends StoreMessageManager { +private final MailboxSessionMapperFactory mapperFactory; +private final StoreRightManager storeRightManager; +private final Mailbox mailbox; public OpenJPAMessageManager(MailboxSessionMapperFactory mapperFactory, MessageSearchIndex index, EventBus eventBus, MailboxPathLocker locker, Mailbox mailbox, QuotaManager quotaManager, QuotaRootResolver quotaRootResolver, MessageId.Factory messageIdFactory, BatchSizes batchSizes, - StoreRightManager storeRightManager, ThreadIdGuessingAlgorithm threadIdGuessingAlgorithm, Clock clock) { + StoreRightManager storeRightManager, ThreadIdGuessingAlgorithm threadIdGuessingAlgorithm, + Clock clock) { super(StoreMailboxManager.DEFAULT_NO_MESSAGE_CAPABILITIES, mapperFactory, index, eventBus, locker, mailbox, quotaManager, quotaRootResolver, batchSizes, storeRightManager, PreDeletionHooks.NO_PRE_DELETION_HOOK, new MessageStorer.WithoutAttachment(mapperFactory, messageIdFactory, new OpenJPAMessageFactory(OpenJPAMessageFactory.AdvancedFeature.None), threadIdGuessingAlgorithm, clock)); +this.storeRightManager = storeRightManager; +this.mapperFactory = mapperFactory; +this.mailbox = mailbox; } /** @@ -65,4 +81,23 @@ public class OpenJPAMessageManager extends StoreMessageManager { flags.add(Flags.Flag.USER); return flags; } + +public Mono getMetaDataReactive(MailboxMetaData.RecentMode recentMode, MailboxSession mailboxSession, EnumSet items) throws MailboxException { +MailboxACL resolvedAcl = getResolvedAcl(mailboxSession); +if (!storeRightManager.hasRight(mailbox, MailboxACL.Right.Read, mailboxSession)) { +return Mono.just(MailboxMetaData.sensibleInformationFree(resolvedAcl, getMailboxEntity().getUidValidity(), isWriteable(mailboxSession))); +} +Flags permanentFlags = getPermanentFlags(mailboxSession); +UidValidity uidValidity = getMailboxEntity().getUidValidity(); +MessageMapper messageMapper = mapperFactory.getMessageMapper(mailboxSession); + +return messageMapper.executeReactive( +nextUid(messageMapper, items) +.flatMap(nextUid -> highestModSeq(messageMapper, items) +.flatMap(highestModSeq -> firstUnseen(messageMapper, items) +
[james-project] 17/28: JAMES-3906 Allow SSL reload of a specific server via the port number
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit a8d36a520fcbe4eed08bf0fb31ee5e1950887c5c Author: Benoit Tellier AuthorDate: Thu May 25 11:25:06 2023 +0700 JAMES-3906 Allow SSL reload of a specific server via the port number --- .../apache/james/protocols/webadmin/ProtocolServerRoutes.java | 11 +++ 1 file changed, 11 insertions(+) diff --git a/server/protocols/webadmin/webadmin-protocols/src/main/java/org/apache/james/protocols/webadmin/ProtocolServerRoutes.java b/server/protocols/webadmin/webadmin-protocols/src/main/java/org/apache/james/protocols/webadmin/ProtocolServerRoutes.java index 4dabb780c1..028b75f3e1 100644 --- a/server/protocols/webadmin/webadmin-protocols/src/main/java/org/apache/james/protocols/webadmin/ProtocolServerRoutes.java +++ b/server/protocols/webadmin/webadmin-protocols/src/main/java/org/apache/james/protocols/webadmin/ProtocolServerRoutes.java @@ -19,12 +19,14 @@ package org.apache.james.protocols.webadmin; +import java.util.Optional; import java.util.Set; import javax.inject.Inject; import org.apache.james.protocols.lib.netty.AbstractConfigurableAsyncServer; import org.apache.james.protocols.lib.netty.AbstractServerFactory; +import org.apache.james.util.Port; import org.apache.james.webadmin.Routes; import org.apache.james.webadmin.utils.ErrorResponder; import org.apache.james.webadmin.utils.Responses; @@ -32,7 +34,9 @@ import org.eclipse.jetty.http.HttpStatus; import com.github.fge.lambdas.Throwing; import com.google.common.base.Preconditions; +import com.google.common.base.Predicate; +import spark.Request; import spark.Service; public class ProtocolServerRoutes implements Routes { @@ -67,12 +71,19 @@ public class ProtocolServerRoutes implements Routes { servers.stream() .flatMap(serverFactory -> serverFactory.getServers().stream()) .filter(AbstractConfigurableAsyncServer::isEnabled) +.filter(filters(request)) .forEach(Throwing.consumer(AbstractConfigurableAsyncServer::reloadSSLCertificate)); return Responses.returnNoContent(response); }); } +private Predicate filters(Request request) { +Optional port = Optional.ofNullable(request.queryParams("port")).map(Integer::parseUnsignedInt).map(Port::of); + +return server -> port.map(p -> server.getPort() == p.getValue()).orElse(true); +} + private boolean noServerEnabled() { return servers.stream() .flatMap(serverFactory -> serverFactory.getServers().stream()) - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-project] 01/28: [RELEASE] Switch to 3.8.1-SNAPSHOT
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit 7c1dd8889600656df9ad50984716cdafe6745d69 Author: Benoit Tellier AuthorDate: Tue Jun 13 16:19:01 2023 +0700 [RELEASE] Switch to 3.8.1-SNAPSHOT --- backends-common/cassandra/pom.xml | 2 +- backends-common/jpa/pom.xml | 2 +- backends-common/opensearch/pom.xml | 2 +- backends-common/pom.xml | 2 +- backends-common/pulsar/pom.xml | 2 +- backends-common/rabbitmq/pom.xml| 2 +- code-coverage-report/pom.xml| 2 +- core/pom.xml| 2 +- event-bus/api/pom.xml | 2 +- event-bus/cassandra/pom.xml | 2 +- event-bus/distributed/pom.xml | 2 +- event-bus/in-vm/pom.xml | 2 +- event-bus/pom.xml | 2 +- event-sourcing/event-sourcing-core/pom.xml | 2 +- event-sourcing/event-sourcing-pojo/pom.xml | 2 +- event-sourcing/event-store-api/pom.xml | 2 +- event-sourcing/event-store-cassandra/pom.xml| 2 +- event-sourcing/event-store-memory/pom.xml | 2 +- event-sourcing/pom.xml | 2 +- javax-mail-extension/pom.xml| 2 +- json/pom.xml| 2 +- mailbox/api/pom.xml | 2 +- mailbox/backup/pom.xml | 2 +- mailbox/cassandra/pom.xml | 2 +- mailbox/event/json/pom.xml | 2 +- mailbox/jpa/pom.xml | 2 +- mailbox/lucene/pom.xml | 2 +- mailbox/memory/pom.xml | 2 +- mailbox/opensearch/pom.xml | 2 +- mailbox/plugin/deleted-messages-vault-cassandra/pom.xml | 2 +- mailbox/plugin/deleted-messages-vault/pom.xml | 2 +- mailbox/plugin/quota-mailing-cassandra/pom.xml | 2 +- mailbox/plugin/quota-mailing-memory/pom.xml | 2 +- mailbox/plugin/quota-mailing/pom.xml| 2 +- mailbox/plugin/quota-search-opensearch/pom.xml | 2 +- mailbox/plugin/quota-search-scanning/pom.xml| 2 +- mailbox/plugin/quota-search/pom.xml | 2 +- mailbox/pom.xml | 2 +- mailbox/scanning-search/pom.xml | 2 +- mailbox/spring/pom.xml | 2 +- mailbox/store/pom.xml | 2 +- mailbox/tika/pom.xml| 2 +- mailbox/tools/copier/pom.xml| 2 +- mailbox/tools/indexer/pom.xml | 2 +- mailbox/tools/jpa-migrator/pom.xml | 2 +- mailbox/tools/quota-recompute/pom.xml | 2 +- mailet/ai/pom.xml | 2 +- mailet/amqp/pom.xml | 2 +- mailet/api/pom.xml | 2 +- mailet/base/pom.xml | 2 +- mailet/crypto/pom.xml | 2 +- mailet/icalendar/pom.xml| 2 +- mailet/mailetdocs-maven-plugin/pom.xml | 2 +- mailet/pom.xml | 2 +- mailet/standard/pom.xml | 2 +- mailet/test/pom.xml | 2 +- mdn/pom.xml | 2 +- metrics/metrics-api/pom.xml | 2 +-
[james-project] 08/28: [PERF] JPA: reuse EntityManager where possible (#1582)
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit 859cd50d7f162450e7fdfc65a33f5b102742cd4e Author: Benoit TELLIER AuthorDate: Fri Jun 9 13:58:48 2023 +0700 [PERF] JPA: reuse EntityManager where possible (#1582) --- .../jpa/JPAMailboxSessionMapperFactory.java| 8 +- .../james/mailbox/jpa/mail/JPAMessageMapper.java | 15 ++-- .../james/mailbox/jpa/mail/JPAModSeqProvider.java | 16 ++-- .../james/mailbox/jpa/mail/JPAUidProvider.java | 13 +++- .../mailbox/jpa/quota/JPAPerUserMaxQuotaDAO.java | 85 +++- .../jpa/quota/JPAPerUserMaxQuotaManager.java | 90 +- .../main/resources/META-INF/spring/mailbox-jpa.xml | 3 +- .../mailbox/jpa/quota/JPAPerUserMaxQuotaTest.java | 2 +- .../mpt/imapmailbox/jpa/host/JPAHostSystem.java| 2 +- 9 files changed, 132 insertions(+), 102 deletions(-) diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAMailboxSessionMapperFactory.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAMailboxSessionMapperFactory.java index cb7e0103a9..b751e92d5b 100644 --- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAMailboxSessionMapperFactory.java +++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAMailboxSessionMapperFactory.java @@ -28,6 +28,8 @@ import org.apache.james.mailbox.MailboxSession; import org.apache.james.mailbox.jpa.mail.JPAAnnotationMapper; import org.apache.james.mailbox.jpa.mail.JPAMailboxMapper; import org.apache.james.mailbox.jpa.mail.JPAMessageMapper; +import org.apache.james.mailbox.jpa.mail.JPAModSeqProvider; +import org.apache.james.mailbox.jpa.mail.JPAUidProvider; import org.apache.james.mailbox.jpa.user.JPASubscriptionMapper; import org.apache.james.mailbox.store.MailboxSessionMapperFactory; import org.apache.james.mailbox.store.mail.AnnotationMapper; @@ -45,11 +47,11 @@ import org.apache.james.mailbox.store.user.SubscriptionMapper; public class JPAMailboxSessionMapperFactory extends MailboxSessionMapperFactory { private final EntityManagerFactory entityManagerFactory; -private final UidProvider uidProvider; -private final ModSeqProvider modSeqProvider; +private final JPAUidProvider uidProvider; +private final JPAModSeqProvider modSeqProvider; @Inject -public JPAMailboxSessionMapperFactory(EntityManagerFactory entityManagerFactory, UidProvider uidProvider, ModSeqProvider modSeqProvider) { +public JPAMailboxSessionMapperFactory(EntityManagerFactory entityManagerFactory, JPAUidProvider uidProvider, JPAModSeqProvider modSeqProvider) { this.entityManagerFactory = entityManagerFactory; this.uidProvider = uidProvider; this.modSeqProvider = modSeqProvider; diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java index c9a05f7cc9..da2b5fd2a4 100644 --- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java +++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/mail/JPAMessageMapper.java @@ -49,8 +49,6 @@ import org.apache.james.mailbox.model.MessageRange.Type; import org.apache.james.mailbox.model.UpdatedFlags; import org.apache.james.mailbox.store.FlagsUpdateCalculator; import org.apache.james.mailbox.store.mail.MessageMapper; -import org.apache.james.mailbox.store.mail.ModSeqProvider; -import org.apache.james.mailbox.store.mail.UidProvider; import org.apache.james.mailbox.store.mail.model.MailboxMessage; import org.apache.james.mailbox.store.mail.utils.ApplicableFlagCalculator; import org.apache.openjpa.persistence.ArgumentException; @@ -70,10 +68,10 @@ public class JPAMessageMapper extends JPATransactionalMapper implements MessageM private static final int UNLIMITED = -1; private final MessageUtils messageMetadataMapper; -private final UidProvider uidProvider; -private final ModSeqProvider modSeqProvider; +private final JPAUidProvider uidProvider; +private final JPAModSeqProvider modSeqProvider; -public JPAMessageMapper(UidProvider uidProvider, ModSeqProvider modSeqProvider, EntityManagerFactory entityManagerFactory) { +public JPAMessageMapper(JPAUidProvider uidProvider, JPAModSeqProvider modSeqProvider, EntityManagerFactory entityManagerFactory) { super(entityManagerFactory); this.messageMetadataMapper = new MessageUtils(uidProvider, modSeqProvider); this.uidProvider = uidProvider; @@ -326,12 +324,12 @@ public class JPAMessageMapper extends JPATransactionalMapper implements MessageM @Override public Optional getLastUid(Mailbox mailbox) throws MailboxException { -return uidProvider.lastUid(mailbox); +return uidProvider.lastUid(mailbox, getEntityManager()); }
[james-project] 28/28: JAMES-3914 Fix SieveIntegrationTest
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit 1a045fabd817975cd29acaa18669b6d67d76020b Author: Benoit Tellier AuthorDate: Wed Jun 14 09:28:33 2023 +0700 JAMES-3914 Fix SieveIntegrationTest --- .../james/transport/mailets/delivery/SieveIntegrationTest.java | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java index 884dbfe606..456fcfc46a 100644 --- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java +++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java @@ -51,6 +51,8 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.slf4j.Logger; +import com.google.common.collect.ImmutableList; + class SieveIntegrationTest { private static final String LOCAL_PART = "receiver"; @@ -168,7 +170,7 @@ class SieveIntegrationTest { mail.setRecipients(ImmutableList.of(new MailAddress(RECEIVER_DOMAIN_COM), new MailAddress("ot...@domain.tld"))); testee.service(mail); - assertThatAttribute(mail.getAttribute(ATTRIBUTE_NAME)).isEqualTo(ATTRIBUTE_INBOX_ANY); + assertThat(mail.getAttribute(ATTRIBUTE_NAME)).contains(ATTRIBUTE_INBOX_ANY); } @Test @@ -913,7 +915,7 @@ class SieveIntegrationTest { mail.setRecipients(ImmutableList.of(new MailAddress(RECEIVER_DOMAIN_COM), new MailAddress("ot...@domain.tld"))); testee.service(mail); - assertThatAttribute(mail.getAttribute(ATTRIBUTE_NAME)).isEqualTo(ATTRIBUTE_INBOX); + assertThat(mail.getAttribute(ATTRIBUTE_NAME)).contains(ATTRIBUTE_INBOX); FakeMailContext.SentMail expectedSentMail = FakeMailContext.sentMailBuilder() .sender(new MailAddress(RECEIVER_DOMAIN_COM)) - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-project] 05/28: [FIX] JPA: avoid leaks in entity manager
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit bb9cebc6c5ee0f026a31ce65decf25633058940a Author: Benoit Tellier AuthorDate: Fri Jun 2 17:07:37 2023 +0700 [FIX] JPA: avoid leaks in entity manager --- .../listeners/SetCustomFlagOnBigMessages.java | 1 + .../james/mailbox/backup/DefaultMailboxBackup.java | 16 + .../mailbox/backup/ZipMailArchiveRestorer.java | 1 + .../CassandraMailboxSessionMapperFactory.java | 5 +++ ...CassandraRecomputeCurrentQuotasServiceTest.java | 2 +- .../task/JPARecomputeCurrentQuotasServiceTest.java | 2 +- .../MemoryRecomputeCurrentQuotasServiceTest.java | 4 ++- .../mailbox/store/SystemMailboxesProviderImpl.java | 3 +- .../store/event/MailboxAnnotationListener.java | 3 +- .../store/quota/DefaultUserQuotaRootResolver.java | 6 ++-- .../store/search/ListeningMessageSearchIndex.java | 6 ++-- .../store/event/MailboxAnnotationListenerTest.java | 3 ++ .../mailbox/tools/indexer/ReIndexerImpl.java | 1 + .../mailbox/tools/indexer/ReIndexerPerformer.java | 18 ++ .../quota/task/RecomputeCurrentQuotasService.java | 9 +++-- .../james/healthcheck/MailReceptionCheck.java | 3 +- .../adapter/mailbox/ACLUsernameChangeTaskStep.java | 7 ++-- .../mailbox/MailboxUsernameChangeTaskStep.java | 16 ++--- .../james/transport/mailets/RandomStoring.java | 3 +- .../jmap/draft/send/PostDequeueDecorator.java | 1 + .../james/jmap/mailet/filter/ActionApplier.java| 1 + .../webadmin/vault/routes/RestoreService.java | 3 +- .../webadmin/service/CreateMissingParentsTask.java | 15 .../webadmin/service/ExpireMailboxService.java | 3 +- .../webadmin/service/UserMailboxesService.java | 41 -- .../org/apache/james/rspamd/RspamdListener.java| 10 -- .../rspamd/task/GetMailboxMessagesService.java | 6 ++-- .../james/spamassassin/SpamAssassinListener.java | 2 ++ 28 files changed, 135 insertions(+), 56 deletions(-) diff --git a/examples/custom-listeners/src/main/java/org/apache/james/examples/custom/listeners/SetCustomFlagOnBigMessages.java b/examples/custom-listeners/src/main/java/org/apache/james/examples/custom/listeners/SetCustomFlagOnBigMessages.java index d7223c1d6b..192e6df1a0 100644 --- a/examples/custom-listeners/src/main/java/org/apache/james/examples/custom/listeners/SetCustomFlagOnBigMessages.java +++ b/examples/custom-listeners/src/main/java/org/apache/james/examples/custom/listeners/SetCustomFlagOnBigMessages.java @@ -86,6 +86,7 @@ class SetCustomFlagOnBigMessages implements EventListener.GroupEventListener { FlagsUpdateMode.ADD, MessageRange.one(messageUid), session); +mailboxManager.endProcessingRequest(session); } catch (MailboxException e) { LOGGER.error("error happens when adding '{}' flag to the message with uid {} in mailbox {} of user {}", BIG_MESSAGE, messageUid.asLong(), addedEvent.getMailboxId(), addedEvent.getUsername().asString(), e); diff --git a/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/DefaultMailboxBackup.java b/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/DefaultMailboxBackup.java index 0c9fd32bcd..bc6697a88a 100644 --- a/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/DefaultMailboxBackup.java +++ b/mailbox/backup/src/main/java/org/apache/james/mailbox/backup/DefaultMailboxBackup.java @@ -32,7 +32,6 @@ import org.apache.james.core.Username; import org.apache.james.mailbox.MailboxManager; import org.apache.james.mailbox.MailboxSession; import org.apache.james.mailbox.MessageManager; -import org.apache.james.mailbox.exception.BadCredentialsException; import org.apache.james.mailbox.exception.MailboxException; import org.apache.james.mailbox.model.FetchGroup; import org.apache.james.mailbox.model.Mailbox; @@ -98,14 +97,19 @@ public class DefaultMailboxBackup implements MailboxBackup { Stream messages = allMessagesForUser(accountContents); archive(mailboxes, messages, destination); +mailboxManager.endProcessingRequest(session); } -private boolean isAccountNonEmpty(Username username) throws BadCredentialsException, MailboxException, IOException { +private boolean isAccountNonEmpty(Username username) throws MailboxException { MailboxSession session = mailboxManager.createSystemSession(username); -return getAccountContentForUser(session) -.stream() -.findFirst() -.isPresent(); +try { +return getAccountContentForUser(session) +.stream() +.findFirst() +.isPresent(); +} finally { +mailboxManager.endProcessingRequest(session); +} }
[james-project] 06/28: [FIX] JPA: add DBCP2 to reuse connections
This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.8.x in repository https://gitbox.apache.org/repos/asf/james-project.git commit d53c43202232d2716a079a54686ea0255d853b27 Author: Benoit Tellier AuthorDate: Mon Jun 5 13:24:48 2023 +0700 [FIX] JPA: add DBCP2 to reuse connections --- backends-common/jpa/pom.xml | 5 + 1 file changed, 5 insertions(+) diff --git a/backends-common/jpa/pom.xml b/backends-common/jpa/pom.xml index ef0681f24f..b55b1a6f80 100644 --- a/backends-common/jpa/pom.xml +++ b/backends-common/jpa/pom.xml @@ -38,6 +38,11 @@ com.google.guava guava + +org.apache.commons +commons-dbcp2 +2.9.0 + org.apache.derby derby - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[GitHub] [james-project] chibenwa merged pull request #1592: [3.8.1] Backports
chibenwa merged PR #1592: URL: https://github.com/apache/james-project/pull/1592 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[GitHub] [james-project] chibenwa opened a new pull request, #1593: JAMES-3911 JPA: optimize applicable flags with a native query
chibenwa opened a new pull request, #1593: URL: https://github.com/apache/james-project/pull/1593 ## Before ![Screenshot from 2023-06-14 12-40-14](https://github.com/apache/james-project/assets/6928740/4328758f-2141-4a48-a42f-ad1e2fe45451) ## After ![Screenshot from 2023-06-14 12-40-13](https://github.com/apache/james-project/assets/6928740/9255b327-4b87-44a7-8cda-2271d144fbec) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org