(james-project) branch master updated (482ac366e3 -> 7222019643)

2024-03-17 Thread btellier
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 482ac366e3 [LOGGING] Aborting JMAP upload is too verbose (#2125)
 add 7222019643 JAMES-4020 Fully comply with RFC-3501 Section 6.4.5 (#2123)

No new revisions were added by this update.

Summary of changes:
 .../apache/james/mailbox/store/ResultUtils.java| 33 +-
 .../james/imap/scripts/FetchRFC822Header.test  | 52 ++
 2 files changed, 84 insertions(+), 1 deletion(-)


-
To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org
For additional commands, e-mail: notifications-h...@james.apache.org



Re: [PR] JAMES-4020 Fully comply with RFC-3501 Section 6.4.5 [james-project]

2024-03-17 Thread via GitHub


chibenwa merged PR #2123:
URL: https://github.com/apache/james-project/pull/2123


-- 
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: [LOGGING] Aborting JMAP upload is too verbose (#2125)

2024-03-17 Thread btellier
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 482ac366e3 [LOGGING] Aborting JMAP upload is too verbose (#2125)
482ac366e3 is described below

commit 482ac366e34e700e42b42eca701314bceea78e00
Author: Benoit TELLIER 
AuthorDate: Mon Mar 18 06:20:18 2024 +0100

[LOGGING] Aborting JMAP upload is too verbose (#2125)
---
 .../src/main/scala/org/apache/james/jmap/core/ProblemDetails.scala| 4 
 .../org/apache/james/jmap/method/MailboxSetCreatePerformer.scala  | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/core/ProblemDetails.scala
 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/core/ProblemDetails.scala
index fc75a52d72..226fe7e32a 100644
--- 
a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/core/ProblemDetails.scala
+++ 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/core/ProblemDetails.scala
@@ -25,6 +25,7 @@ import 
org.apache.james.jmap.core.RequestLevelErrorType.{DEFAULT_ERROR_TYPE, Err
 import org.apache.james.jmap.exceptions.UnauthorizedException
 import org.apache.james.jmap.routes.UnsupportedCapabilitiesException
 import org.slf4j.{Logger, LoggerFactory}
+import reactor.netty.channel.AbortedException
 
 /**
  * Problem Details for HTTP APIs within the JMAP context
@@ -40,6 +41,9 @@ object ProblemDetails {
   val LOGGER: Logger = LoggerFactory.getLogger(classOf[ProblemDetails])
 
   def forThrowable(throwable: Throwable): ProblemDetails = throwable match {
+case exception: AbortedException =>
+  LOGGER.info("The connection was aborted: {}", exception.getMessage)
+  ProblemDetails(status = INTERNAL_SERVER_ERROR, detail = 
exception.getMessage)
 case exception: IllegalArgumentException =>
   LOGGER.info("The request was successfully parsed as JSON but did not 
match the type signature of the Request object: {}", exception.getMessage)
   notRequestProblem(
diff --git 
a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetCreatePerformer.scala
 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetCreatePerformer.scala
index 5aae0b99d4..3eacaf1a4b 100644
--- 
a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetCreatePerformer.scala
+++ 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetCreatePerformer.scala
@@ -40,7 +40,7 @@ import reactor.core.scala.publisher.{SFlux, SMono}
 import scala.util.Try
 
 object MailboxSetCreatePerformer {
-  private val LOGGER = 
LoggerFactory.getLogger(classOf[EmailSetCreatePerformer])
+  private val LOGGER = 
LoggerFactory.getLogger(classOf[MailboxSetCreatePerformer])
   sealed trait MailboxCreationResult {
 def mailboxCreationId: MailboxCreationId
   }


-
To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org
For additional commands, e-mail: notifications-h...@james.apache.org



Re: [PR] [LOGGING] Aborting JMAP upload is too verbose [james-project]

2024-03-17 Thread via GitHub


chibenwa merged PR #2125:
URL: https://github.com/apache/james-project/pull/2125


-- 
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



Re: [PR] JAMES-2586 Develocity metrics for postgres branch [james-project]

2024-03-17 Thread via GitHub


Arsnael closed pull request #2115: JAMES-2586 Develocity metrics for postgres 
branch
URL: https://github.com/apache/james-project/pull/2115


-- 
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



Re: [PR] JAMES-2586 Develocity metrics for postgres branch [james-project]

2024-03-17 Thread via GitHub


Arsnael commented on PR #2115:
URL: https://github.com/apache/james-project/pull/2115#issuecomment-2002889733

   Will come when we rebase the branch on master. It filled its purpose, 
closing it.


-- 
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



Re: [PR] Provision Current Quota when MailboxAdded event [james-project]

2024-03-17 Thread via GitHub


Arsnael merged PR #2117:
URL: https://github.com/apache/james-project/pull/2117


-- 
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: Provision Current Quota when MailboxAdded event

2024-03-17 Thread rcordier
This is an automated email from the ASF dual-hosted git repository.

rcordier 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 3bb549a593 Provision Current Quota when MailboxAdded event
3bb549a593 is described below

commit 3bb549a593a1c197063a53c6d48e810ed195c298
Author: vttran 
AuthorDate: Thu Mar 14 13:33:10 2024 +0700

Provision Current Quota when MailboxAdded event
---
 .../store/quota/ListeningCurrentQuotaUpdater.java  | 22 -
 .../quota/ListeningCurrentQuotaUpdaterTest.java| 38 ++
 2 files changed, 59 insertions(+), 1 deletion(-)

diff --git 
a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/ListeningCurrentQuotaUpdater.java
 
b/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/ListeningCurrentQuotaUpdater.java
index e6b158e34c..99062971bc 100644
--- 
a/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/ListeningCurrentQuotaUpdater.java
+++ 
b/mailbox/store/src/main/java/org/apache/james/mailbox/store/quota/ListeningCurrentQuotaUpdater.java
@@ -30,8 +30,10 @@ import org.apache.james.events.EventBus;
 import org.apache.james.events.EventListener;
 import org.apache.james.events.Group;
 import org.apache.james.events.RegistrationKey;
+import org.apache.james.mailbox.events.MailboxEvents;
 import org.apache.james.mailbox.events.MailboxEvents.Added;
 import org.apache.james.mailbox.events.MailboxEvents.Expunged;
+import org.apache.james.mailbox.events.MailboxEvents.MailboxAdded;
 import org.apache.james.mailbox.events.MailboxEvents.MailboxDeletion;
 import org.apache.james.mailbox.events.MailboxEvents.MetaDataHoldingEvent;
 import org.apache.james.mailbox.model.QuotaOperation;
@@ -74,7 +76,10 @@ public class ListeningCurrentQuotaUpdater implements 
EventListener.ReactiveGroup
 
 @Override
 public boolean isHandling(Event event) {
-return event instanceof Added || event instanceof Expunged || event 
instanceof MailboxDeletion;
+return event instanceof Added
+|| event instanceof Expunged
+|| event instanceof MailboxDeletion
+|| event instanceof MailboxAdded;
 }
 
 @Override
@@ -90,6 +95,9 @@ public class ListeningCurrentQuotaUpdater implements 
EventListener.ReactiveGroup
 } else if (event instanceof MailboxDeletion) {
 MailboxDeletion mailboxDeletionEvent = (MailboxDeletion) event;
 return handleMailboxDeletionEvent(mailboxDeletionEvent);
+} else if (event instanceof MailboxAdded) {
+MailboxEvents.MailboxAdded mailboxAdded = 
(MailboxEvents.MailboxAdded) event;
+return handleMailboxAddedEvent(mailboxAdded);
 }
 return Mono.empty();
 }
@@ -149,4 +157,16 @@ public class ListeningCurrentQuotaUpdater implements 
EventListener.ReactiveGroup
 return Mono.empty();
 }
 
+private Mono handleMailboxAddedEvent(MailboxAdded mailboxAdded) {
+return provisionCurrentQuota(mailboxAdded);
+}
+
+private Mono provisionCurrentQuota(MailboxAdded mailboxAdded) {
+return 
Mono.from(quotaRootResolver.getQuotaRootReactive(mailboxAdded.getMailboxPath()))
+.flatMap(quotaRoot -> 
Mono.from(currentQuotaManager.getCurrentQuotas(quotaRoot))
+.map(any -> quotaRoot)
+.switchIfEmpty(Mono.defer(() -> 
Mono.from(currentQuotaManager.setCurrentQuotas(new QuotaOperation(quotaRoot, 
QuotaCountUsage.count(0), QuotaSizeUsage.ZERO)))
+.thenReturn(quotaRoot
+.then();
+}
 }
\ No newline at end of file
diff --git 
a/mailbox/store/src/test/java/org/apache/james/mailbox/store/quota/ListeningCurrentQuotaUpdaterTest.java
 
b/mailbox/store/src/test/java/org/apache/james/mailbox/store/quota/ListeningCurrentQuotaUpdaterTest.java
index bd0c937944..b01935faa1 100644
--- 
a/mailbox/store/src/test/java/org/apache/james/mailbox/store/quota/ListeningCurrentQuotaUpdaterTest.java
+++ 
b/mailbox/store/src/test/java/org/apache/james/mailbox/store/quota/ListeningCurrentQuotaUpdaterTest.java
@@ -42,9 +42,11 @@ import org.apache.james.events.EventBus;
 import org.apache.james.events.Group;
 import org.apache.james.mailbox.MessageUid;
 import org.apache.james.mailbox.ModSeq;
+import org.apache.james.mailbox.events.MailboxEvents;
 import org.apache.james.mailbox.events.MailboxEvents.Added;
 import org.apache.james.mailbox.events.MailboxEvents.Expunged;
 import org.apache.james.mailbox.events.MailboxEvents.MailboxDeletion;
+import org.apache.james.mailbox.model.CurrentQuotas;
 import org.apache.james.mailbox.model.MailboxId;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mailbox.model.MessageMetaData;
@@ -194,4 +196,40 @@ class ListeningCurrentQuotaUpdaterTest {
 
 verifyNoMoreInteractions(mockedCurrentQuotaManager);
 }
+
+@Test
+void 

(james-project) 07/08: JAMES-2586 remove redundant import in PostgresPushSubscriptionSetMethodTest

2024-03-17 Thread rcordier
This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch postgresql
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit b3275a5133724d17428877c014f2956d72b1dedc
Author: hung phan 
AuthorDate: Thu Mar 14 16:40:24 2024 +0700

JAMES-2586 remove redundant import in PostgresPushSubscriptionSetMethodTest
---
 .../jmap/rfc8621/postgres/PostgresPushSubscriptionSetMethodTest.java   | 3 ---
 1 file changed, 3 deletions(-)

diff --git 
a/server/protocols/jmap-rfc-8621-integration-tests/postgres-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/postgres/PostgresPushSubscriptionSetMethodTest.java
 
b/server/protocols/jmap-rfc-8621-integration-tests/postgres-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/postgres/PostgresPushSubscriptionSetMethodTest.java
index 1c743380d5..93696a33db 100644
--- 
a/server/protocols/jmap-rfc-8621-integration-tests/postgres-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/postgres/PostgresPushSubscriptionSetMethodTest.java
+++ 
b/server/protocols/jmap-rfc-8621-integration-tests/postgres-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/postgres/PostgresPushSubscriptionSetMethodTest.java
@@ -21,7 +21,6 @@ package org.apache.james.jmap.rfc8621.postgres;
 
 import static 
org.apache.james.data.UsersRepositoryModuleChooser.Implementation.DEFAULT;
 
-import org.apache.james.GuiceJamesServer;
 import org.apache.james.JamesServerBuilder;
 import org.apache.james.JamesServerExtension;
 import org.apache.james.PostgresJamesConfiguration;
@@ -35,8 +34,6 @@ import 
org.apache.james.jmap.rfc8621.contract.PushSubscriptionSetMethodContract;
 import org.apache.james.modules.RabbitMQExtension;
 import org.apache.james.modules.TestJMAPServerModule;
 import org.apache.james.modules.blobstore.BlobStoreConfiguration;
-import org.junit.jupiter.api.Disabled;
-import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.RegisterExtension;
 
 public class PostgresPushSubscriptionSetMethodTest implements 
PushSubscriptionSetMethodContract {


-
To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org
For additional commands, e-mail: notifications-h...@james.apache.org



(james-project) 06/08: JAMES-2586 Fix PostgresMailboxSetMethodTest

2024-03-17 Thread rcordier
This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch postgresql
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 3ea70f002028c8488ab73ac016eb57e0064c52e6
Author: hung phan 
AuthorDate: Thu Mar 14 16:39:31 2024 +0700

JAMES-2586 Fix PostgresMailboxSetMethodTest
---
 .../jmap/rfc8621/contract/MailboxSetMethodContract.scala   |  1 +
 .../rfc8621/postgres/PostgresMailboxSetMethodTest.java | 14 --
 2 files changed, 1 insertion(+), 14 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/MailboxSetMethodContract.scala
 
b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/MailboxSetMethodContract.scala
index e37fb73aea..9d459620f7 100644
--- 
a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/MailboxSetMethodContract.scala
+++ 
b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/MailboxSetMethodContract.scala
@@ -8169,6 +8169,7 @@ trait MailboxSetMethodContract {
  |}, "c1"]]
  |}""".stripMargin))
 
+ws.receive().asPayload
 List(ws.receive().asPayload)
 })
 .send(backend)
diff --git 
a/server/protocols/jmap-rfc-8621-integration-tests/postgres-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/postgres/PostgresMailboxSetMethodTest.java
 
b/server/protocols/jmap-rfc-8621-integration-tests/postgres-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/postgres/PostgresMailboxSetMethodTest.java
index 20d62878ee..8346421fb1 100644
--- 
a/server/protocols/jmap-rfc-8621-integration-tests/postgres-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/postgres/PostgresMailboxSetMethodTest.java
+++ 
b/server/protocols/jmap-rfc-8621-integration-tests/postgres-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/postgres/PostgresMailboxSetMethodTest.java
@@ -37,20 +37,6 @@ public class PostgresMailboxSetMethodTest extends 
PostgresBase implements Mailbo
 return String.format("%s is not a mailboxId: Invalid UUID string: %s", 
value, value);
 }
 
-@Override
-@Test
-@Disabled
-// TODO Need to fix
-public void 
webSocketShouldPushNewMessageWhenChangeSubscriptionOfMailbox(GuiceJamesServer 
server) {
-}
-
-@Override
-@Test
-@Disabled
-// TODO Need to fix
-public void updateShouldRenameMailboxesWithManyChildren(GuiceJamesServer 
server) {
-}
-
 @Override
 @Test
 @Disabled("Distributed event bus is asynchronous, we cannot expect the 
newState to be returned immediately after Mailbox/set call")


-
To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org
For additional commands, e-mail: notifications-h...@james.apache.org



(james-project) 01/08: JAMES-2586 Add PostgresAttachmentMapper to PostgresMessageIdMapper

2024-03-17 Thread rcordier
This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch postgresql
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit b0334068c6faed5f22125e0b3b1f10741be5c226
Author: hung phan 
AuthorDate: Thu Mar 14 16:14:25 2024 +0700

JAMES-2586 Add PostgresAttachmentMapper to PostgresMessageIdMapper
---
 .../PostgresMailboxSessionMapperFactory.java   |  6 +--
 .../postgres/mail/PostgresAttachmentMapper.java| 14 +++---
 .../postgres/mail/PostgresAttachmentModule.java|  2 +-
 .../postgres/mail/PostgresMessageIdMapper.java | 52 +++---
 .../postgres/mail/dao/PostgresAttachmentDAO.java   | 18 +++-
 .../postgres/DeleteMessageListenerTest.java|  1 -
 .../postgres/DeleteMessageListenerWithRLSTest.java |  1 -
 .../PostgresMailboxManagerAttachmentTest.java  |  4 +-
 .../postgres/mail/PostgresMapperProvider.java  |  9 ++--
 .../PostgresMessageBlobReferenceSourceTest.java|  4 +-
 .../postgres/mail/PostgresMessageMapperTest.java   |  1 +
 ...gresSubscriptionMapperRowLevelSecurityTest.java |  2 +-
 12 files changed, 83 insertions(+), 31 deletions(-)

diff --git 
a/mailbox/postgres/src/main/java/org/apache/james/mailbox/postgres/PostgresMailboxSessionMapperFactory.java
 
b/mailbox/postgres/src/main/java/org/apache/james/mailbox/postgres/PostgresMailboxSessionMapperFactory.java
index 8b9c50118c..f2a7609120 100644
--- 
a/mailbox/postgres/src/main/java/org/apache/james/mailbox/postgres/PostgresMailboxSessionMapperFactory.java
+++ 
b/mailbox/postgres/src/main/java/org/apache/james/mailbox/postgres/PostgresMailboxSessionMapperFactory.java
@@ -43,7 +43,6 @@ import 
org.apache.james.mailbox.postgres.user.PostgresSubscriptionDAO;
 import org.apache.james.mailbox.postgres.user.PostgresSubscriptionMapper;
 import org.apache.james.mailbox.store.MailboxSessionMapperFactory;
 import org.apache.james.mailbox.store.mail.AnnotationMapper;
-import org.apache.james.mailbox.store.mail.AttachmentMapper;
 import org.apache.james.mailbox.store.mail.AttachmentMapperFactory;
 import org.apache.james.mailbox.store.mail.MailboxMapper;
 import org.apache.james.mailbox.store.mail.MessageIdMapper;
@@ -92,6 +91,7 @@ public class PostgresMailboxSessionMapperFactory extends 
MailboxSessionMapperFac
 new 
PostgresMessageDAO(executorFactory.create(session.getUser().getDomainPart()), 
blobIdFactory),
 new 
PostgresMailboxMessageDAO(executorFactory.create(session.getUser().getDomainPart())),
 getModSeqProvider(session),
+getAttachmentMapper(session),
 blobStore,
 blobIdFactory,
 clock);
@@ -118,13 +118,13 @@ public class PostgresMailboxSessionMapperFactory extends 
MailboxSessionMapperFac
 }
 
 @Override
-public AttachmentMapper createAttachmentMapper(MailboxSession session) {
+public PostgresAttachmentMapper createAttachmentMapper(MailboxSession 
session) {
 PostgresAttachmentDAO postgresAttachmentDAO = new 
PostgresAttachmentDAO(executorFactory.create(session.getUser().getDomainPart()),
 blobIdFactory);
 return new PostgresAttachmentMapper(postgresAttachmentDAO, blobStore);
 }
 
 @Override
-public AttachmentMapper getAttachmentMapper(MailboxSession session) {
+public PostgresAttachmentMapper getAttachmentMapper(MailboxSession 
session) {
 return createAttachmentMapper(session);
 }
 
diff --git 
a/mailbox/postgres/src/main/java/org/apache/james/mailbox/postgres/mail/PostgresAttachmentMapper.java
 
b/mailbox/postgres/src/main/java/org/apache/james/mailbox/postgres/mail/PostgresAttachmentMapper.java
index e1d187f236..f1d00421c2 100644
--- 
a/mailbox/postgres/src/main/java/org/apache/james/mailbox/postgres/mail/PostgresAttachmentMapper.java
+++ 
b/mailbox/postgres/src/main/java/org/apache/james/mailbox/postgres/mail/PostgresAttachmentMapper.java
@@ -20,7 +20,6 @@
 package org.apache.james.mailbox.postgres.mail;
 
 import static org.apache.james.blob.api.BlobStore.StoragePolicy.LOW_COST;
-import static org.apache.james.util.ReactorUtils.DEFAULT_CONCURRENCY;
 
 import java.io.InputStream;
 import java.util.Collection;
@@ -39,7 +38,6 @@ import org.apache.james.mailbox.store.mail.AttachmentMapper;
 
 import com.github.fge.lambdas.Throwing;
 import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
 
 import reactor.core.publisher.Flux;
 import reactor.core.publisher.Mono;
@@ -84,13 +82,15 @@ public class PostgresAttachmentMapper implements 
AttachmentMapper {
 .switchIfEmpty(Mono.error(() -> new 
AttachmentNotFoundException(attachmentId.getId(;
 }
 
+public Flux 
getAttachmentsReactive(Collection attachmentIds) {
+Preconditions.checkArgument(attachmentIds != null);
+return postgresAttachmentDAO.getAttachments(attachmentIds);
+}
+
 @Override
 public List getAttachments(Collection 
attachmentIds) {
-

(james-project) 04/08: JAMES-2586 Fix PostgresEmailGetMethodTest

2024-03-17 Thread rcordier
This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch postgresql
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit b71b7e0a99685cee6578360015f0136f5f155c59
Author: hung phan 
AuthorDate: Thu Mar 14 16:38:13 2024 +0700

JAMES-2586 Fix PostgresEmailGetMethodTest
---
 .../apache/james/jmap/rfc8621/contract/EmailGetMethodContract.scala| 2 +-
 .../apache/james/jmap/rfc8621/postgres/PostgresEmailGetMethodTest.java | 3 ---
 2 files changed, 1 insertion(+), 4 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/EmailGetMethodContract.scala
 
b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailGetMethodContract.scala
index 42afe9cbef..0de07c7e2e 100644
--- 
a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailGetMethodContract.scala
+++ 
b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailGetMethodContract.scala
@@ -3769,7 +3769,7 @@ trait EmailGetMethodContract {
  |"charset": "UTF-8",
  |"size": 8,
  |"partId": "1",
- |"blobId": "1_1",
+ |"blobId": "${messageId.serialize}_1",
  |"type": "text/plain"
  |  }
  |}""".stripMargin)
diff --git 
a/server/protocols/jmap-rfc-8621-integration-tests/postgres-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/postgres/PostgresEmailGetMethodTest.java
 
b/server/protocols/jmap-rfc-8621-integration-tests/postgres-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/postgres/PostgresEmailGetMethodTest.java
index 96da1f79ea..43e5c293fc 100644
--- 
a/server/protocols/jmap-rfc-8621-integration-tests/postgres-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/postgres/PostgresEmailGetMethodTest.java
+++ 
b/server/protocols/jmap-rfc-8621-integration-tests/postgres-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/postgres/PostgresEmailGetMethodTest.java
@@ -22,10 +22,7 @@ package org.apache.james.jmap.rfc8621.postgres;
 import org.apache.james.jmap.rfc8621.contract.EmailGetMethodContract;
 import org.apache.james.mailbox.model.MessageId;
 import org.apache.james.mailbox.postgres.PostgresMessageId;
-import org.junit.jupiter.api.Disabled;
 
-@Disabled
-// TODO Need to fix
 public class PostgresEmailGetMethodTest extends PostgresBase implements 
EmailGetMethodContract {
 public static final PostgresMessageId.Factory MESSAGE_ID_FACTORY = new 
PostgresMessageId.Factory();
 


-
To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org
For additional commands, e-mail: notifications-h...@james.apache.org



(james-project) 03/08: JAMES-2586 Optimize AttachmentLoader

2024-03-17 Thread rcordier
This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch postgresql
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 7c538ce49c3203d36b7f1773874901fd90627d37
Author: Tung Tran 
AuthorDate: Wed Mar 6 10:55:47 2024 +0700

JAMES-2586 Optimize AttachmentLoader

- get the list replaced to get each by each
---
 .../mailbox/postgres/mail/AttachmentLoader.java| 24 ++--
 .../postgres/mail/PostgresMessageIdMapper.java | 64 +++---
 .../postgres/mail/dao/PostgresAttachmentDAO.java   |  3 +
 3 files changed, 43 insertions(+), 48 deletions(-)

diff --git 
a/mailbox/postgres/src/main/java/org/apache/james/mailbox/postgres/mail/AttachmentLoader.java
 
b/mailbox/postgres/src/main/java/org/apache/james/mailbox/postgres/mail/AttachmentLoader.java
index 3e2b2b7f11..874d463c2c 100644
--- 
a/mailbox/postgres/src/main/java/org/apache/james/mailbox/postgres/mail/AttachmentLoader.java
+++ 
b/mailbox/postgres/src/main/java/org/apache/james/mailbox/postgres/mail/AttachmentLoader.java
@@ -21,14 +21,21 @@ package org.apache.james.mailbox.postgres.mail;
 
 import static 
org.apache.james.mailbox.postgres.mail.PostgresMessageModule.MessageTable.ATTACHMENT_METADATA;
 
+import java.util.List;
+import java.util.Map;
+
 import org.apache.commons.lang3.tuple.Pair;
+import org.apache.james.mailbox.model.AttachmentId;
 import org.apache.james.mailbox.model.AttachmentMetadata;
 import org.apache.james.mailbox.model.MessageAttachmentMetadata;
+import org.apache.james.mailbox.postgres.mail.dto.AttachmentsDTO;
 import org.apache.james.mailbox.store.mail.MessageMapper;
 import org.apache.james.mailbox.store.mail.model.impl.SimpleMailboxMessage;
 import org.apache.james.util.ReactorUtils;
 import org.jooq.Record;
 
+import com.google.common.collect.ImmutableMap;
+
 import reactor.core.publisher.Flux;
 import reactor.core.publisher.Mono;
 
@@ -45,10 +52,8 @@ public class AttachmentLoader {
 return findMessagePublisher.flatMap(pair -> {
 if (fetchType == MessageMapper.FetchType.FULL || fetchType == 
MessageMapper.FetchType.ATTACHMENTS_METADATA) {
 return Mono.fromCallable(() -> 
pair.getRight().get(ATTACHMENT_METADATA))
-.flatMapMany(Flux::fromIterable)
-.flatMapSequential(attachmentRepresentation -> 
attachmentMapper.getAttachmentReactive(attachmentRepresentation.getAttachmentId())
-.map(attachment -> 
constructMessageAttachment(attachment, attachmentRepresentation)))
-.collectList()
+.map(e -> toMap((AttachmentsDTO) e))
+.flatMap(this::getAttachments)
 .map(messageAttachmentMetadata -> {
 
pair.getLeft().addAttachments(messageAttachmentMetadata);
 return pair;
@@ -59,6 +64,17 @@ public class AttachmentLoader {
 }, ReactorUtils.DEFAULT_CONCURRENCY);
 }
 
+private Map 
toMap(AttachmentsDTO attachmentRepresentations) {
+return 
attachmentRepresentations.stream().collect(ImmutableMap.toImmutableMap(MessageRepresentation.AttachmentRepresentation::getAttachmentId,
 obj -> obj));
+}
+
+private Mono> 
getAttachments(Map 
mapAttachmentIdToAttachmentRepresentation) {
+return 
Mono.fromCallable(mapAttachmentIdToAttachmentRepresentation::keySet)
+.flatMapMany(attachmentMapper::getAttachmentsReactive)
+.map(attachmentMetadata -> 
constructMessageAttachment(attachmentMetadata, 
mapAttachmentIdToAttachmentRepresentation.get(attachmentMetadata.getAttachmentId(
+.collectList();
+}
+
 private MessageAttachmentMetadata 
constructMessageAttachment(AttachmentMetadata attachment, 
MessageRepresentation.AttachmentRepresentation messageAttachmentRepresentation) 
{
 return MessageAttachmentMetadata.builder()
 .attachment(attachment)
diff --git 
a/mailbox/postgres/src/main/java/org/apache/james/mailbox/postgres/mail/PostgresMessageIdMapper.java
 
b/mailbox/postgres/src/main/java/org/apache/james/mailbox/postgres/mail/PostgresMessageIdMapper.java
index 6e9d12fce7..695c066da0 100644
--- 
a/mailbox/postgres/src/main/java/org/apache/james/mailbox/postgres/mail/PostgresMessageIdMapper.java
+++ 
b/mailbox/postgres/src/main/java/org/apache/james/mailbox/postgres/mail/PostgresMessageIdMapper.java
@@ -21,7 +21,6 @@ package org.apache.james.mailbox.postgres.mail;
 
 import static org.apache.james.blob.api.BlobStore.StoragePolicy.LOW_COST;
 import static org.apache.james.blob.api.BlobStore.StoragePolicy.SIZE_BASED;
-import static 
org.apache.james.mailbox.postgres.mail.PostgresMessageModule.MessageTable.ATTACHMENT_METADATA;
 import static 
org.apache.james.mailbox.postgres.mail.PostgresMessageModule.MessageTable.BODY_BLOB_ID;
 import static 
org.apache.james.mailbox.postgres.mail.PostgresMessageModule.MessageTable.HEADER_CONTENT;
 
@@ -29,9 

(james-project) 08/08: JAMES-2586 Remove opensearch in PostgresWebPushTest

2024-03-17 Thread rcordier
This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch postgresql
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 0d75d2065134c6e1bf36b84a8e6cc70828751e6d
Author: hung phan 
AuthorDate: Thu Mar 14 16:41:08 2024 +0700

JAMES-2586 Remove opensearch in PostgresWebPushTest
---
 .../org/apache/james/jmap/rfc8621/postgres/PostgresWebPushTest.java   | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git 
a/server/protocols/jmap-rfc-8621-integration-tests/postgres-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/postgres/PostgresWebPushTest.java
 
b/server/protocols/jmap-rfc-8621-integration-tests/postgres-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/postgres/PostgresWebPushTest.java
index 1849d7994d..919bb3fecd 100644
--- 
a/server/protocols/jmap-rfc-8621-integration-tests/postgres-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/postgres/PostgresWebPushTest.java
+++ 
b/server/protocols/jmap-rfc-8621-integration-tests/postgres-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/postgres/PostgresWebPushTest.java
@@ -22,7 +22,6 @@ package org.apache.james.jmap.rfc8621.postgres;
 import static 
org.apache.james.data.UsersRepositoryModuleChooser.Implementation.DEFAULT;
 
 import org.apache.james.ClockExtension;
-import org.apache.james.DockerOpenSearchExtension;
 import org.apache.james.JamesServerBuilder;
 import org.apache.james.JamesServerExtension;
 import org.apache.james.PostgresJamesConfiguration;
@@ -44,7 +43,7 @@ public class PostgresWebPushTest implements WebPushContract {
 PostgresJamesConfiguration.builder()
 .workingDirectory(tmpDir)
 .configurationFromClasspath()
-.searchConfiguration(SearchConfiguration.openSearch())
+.searchConfiguration(SearchConfiguration.scanning())
 .usersRepository(DEFAULT)
 .eventBusImpl(PostgresJamesConfiguration.EventBusImpl.RABBITMQ)
 .blobStore(BlobStoreConfiguration.builder()
@@ -55,7 +54,6 @@ public class PostgresWebPushTest implements WebPushContract {
 .build())
 .extension(PostgresExtension.empty())
 .extension(new RabbitMQExtension())
-.extension(new DockerOpenSearchExtension())
 .extension(new ClockExtension())
 .server(configuration -> 
PostgresJamesServerMain.createServer(configuration)
 .overrideWith(new TestJMAPServerModule())


-
To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org
For additional commands, e-mail: notifications-h...@james.apache.org



(james-project) 02/08: JAMES-2586 Bind PostgresMessageFastViewProjection

2024-03-17 Thread rcordier
This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch postgresql
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 843aa8463e1d556bddd7eb3a11706cec05d3fd4b
Author: hung phan 
AuthorDate: Thu Mar 14 16:15:15 2024 +0700

JAMES-2586 Bind PostgresMessageFastViewProjection
---
 .../java/org/apache/james/modules/data/PostgresDataJmapModule.java  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/server/container/guice/postgres-common/src/main/java/org/apache/james/modules/data/PostgresDataJmapModule.java
 
b/server/container/guice/postgres-common/src/main/java/org/apache/james/modules/data/PostgresDataJmapModule.java
index 63afa8f77a..b2ffdd3bfe 100644
--- 
a/server/container/guice/postgres-common/src/main/java/org/apache/james/modules/data/PostgresDataJmapModule.java
+++ 
b/server/container/guice/postgres-common/src/main/java/org/apache/james/modules/data/PostgresDataJmapModule.java
@@ -34,11 +34,11 @@ import 
org.apache.james.jmap.api.projections.MessageFastViewProjectionHealthChec
 import org.apache.james.jmap.api.pushsubscription.PushDeleteUserDataTaskStep;
 import org.apache.james.jmap.api.upload.UploadRepository;
 import org.apache.james.jmap.memory.access.MemoryAccessTokenRepository;
-import 
org.apache.james.jmap.memory.projections.MemoryMessageFastViewProjection;
 import org.apache.james.jmap.postgres.filtering.PostgresFilteringProjection;
 import org.apache.james.jmap.postgres.identity.PostgresCustomIdentityDAO;
 import org.apache.james.jmap.postgres.projections.PostgresEmailQueryView;
 import 
org.apache.james.jmap.postgres.projections.PostgresEmailQueryViewManager;
+import 
org.apache.james.jmap.postgres.projections.PostgresMessageFastViewProjection;
 import org.apache.james.jmap.postgres.upload.PostgresUploadRepository;
 import org.apache.james.mailbox.store.extractor.DefaultTextExtractor;
 import org.apache.james.user.api.DeleteUserDataTaskStep;
@@ -67,8 +67,8 @@ public class PostgresDataJmapModule extends AbstractModule {
 
 bind(DefaultTextExtractor.class).in(Scopes.SINGLETON);
 
-bind(MemoryMessageFastViewProjection.class).in(Scopes.SINGLETON);
-
bind(MessageFastViewProjection.class).to(MemoryMessageFastViewProjection.class);
+bind(PostgresMessageFastViewProjection.class).in(Scopes.SINGLETON);
+
bind(MessageFastViewProjection.class).to(PostgresMessageFastViewProjection.class);
 
 bind(PostgresEmailQueryView.class).in(Scopes.SINGLETON);
 bind(EmailQueryView.class).to(PostgresEmailQueryView.class);


-
To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org
For additional commands, e-mail: notifications-h...@james.apache.org



(james-project) 05/08: JAMES-2586 Fix PostgresEmailQueryMethodTest

2024-03-17 Thread rcordier
This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch postgresql
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit bdf92d37b05e028b3447f7249089447cf44d2d41
Author: hung phan 
AuthorDate: Thu Mar 14 16:39:02 2024 +0700

JAMES-2586 Fix PostgresEmailQueryMethodTest
---
 .../contract/EmailQueryMethodContract.scala| 34 ++--
 .../postgres/PostgresEmailQueryMethodTest.java | 61 --
 2 files changed, 76 insertions(+), 19 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/EmailQueryMethodContract.scala
 
b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailQueryMethodContract.scala
index b85a358bcc..c693f4fad7 100644
--- 
a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailQueryMethodContract.scala
+++ 
b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailQueryMethodContract.scala
@@ -55,7 +55,7 @@ import org.apache.james.util.ClassLoaderUtils
 import org.apache.james.utils.DataProbeImpl
 import org.awaitility.Awaitility
 import org.awaitility.Durations.ONE_HUNDRED_MILLISECONDS
-import org.junit.jupiter.api.{BeforeEach, Test}
+import org.junit.jupiter.api.{BeforeEach, RepeatedTest, Test}
 import org.junit.jupiter.params.ParameterizedTest
 import org.junit.jupiter.params.provider.{Arguments, MethodSource, ValueSource}
 import org.threeten.extra.Seconds
@@ -7034,22 +7034,24 @@ trait EmailQueryMethodContract {
  |"c1"]]
  |}""".stripMargin
 
-val response = `given`
-  .header(ACCEPT.toString, ACCEPT_RFC8621_VERSION_HEADER)
-  .body(request)
-.when
-  .post
-.`then`
-  .statusCode(SC_OK)
-  .contentType(JSON)
-  .extract
-  .body
-  .asString
+awaitAtMostTenSeconds.untilAsserted { () =>
+  val response = `given`
+.header(ACCEPT.toString, ACCEPT_RFC8621_VERSION_HEADER)
+.body(request)
+  .when
+.post
+  .`then`
+.statusCode(SC_OK)
+.contentType(JSON)
+.extract
+.body
+.asString
 
-assertThatJson(response)
-  .withOptions(new Options(IGNORING_ARRAY_ORDER))
-  .inPath("$.methodResponses[0][1].ids")
-  .isEqualTo(s"""["${messageId1.serialize}","${messageId2.serialize}"]""")
+  assertThatJson(response)
+.withOptions(new Options(IGNORING_ARRAY_ORDER))
+.inPath("$.methodResponses[0][1].ids")
+
.isEqualTo(s"""["${messageId1.serialize}","${messageId2.serialize}"]""")
+}
   }
 
   @Test
diff --git 
a/server/protocols/jmap-rfc-8621-integration-tests/postgres-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/postgres/PostgresEmailQueryMethodTest.java
 
b/server/protocols/jmap-rfc-8621-integration-tests/postgres-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/postgres/PostgresEmailQueryMethodTest.java
index 3d4c3d336c..9ca92ff0d6 100644
--- 
a/server/protocols/jmap-rfc-8621-integration-tests/postgres-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/postgres/PostgresEmailQueryMethodTest.java
+++ 
b/server/protocols/jmap-rfc-8621-integration-tests/postgres-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/postgres/PostgresEmailQueryMethodTest.java
@@ -19,10 +19,65 @@
 
 package org.apache.james.jmap.rfc8621.postgres;
 
+import static 
org.apache.james.data.UsersRepositoryModuleChooser.Implementation.DEFAULT;
+
+import org.apache.james.DockerOpenSearchExtension;
+import org.apache.james.GuiceJamesServer;
+import org.apache.james.JamesServerBuilder;
+import org.apache.james.JamesServerExtension;
+import org.apache.james.PostgresJamesConfiguration;
+import org.apache.james.PostgresJamesServerMain;
+import org.apache.james.SearchConfiguration;
+import org.apache.james.backends.postgres.PostgresExtension;
 import org.apache.james.jmap.rfc8621.contract.EmailQueryMethodContract;
+import org.apache.james.jmap.rfc8621.contract.IdentityProbeModule;
+import org.apache.james.jmap.rfc8621.contract.probe.DelegationProbeModule;
+import org.apache.james.modules.RabbitMQExtension;
+import org.apache.james.modules.TestJMAPServerModule;
+import org.apache.james.modules.blobstore.BlobStoreConfiguration;
 import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+public class PostgresEmailQueryMethodTest implements EmailQueryMethodContract {
+@RegisterExtension
+static JamesServerExtension testExtension = new 
JamesServerBuilder(tmpDir ->
+

(james-project) branch postgresql updated (8b4f355688 -> 0d75d20651)

2024-03-17 Thread rcordier
This is an automated email from the ASF dual-hosted git repository.

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


from 8b4f355688 JAMES-2586 Reduce repeat count for some JMAP integration 
tests
 new b0334068c6 JAMES-2586 Add PostgresAttachmentMapper to 
PostgresMessageIdMapper
 new 843aa8463e JAMES-2586 Bind PostgresMessageFastViewProjection
 new 7c538ce49c JAMES-2586 Optimize AttachmentLoader
 new b71b7e0a99 JAMES-2586 Fix PostgresEmailGetMethodTest
 new bdf92d37b0 JAMES-2586 Fix PostgresEmailQueryMethodTest
 new 3ea70f0020 JAMES-2586 Fix PostgresMailboxSetMethodTest
 new b3275a5133 JAMES-2586 remove redundant import in 
PostgresPushSubscriptionSetMethodTest
 new 0d75d20651 JAMES-2586 Remove opensearch in PostgresWebPushTest

The 8 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:
 .../PostgresMailboxSessionMapperFactory.java   |  6 +--
 .../mailbox/postgres/mail/AttachmentLoader.java| 24 +++--
 .../postgres/mail/PostgresAttachmentMapper.java| 14 ++---
 .../postgres/mail/PostgresAttachmentModule.java|  2 +-
 .../postgres/mail/PostgresMessageIdMapper.java | 36 +
 .../postgres/mail/dao/PostgresAttachmentDAO.java   | 21 +++-
 .../postgres/DeleteMessageListenerTest.java|  1 -
 .../postgres/DeleteMessageListenerWithRLSTest.java |  1 -
 .../PostgresMailboxManagerAttachmentTest.java  |  4 +-
 .../postgres/mail/PostgresMapperProvider.java  |  9 ++--
 .../PostgresMessageBlobReferenceSourceTest.java|  4 +-
 .../postgres/mail/PostgresMessageMapperTest.java   |  1 +
 ...gresSubscriptionMapperRowLevelSecurityTest.java |  2 +-
 .../james/modules/data/PostgresDataJmapModule.java |  6 +--
 .../rfc8621/contract/EmailGetMethodContract.scala  |  2 +-
 .../contract/EmailQueryMethodContract.scala| 34 ++--
 .../contract/MailboxSetMethodContract.scala|  1 +
 .../postgres/PostgresEmailGetMethodTest.java   |  3 --
 .../postgres/PostgresEmailQueryMethodTest.java | 61 --
 .../postgres/PostgresMailboxSetMethodTest.java | 14 -
 .../PostgresPushSubscriptionSetMethodTest.java |  3 --
 .../jmap/rfc8621/postgres/PostgresWebPushTest.java |  4 +-
 22 files changed, 168 insertions(+), 85 deletions(-)


-
To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org
For additional commands, e-mail: notifications-h...@james.apache.org



Re: [PR] JAMES-2586 Fix PostgresEmailGetMethodTest, PostgresEmailQueryMethodTest, PostgresMailboxSetMethodTest [james-project]

2024-03-17 Thread via GitHub


Arsnael commented on PR #2108:
URL: https://github.com/apache/james-project/pull/2108#issuecomment-2002888193

   Merging this for now, as tickets have been created to tackle the rest.


-- 
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



Re: [PR] JAMES-2586 Fix PostgresEmailGetMethodTest, PostgresEmailQueryMethodTest, PostgresMailboxSetMethodTest [james-project]

2024-03-17 Thread via GitHub


Arsnael merged PR #2108:
URL: https://github.com/apache/james-project/pull/2108


-- 
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: JAMES-4021 Relay for "abc@def"@domain.com

2024-03-17 Thread rcordier
This is an automated email from the ASF dual-hosted git repository.

rcordier 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 c7e8170754 JAMES-4021 Relay for "abc@def"@domain.com
c7e8170754 is described below

commit c7e817075475592b4879fe677d12c803586e6642
Author: Benoit TELLIER 
AuthorDate: Fri Mar 15 16:12:16 2024 +0100

JAMES-4021 Relay for "abc@def"@domain.com
---
 .../rrt/lib/AbstractRecipientRewriteTable.java | 13 -
 .../rrt/lib/RecipientRewriteTableContract.java |  5 
 .../mailets/RecipientRewriteTableProcessor.java| 19 +---
 .../remote/delivery/MailDelivrerToHost.java|  2 +-
 .../james/mock/smtp/server/MockSMTPServerTest.java | 34 ++
 .../org/apache/james/SubAddressingRelayTest.java   | 25 
 6 files changed, 92 insertions(+), 6 deletions(-)

diff --git 
a/server/data/data-library/src/main/java/org/apache/james/rrt/lib/AbstractRecipientRewriteTable.java
 
b/server/data/data-library/src/main/java/org/apache/james/rrt/lib/AbstractRecipientRewriteTable.java
index f7daacbdf9..316e8e4e04 100644
--- 
a/server/data/data-library/src/main/java/org/apache/james/rrt/lib/AbstractRecipientRewriteTable.java
+++ 
b/server/data/data-library/src/main/java/org/apache/james/rrt/lib/AbstractRecipientRewriteTable.java
@@ -109,7 +109,18 @@ public abstract class AbstractRecipientRewriteTable 
implements RecipientRewriteT
 @Override
 public Mappings getResolvedMappings(String user, Domain domain, 
EnumSet mappingTypes) throws ErrorMappingException, 
RecipientRewriteTableException {
 Preconditions.checkState(this.configuration != null, 
"RecipientRewriteTable is not configured");
-return getMappings(Username.fromLocalPartWithDomain(user, domain), 
configuration.getMappingLimit(), mappingTypes);
+return asUsername(user, domain)
+.map(Throwing.function(username -> 
getMappings(username, configuration.getMappingLimit(), 
mappingTypes)).sneakyThrow())
+.orElse(MappingsImpl.empty());
+}
+
+private static Optional asUsername(String user, Domain domain) {
+try {
+return Optional.of(Username.fromLocalPartWithDomain(user, domain));
+} catch (IllegalArgumentException e) {
+LOGGER.info("Valid mail address {}@{} could not be converted into 
a username. Assuming empty mappigns.", user, domain.asString(), e);
+return Optional.empty();
+}
 }
 
 private Mappings getMappings(Username username, int mappingLimit, 
EnumSet mappingTypes) throws ErrorMappingException, 
RecipientRewriteTableException {
diff --git 
a/server/data/data-library/src/test/java/org/apache/james/rrt/lib/RecipientRewriteTableContract.java
 
b/server/data/data-library/src/test/java/org/apache/james/rrt/lib/RecipientRewriteTableContract.java
index fcfb49e4f6..a2767895bf 100644
--- 
a/server/data/data-library/src/test/java/org/apache/james/rrt/lib/RecipientRewriteTableContract.java
+++ 
b/server/data/data-library/src/test/java/org/apache/james/rrt/lib/RecipientRewriteTableContract.java
@@ -104,6 +104,11 @@ public interface RecipientRewriteTableContract {
 assertThat(virtualUserTable().getResolvedMappings("prefix_abc", 
domain)).isNotEmpty();
 }
 
+@Test
+default void testQuotedLocalPart() {
+assertThatCode(() -> virtualUserTable().getResolvedMappings("\"a@b\"", 
Domain.of("test"))).doesNotThrowAnyException();
+}
+
 @Test
 default void notConfiguredResolutionShouldThrow() throws Exception {
 setNotConfiguredRecipientRewriteTable();
diff --git 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RecipientRewriteTableProcessor.java
 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RecipientRewriteTableProcessor.java
index 1e2bd047ea..c5805137f9 100644
--- 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RecipientRewriteTableProcessor.java
+++ 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RecipientRewriteTableProcessor.java
@@ -343,10 +343,21 @@ public class RecipientRewriteTableProcessor {
 }
 
 private ImmutableSet getForwards(MailAddress recipient) throws 
RecipientRewriteTableException {
-return 
virtualTableStore.getStoredMappings(MappingSource.fromMailAddress(recipient))
-.select(Mapping.Type.Forward)
-.asStream()
-.collect(ImmutableSet.toImmutableSet());
+return getSource(recipient)
+.map(Throwing.>function(source -> 
virtualTableStore.getStoredMappings(source)
+.select(Mapping.Type.Forward)
+.asStream()
+.collect(ImmutableSet.toImmutableSet())).sneakyThrow())
+.orElse(ImmutableSet.of());
+}
+
+private static Optional getSource(MailAddress 

Re: [PR] JAMES-4021 Relay for "abc@def"@domain.com [james-project]

2024-03-17 Thread via GitHub


Arsnael merged PR #2124:
URL: https://github.com/apache/james-project/pull/2124


-- 
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



Re: [PR] [FIX] IMAP linearization can be simplified [james-project]

2024-03-17 Thread via GitHub


Arsnael commented on code in PR #2126:
URL: https://github.com/apache/james-project/pull/2126#discussion_r1527746079


##
server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/ImapChannelUpstreamHandler.java:
##
@@ -156,6 +158,11 @@ public ImapChannelUpstreamHandler build() {
 }
 }
 
+static class ImapLineraizer {

Review Comment:
   Typo :) 
   
   ```suggestion
   static class ImapLinearizer {
   ```



##
server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/ImapChannelUpstreamHandler.java:
##
@@ -373,19 +380,28 @@ private void manageUnknownError(ChannelHandlerContext 
ctx) {
 
 @Override
 public void channelRead(ChannelHandlerContext ctx, Object msg) {
+

Review Comment:
   Unecessary?



-- 
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