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 bab8374d89 [Postgres] More coherence in some tests (#2649)
bab8374d89 is described below
commit bab8374d890f8f0208c952da6e66824a962d7024
Author: Rene Cordier <[email protected]>
AuthorDate: Thu Feb 27 09:00:34 2025 +0700
[Postgres] More coherence in some tests (#2649)
---
.../apache/james/mailbox/postgres/DeleteMessageListenerTest.java | 3 +--
.../james/mailbox/postgres/DeleteMessageListenerWithRLSTest.java | 3 +--
.../mailbox/postgres/PostgresMailboxManagerAttachmentTest.java | 3 +--
.../james/mailbox/postgres/PostgresMailboxManagerProvider.java | 3 +--
.../apache/james/mailbox/postgres/PostgresTestSystemFixture.java | 3 +--
.../mail/PostgresAnnotationMapperRowLevelSecurityTest.java | 8 ++------
.../postgres/mail/PostgresMessageMapperRowLevelSecurityTest.java | 6 ++----
.../james/mpt/imapmailbox/postgres/host/PostgresHostSystem.java | 3 +--
8 files changed, 10 insertions(+), 22 deletions(-)
diff --git
a/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/DeleteMessageListenerTest.java
b/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/DeleteMessageListenerTest.java
index 7f69049374..6426633b3d 100644
---
a/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/DeleteMessageListenerTest.java
+++
b/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/DeleteMessageListenerTest.java
@@ -24,7 +24,6 @@ import static
org.apache.james.mailbox.postgres.PostgresMailboxManagerProvider.B
import java.time.Clock;
import java.time.Instant;
-import org.apache.james.backends.postgres.PostgresConfiguration;
import org.apache.james.backends.postgres.PostgresExtension;
import org.apache.james.blob.api.BlobStore;
import org.apache.james.blob.api.BucketName;
@@ -72,7 +71,7 @@ public class DeleteMessageListenerTest extends
DeleteMessageListenerContract {
Clock.systemUTC(),
blobStore,
BLOB_ID_FACTORY,
-
PostgresConfiguration.builder().username("a").password("a").build(),
+ postgresExtension.getPostgresConfiguration(),
new AttachmentIdAssignationStrategy.Default(new
StringBackedAttachmentIdFactory()));
MailboxACLResolver aclResolver = new UnionMailboxACLResolver();
diff --git
a/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/DeleteMessageListenerWithRLSTest.java
b/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/DeleteMessageListenerWithRLSTest.java
index fcaf010f44..4091a8efab 100644
---
a/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/DeleteMessageListenerWithRLSTest.java
+++
b/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/DeleteMessageListenerWithRLSTest.java
@@ -25,7 +25,6 @@ import java.time.Clock;
import java.time.Instant;
import java.util.UUID;
-import org.apache.james.backends.postgres.PostgresConfiguration;
import org.apache.james.backends.postgres.PostgresExtension;
import org.apache.james.blob.api.BlobId;
import org.apache.james.blob.api.BlobStore;
@@ -78,7 +77,7 @@ public class DeleteMessageListenerWithRLSTest extends
DeleteMessageListenerContr
Clock.systemUTC(),
blobStore,
blobIdFactory,
-
PostgresConfiguration.builder().username("a").password("a").build(),
+ postgresExtension.getPostgresConfiguration(),
new AttachmentIdAssignationStrategy.Default(new
StringBackedAttachmentIdFactory()));
MailboxACLResolver aclResolver = new UnionMailboxACLResolver();
diff --git
a/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/PostgresMailboxManagerAttachmentTest.java
b/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/PostgresMailboxManagerAttachmentTest.java
index 01a742b0f4..b9fd57d790 100644
---
a/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/PostgresMailboxManagerAttachmentTest.java
+++
b/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/PostgresMailboxManagerAttachmentTest.java
@@ -27,7 +27,6 @@ import java.io.InputStream;
import java.time.Clock;
import java.time.Instant;
-import org.apache.james.backends.postgres.PostgresConfiguration;
import org.apache.james.backends.postgres.PostgresExtension;
import org.apache.james.blob.api.BlobId;
import org.apache.james.blob.api.BucketName;
@@ -86,7 +85,7 @@ public class PostgresMailboxManagerAttachmentTest extends
AbstractMailboxManager
BlobId.Factory blobIdFactory = new PlainBlobId.Factory();
DeDuplicationBlobStore blobStore = new DeDuplicationBlobStore(new
MemoryBlobStoreDAO(), BucketName.DEFAULT, blobIdFactory);
mapperFactory = new
PostgresMailboxSessionMapperFactory(postgresExtension.getExecutorFactory(),
Clock.systemUTC(), blobStore, blobIdFactory,
-
PostgresConfiguration.builder().username("a").password("a").build(),
+ postgresExtension.getPostgresConfiguration(),
new AttachmentIdAssignationStrategy.Default(new
StringBackedAttachmentIdFactory()));
MailboxACLResolver aclResolver = new UnionMailboxACLResolver();
diff --git
a/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/PostgresMailboxManagerProvider.java
b/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/PostgresMailboxManagerProvider.java
index 5f240eb843..3ffcf74a3e 100644
---
a/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/PostgresMailboxManagerProvider.java
+++
b/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/PostgresMailboxManagerProvider.java
@@ -22,7 +22,6 @@ package org.apache.james.mailbox.postgres;
import java.time.Clock;
import java.time.Instant;
-import org.apache.james.backends.postgres.PostgresConfiguration;
import org.apache.james.backends.postgres.PostgresExtension;
import org.apache.james.blob.api.BlobId;
import org.apache.james.blob.api.BucketName;
@@ -101,7 +100,7 @@ public class PostgresMailboxManagerProvider {
Clock.systemUTC(),
blobStore,
blobIdFactory,
-
PostgresConfiguration.builder().username("a").password("a").build(),
+ postgresExtension.getPostgresConfiguration(),
new AttachmentIdAssignationStrategy.Default(new
StringBackedAttachmentIdFactory()));
}
diff --git
a/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/PostgresTestSystemFixture.java
b/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/PostgresTestSystemFixture.java
index 5ec675380b..b2f7569c0f 100644
---
a/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/PostgresTestSystemFixture.java
+++
b/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/PostgresTestSystemFixture.java
@@ -24,7 +24,6 @@ import static org.mockito.Mockito.mock;
import java.time.Clock;
import java.time.Instant;
-import org.apache.james.backends.postgres.PostgresConfiguration;
import org.apache.james.backends.postgres.PostgresExtension;
import org.apache.james.backends.postgres.quota.PostgresQuotaCurrentValueDAO;
import org.apache.james.backends.postgres.quota.PostgresQuotaLimitDAO;
@@ -72,7 +71,7 @@ public class PostgresTestSystemFixture {
DeDuplicationBlobStore blobStore = new DeDuplicationBlobStore(new
MemoryBlobStoreDAO(), BucketName.DEFAULT, blobIdFactory);
return new
PostgresMailboxSessionMapperFactory(postgresExtension.getExecutorFactory(),
Clock.systemUTC(), blobStore, blobIdFactory,
-
PostgresConfiguration.builder().username("a").password("a").build(),
+ postgresExtension.getPostgresConfiguration(),
new AttachmentIdAssignationStrategy.Default(new
StringBackedAttachmentIdFactory()));
}
diff --git
a/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/mail/PostgresAnnotationMapperRowLevelSecurityTest.java
b/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/mail/PostgresAnnotationMapperRowLevelSecurityTest.java
index a9badec7f1..0541e5016c 100644
---
a/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/mail/PostgresAnnotationMapperRowLevelSecurityTest.java
+++
b/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/mail/PostgresAnnotationMapperRowLevelSecurityTest.java
@@ -23,9 +23,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import java.time.Instant;
-import org.apache.james.backends.postgres.PostgresConfiguration;
import org.apache.james.backends.postgres.PostgresExtension;
-import org.apache.james.backends.postgres.utils.PostgresExecutor;
import org.apache.james.blob.api.BlobId;
import org.apache.james.blob.api.BucketName;
import org.apache.james.blob.api.PlainBlobId;
@@ -41,7 +39,6 @@ import org.apache.james.mailbox.model.MailboxPath;
import org.apache.james.mailbox.model.UidValidity;
import org.apache.james.mailbox.postgres.PostgresMailboxAggregateModule;
import org.apache.james.mailbox.postgres.PostgresMailboxSessionMapperFactory;
-import org.apache.james.mailbox.postgres.mail.dao.PostgresMailboxDAO;
import org.apache.james.mailbox.store.mail.AttachmentIdAssignationStrategy;
import org.apache.james.mailbox.store.mail.MailboxMapper;
import org.apache.james.server.blob.deduplication.DeDuplicationBlobStore;
@@ -67,8 +64,7 @@ public class PostgresAnnotationMapperRowLevelSecurityTest {
private MailboxId mailboxId;
private MailboxId generateMailboxId() {
- PostgresExecutor postgresExecutor =
postgresExtension.getExecutorFactory().create(BENWA.getDomainPart());
- MailboxMapper mailboxMapper = new PostgresMailboxMapper(new
PostgresMailboxDAO(postgresExecutor));
+ MailboxMapper mailboxMapper =
postgresMailboxSessionMapperFactory.getMailboxMapper(aliceSession);
return mailboxMapper.create(benwaInboxPath,
UID_VALIDITY).block().getMailboxId();
}
@@ -79,7 +75,7 @@ public class PostgresAnnotationMapperRowLevelSecurityTest {
new UpdatableTickingClock(Instant.now()),
new DeDuplicationBlobStore(new MemoryBlobStoreDAO(),
BucketName.DEFAULT, blobIdFactory),
blobIdFactory,
-
PostgresConfiguration.builder().username("a").password("a").build(),
+ postgresExtension.getPostgresConfiguration(),
new AttachmentIdAssignationStrategy.Default(new
StringBackedAttachmentIdFactory()));
mailboxId = generateMailboxId();
diff --git
a/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/mail/PostgresMessageMapperRowLevelSecurityTest.java
b/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/mail/PostgresMessageMapperRowLevelSecurityTest.java
index c1c9d4451d..9bd2e92c21 100644
---
a/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/mail/PostgresMessageMapperRowLevelSecurityTest.java
+++
b/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/mail/PostgresMessageMapperRowLevelSecurityTest.java
@@ -26,7 +26,6 @@ import java.util.Date;
import jakarta.mail.Flags;
-import org.apache.james.backends.postgres.PostgresConfiguration;
import org.apache.james.backends.postgres.PostgresExtension;
import org.apache.james.blob.api.BlobId;
import org.apache.james.blob.api.BucketName;
@@ -45,7 +44,6 @@ import org.apache.james.mailbox.model.UidValidity;
import org.apache.james.mailbox.postgres.PostgresMailboxAggregateModule;
import org.apache.james.mailbox.postgres.PostgresMailboxSessionMapperFactory;
import org.apache.james.mailbox.postgres.PostgresMessageId;
-import org.apache.james.mailbox.postgres.mail.dao.PostgresMailboxDAO;
import org.apache.james.mailbox.store.mail.AttachmentIdAssignationStrategy;
import org.apache.james.mailbox.store.mail.MailboxMapper;
import org.apache.james.mailbox.store.mail.model.MailboxMessage;
@@ -73,7 +71,7 @@ public class PostgresMessageMapperRowLevelSecurityTest {
private Mailbox mailbox;
private Mailbox generateMailbox() {
- MailboxMapper mailboxMapper = new PostgresMailboxMapper(new
PostgresMailboxDAO(postgresExtension.getDefaultPostgresExecutor()));
+ MailboxMapper mailboxMapper =
postgresMailboxSessionMapperFactory.getMailboxMapper(aliceSession);
return mailboxMapper.create(benwaInboxPath, UID_VALIDITY).block();
}
@@ -84,7 +82,7 @@ public class PostgresMessageMapperRowLevelSecurityTest {
new UpdatableTickingClock(Instant.now()),
new DeDuplicationBlobStore(new MemoryBlobStoreDAO(),
BucketName.DEFAULT, blobIdFactory),
blobIdFactory,
-
PostgresConfiguration.builder().username("a").password("a").build(),
+ postgresExtension.getPostgresConfiguration(),
new AttachmentIdAssignationStrategy.Default(new
StringBackedAttachmentIdFactory()));
mailbox = generateMailbox();
diff --git
a/mpt/impl/imap-mailbox/postgres/src/test/java/org/apache/james/mpt/imapmailbox/postgres/host/PostgresHostSystem.java
b/mpt/impl/imap-mailbox/postgres/src/test/java/org/apache/james/mpt/imapmailbox/postgres/host/PostgresHostSystem.java
index 5a272a67b9..bfcf7eee91 100644
---
a/mpt/impl/imap-mailbox/postgres/src/test/java/org/apache/james/mpt/imapmailbox/postgres/host/PostgresHostSystem.java
+++
b/mpt/impl/imap-mailbox/postgres/src/test/java/org/apache/james/mpt/imapmailbox/postgres/host/PostgresHostSystem.java
@@ -22,7 +22,6 @@ package org.apache.james.mpt.imapmailbox.postgres.host;
import java.time.Clock;
import java.time.Instant;
-import org.apache.james.backends.postgres.PostgresConfiguration;
import org.apache.james.backends.postgres.PostgresExtension;
import org.apache.james.backends.postgres.quota.PostgresQuotaCurrentValueDAO;
import org.apache.james.backends.postgres.quota.PostgresQuotaLimitDAO;
@@ -114,7 +113,7 @@ public class PostgresHostSystem extends JamesImapHostSystem
{
DeDuplicationBlobStore blobStore = new DeDuplicationBlobStore(new
MemoryBlobStoreDAO(), BucketName.DEFAULT, blobIdFactory);
PostgresMailboxSessionMapperFactory mapperFactory = new
PostgresMailboxSessionMapperFactory(postgresExtension.getExecutorFactory(),
Clock.systemUTC(), blobStore, blobIdFactory,
-
PostgresConfiguration.builder().username("a").password("a").build(),
+ postgresExtension.getPostgresConfiguration(),
new AttachmentIdAssignationStrategy.Default(new
StringBackedAttachmentIdFactory()));
MailboxACLResolver aclResolver = new UnionMailboxACLResolver();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]