You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by rc...@apache.org on 2024/06/24 07:54:25 UTC
(james-project) 03/05: JAMES-2586 Drop DomainImplPostgresConnectionFactory
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 bad825d2876fd5721553aa4ec7747135e7af0f30
Author: vttran <vt...@linagora.com>
AuthorDate: Thu Jun 13 13:38:46 2024 +0700
JAMES-2586 Drop DomainImplPostgresConnectionFactory
---
.../utils/DomainImplPostgresConnectionFactory.java | 105 ---------------
.../DomainImplPostgresConnectionFactoryTest.java | 148 ---------------------
...stgresAnnotationMapperRowLevelSecurityTest.java | 10 +-
.../PostgresMailboxMapperRowLevelSecurityTest.java | 6 +-
.../PostgresMessageMapperRowLevelSecurityTest.java | 6 +-
...gresSubscriptionMapperRowLevelSecurityTest.java | 5 +-
.../postgres/host/PostgresHostSystemExtension.java | 2 +-
.../upload/PostgresUploadRepositoryTest.java | 2 +-
.../postgres/upload/PostgresUploadServiceTest.java | 4 +-
9 files changed, 11 insertions(+), 277 deletions(-)
diff --git a/backends-common/postgres/src/main/java/org/apache/james/backends/postgres/utils/DomainImplPostgresConnectionFactory.java b/backends-common/postgres/src/main/java/org/apache/james/backends/postgres/utils/DomainImplPostgresConnectionFactory.java
deleted file mode 100644
index f69dd77569..0000000000
--- a/backends-common/postgres/src/main/java/org/apache/james/backends/postgres/utils/DomainImplPostgresConnectionFactory.java
+++ /dev/null
@@ -1,105 +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.backends.postgres.utils;
-
-import java.util.Map;
-import java.util.Optional;
-import java.util.concurrent.ConcurrentHashMap;
-
-import jakarta.inject.Inject;
-
-import org.apache.james.core.Domain;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import io.r2dbc.spi.Connection;
-import io.r2dbc.spi.ConnectionFactory;
-import reactor.core.publisher.Flux;
-import reactor.core.publisher.Mono;
-
-public class DomainImplPostgresConnectionFactory implements JamesPostgresConnectionFactory {
- private static final Logger LOGGER = LoggerFactory.getLogger(DomainImplPostgresConnectionFactory.class);
- private static final Domain DEFAULT = Domain.of("default");
- private static final String DEFAULT_DOMAIN_ATTRIBUTE_VALUE = "";
-
- private final ConnectionFactory connectionFactory;
- private final Map<Domain, Connection> mapDomainToConnection = new ConcurrentHashMap<>();
-
- @Inject
- public DomainImplPostgresConnectionFactory(ConnectionFactory connectionFactory) {
- this.connectionFactory = connectionFactory;
- }
-
- @Override
- public Mono<Connection> getConnection(Optional<Domain> maybeDomain) {
- return maybeDomain.map(this::getConnectionForDomain)
- .orElse(getConnectionForDomain(DEFAULT));
- }
-
- @Override
- public Mono<Void> closeConnection(Connection connection) {
- return Mono.empty();
- }
-
- @Override
- public Mono<Void> close() {
- return Flux.fromIterable(mapDomainToConnection.values())
- .flatMap(connection -> Mono.from(connection.close()))
- .then();
- }
-
- private Mono<Connection> getConnectionForDomain(Domain domain) {
- return Mono.just(domain)
- .flatMap(domainValue -> Mono.fromCallable(() -> mapDomainToConnection.get(domainValue))
- .switchIfEmpty(create(domainValue)));
- }
-
- private Mono<Connection> create(Domain domain) {
- return Mono.from(connectionFactory.create())
- .doOnError(e -> LOGGER.error("Error while creating connection for domain {}", domain, e))
- .flatMap(newConnection -> getAndSetConnection(domain, newConnection));
- }
-
- private Mono<Connection> getAndSetConnection(Domain domain, Connection newConnection) {
- return Mono.fromCallable(() -> mapDomainToConnection.putIfAbsent(domain, newConnection))
- .map(postgresqlConnection -> {
- //close redundant connection
- Mono.from(newConnection.close())
- .doOnError(e -> LOGGER.error("Error while closing connection for domain {}", domain, e))
- .subscribe();
- return postgresqlConnection;
- }).switchIfEmpty(setDomainAttributeForConnection(domain, newConnection));
- }
-
- private Mono<Connection> setDomainAttributeForConnection(Domain domain, Connection newConnection) {
- return Mono.from(newConnection.createStatement("SET " + DOMAIN_ATTRIBUTE + " TO '" + getDomainAttributeValue(domain) + "'") // It should be set value via Bind, but it doesn't work
- .execute())
- .doOnError(e -> LOGGER.error("Error while setting domain attribute for domain {}", domain, e))
- .then(Mono.just(newConnection));
- }
-
- private String getDomainAttributeValue(Domain domain) {
- if (DEFAULT.equals(domain)) {
- return DEFAULT_DOMAIN_ATTRIBUTE_VALUE;
- } else {
- return domain.asString();
- }
- }
-}
diff --git a/backends-common/postgres/src/test/java/org/apache/james/backends/postgres/DomainImplPostgresConnectionFactoryTest.java b/backends-common/postgres/src/test/java/org/apache/james/backends/postgres/DomainImplPostgresConnectionFactoryTest.java
deleted file mode 100644
index ec79ba3d23..0000000000
--- a/backends-common/postgres/src/test/java/org/apache/james/backends/postgres/DomainImplPostgresConnectionFactoryTest.java
+++ /dev/null
@@ -1,148 +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.backends.postgres;
-
-import static org.apache.james.backends.postgres.PostgresFixture.Database.DEFAULT_DATABASE;
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.net.URISyntaxException;
-import java.time.Duration;
-import java.util.Optional;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.james.backends.postgres.utils.DomainImplPostgresConnectionFactory;
-import org.apache.james.backends.postgres.utils.JamesPostgresConnectionFactory;
-import org.apache.james.core.Domain;
-import org.apache.james.util.concurrency.ConcurrentTestRunner;
-import org.jetbrains.annotations.Nullable;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
-
-import com.google.common.collect.ImmutableList;
-
-import io.r2dbc.postgresql.api.PostgresqlConnection;
-import io.r2dbc.spi.Connection;
-import reactor.core.publisher.Flux;
-import reactor.core.publisher.Mono;
-
-public class DomainImplPostgresConnectionFactoryTest extends JamesPostgresConnectionFactoryTest {
- @RegisterExtension
- static PostgresExtension postgresExtension = PostgresExtension.empty();
-
- private PostgresqlConnection postgresqlConnection;
- private DomainImplPostgresConnectionFactory jamesPostgresConnectionFactory;
-
- JamesPostgresConnectionFactory jamesPostgresConnectionFactory() {
- return jamesPostgresConnectionFactory;
- }
-
- @BeforeEach
- void beforeEach() {
- jamesPostgresConnectionFactory = new DomainImplPostgresConnectionFactory(postgresExtension.getConnectionFactory());
- postgresqlConnection = (PostgresqlConnection) postgresExtension.getConnection().block();
- }
-
- @AfterEach
- void afterEach() throws URISyntaxException {
- postgresExtension.restartContainer();
- }
-
- @Test
- void factoryShouldCreateCorrectNumberOfConnections() {
- Integer previousDbActiveNumberOfConnections = getNumberOfConnections();
-
- // create 50 connections
- Flux.range(1, 50)
- .flatMap(i -> jamesPostgresConnectionFactory.getConnection(Domain.of("james" + i)))
- .last()
- .block();
-
- Integer dbActiveNumberOfConnections = getNumberOfConnections();
-
- assertThat(dbActiveNumberOfConnections - previousDbActiveNumberOfConnections).isEqualTo(50);
- }
-
- @Nullable
- private Integer getNumberOfConnections() {
- return Mono.from(postgresqlConnection.createStatement("SELECT count(*) from pg_stat_activity where usename = $1;")
- .bind("$1", DEFAULT_DATABASE.dbUser())
- .execute()).flatMap(result -> Mono.from(result.map((row, rowMetadata) -> row.get(0, Integer.class)))).block();
- }
-
- @Test
- void factoryShouldNotCreateNewConnectionWhenDomainsAreTheSame() {
- Domain domain = Domain.of("james");
- Connection connectionOne = jamesPostgresConnectionFactory.getConnection(domain).block();
- Connection connectionTwo = jamesPostgresConnectionFactory.getConnection(domain).block();
-
- assertThat(connectionOne == connectionTwo).isTrue();
- }
-
- @Test
- void factoryShouldCreateNewConnectionWhenDomainsAreDifferent() {
- Connection connectionOne = jamesPostgresConnectionFactory.getConnection(Domain.of("james")).block();
- Connection connectionTwo = jamesPostgresConnectionFactory.getConnection(Domain.of("lin")).block();
-
- String domainOne = getDomainAttributeValue(connectionOne);
-
- String domainTwo = Flux.from(connectionTwo.createStatement("show " + JamesPostgresConnectionFactory.DOMAIN_ATTRIBUTE)
- .execute())
- .flatMap(result -> result.map((row, rowMetadata) -> row.get(0, String.class)))
- .collect(ImmutableList.toImmutableList())
- .block().get(0);
-
- assertThat(connectionOne).isNotEqualTo(connectionTwo);
- assertThat(domainOne).isNotEqualTo(domainTwo);
- }
-
- @Test
- void factoryShouldNotCreateNewConnectionWhenDomainsAreTheSameAndRequestsAreFromDifferentThreads() throws Exception {
- Set<Connection> connectionSet = ConcurrentHashMap.newKeySet();
-
- ConcurrentTestRunner.builder()
- .reactorOperation((threadNumber, step) -> jamesPostgresConnectionFactory.getConnection(Domain.of("james"))
- .doOnNext(connectionSet::add)
- .then())
- .threadCount(50)
- .operationCount(10)
- .runSuccessfullyWithin(Duration.ofMinutes(1));
-
- assertThat(connectionSet).hasSize(1);
- }
-
- @Test
- void factoryShouldCreateOnlyOneDefaultConnection() throws Exception {
- Set<Connection> connectionSet = ConcurrentHashMap.newKeySet();
-
- ConcurrentTestRunner.builder()
- .reactorOperation((threadNumber, step) -> jamesPostgresConnectionFactory.getConnection(Optional.empty())
- .doOnNext(connectionSet::add)
- .then())
- .threadCount(50)
- .operationCount(10)
- .runSuccessfullyWithin(Duration.ofMinutes(1));
-
- assertThat(connectionSet).hasSize(1);
- }
-
-}
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 f23a8c031f..f75f4ecaac 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
@@ -24,7 +24,6 @@ import static org.assertj.core.api.Assertions.assertThat;
import java.time.Instant;
import org.apache.james.backends.postgres.PostgresExtension;
-import org.apache.james.backends.postgres.utils.DomainImplPostgresConnectionFactory;
import org.apache.james.backends.postgres.utils.PostgresExecutor;
import org.apache.james.blob.api.BlobId;
import org.apache.james.blob.api.BucketName;
@@ -42,7 +41,6 @@ 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.MailboxMapper;
-import org.apache.james.metrics.tests.RecordingMetricFactory;
import org.apache.james.server.blob.deduplication.DeDuplicationBlobStore;
import org.apache.james.utils.UpdatableTickingClock;
import org.junit.jupiter.api.BeforeEach;
@@ -51,7 +49,7 @@ import org.junit.jupiter.api.extension.RegisterExtension;
public class PostgresAnnotationMapperRowLevelSecurityTest {
private static final UidValidity UID_VALIDITY = UidValidity.of(42);
- private static final Username BENWA = Username.of("benwa");
+ private static final Username BENWA = Username.of("benwa@localhost");
protected static final MailboxPath benwaInboxPath = MailboxPath.forUser(BENWA, "INBOX");
private static final MailboxSession aliceSession = MailboxSessionUtil.create(Username.of("alice@domain1"));
private static final MailboxSession bobSession = MailboxSessionUtil.create(Username.of("bob@domain1"));
@@ -66,15 +64,15 @@ public class PostgresAnnotationMapperRowLevelSecurityTest {
private MailboxId mailboxId;
private MailboxId generateMailboxId() {
- MailboxMapper mailboxMapper = new PostgresMailboxMapper(new PostgresMailboxDAO(postgresExtension.getPostgresExecutor()));
+ PostgresExecutor postgresExecutor = postgresExtension.getExecutorFactory().create(BENWA.getDomainPart());
+ MailboxMapper mailboxMapper = new PostgresMailboxMapper(new PostgresMailboxDAO(postgresExecutor));
return mailboxMapper.create(benwaInboxPath, UID_VALIDITY).block().getMailboxId();
}
@BeforeEach
public void setUp() {
BlobId.Factory blobIdFactory = new HashBlobId.Factory();
- postgresMailboxSessionMapperFactory = new PostgresMailboxSessionMapperFactory(new PostgresExecutor.Factory(new DomainImplPostgresConnectionFactory(postgresExtension.getConnectionFactory()),
- postgresExtension.getPostgresConfiguration(), new RecordingMetricFactory()),
+ postgresMailboxSessionMapperFactory = new PostgresMailboxSessionMapperFactory(postgresExtension.getExecutorFactory(),
new UpdatableTickingClock(Instant.now()),
new DeDuplicationBlobStore(new MemoryBlobStoreDAO(), BucketName.DEFAULT, blobIdFactory),
blobIdFactory);
diff --git a/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/mail/PostgresMailboxMapperRowLevelSecurityTest.java b/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/mail/PostgresMailboxMapperRowLevelSecurityTest.java
index cfc7dcc1d1..0d841de578 100644
--- a/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/mail/PostgresMailboxMapperRowLevelSecurityTest.java
+++ b/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/mail/PostgresMailboxMapperRowLevelSecurityTest.java
@@ -22,7 +22,6 @@ package org.apache.james.mailbox.postgres.mail;
import static org.assertj.core.api.Assertions.assertThat;
import org.apache.james.backends.postgres.PostgresExtension;
-import org.apache.james.backends.postgres.utils.DomainImplPostgresConnectionFactory;
import org.apache.james.backends.postgres.utils.PostgresExecutor;
import org.apache.james.core.Username;
import org.apache.james.mailbox.MailboxSession;
@@ -31,7 +30,6 @@ import org.apache.james.mailbox.model.MailboxPath;
import org.apache.james.mailbox.model.UidValidity;
import org.apache.james.mailbox.postgres.mail.dao.PostgresMailboxDAO;
import org.apache.james.mailbox.store.mail.MailboxMapperFactory;
-import org.apache.james.metrics.tests.RecordingMetricFactory;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
@@ -45,9 +43,7 @@ public class PostgresMailboxMapperRowLevelSecurityTest {
@BeforeEach
public void setUp() {
- PostgresExecutor.Factory executorFactory = new PostgresExecutor.Factory(new DomainImplPostgresConnectionFactory(postgresExtension.getConnectionFactory()),
- postgresExtension.getPostgresConfiguration(),
- new RecordingMetricFactory());
+ PostgresExecutor.Factory executorFactory = postgresExtension.getExecutorFactory();
mailboxMapperFactory = session -> new PostgresMailboxMapper(new PostgresMailboxDAO(executorFactory.create(session.getUser().getDomainPart())));
}
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 55743bafb6..1b248de56c 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
@@ -27,8 +27,6 @@ import java.util.Date;
import jakarta.mail.Flags;
import org.apache.james.backends.postgres.PostgresExtension;
-import org.apache.james.backends.postgres.utils.DomainImplPostgresConnectionFactory;
-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.HashBlobId;
@@ -50,7 +48,6 @@ import org.apache.james.mailbox.store.mail.MailboxMapper;
import org.apache.james.mailbox.store.mail.model.MailboxMessage;
import org.apache.james.mailbox.store.mail.model.impl.PropertyBuilder;
import org.apache.james.mailbox.store.mail.model.impl.SimpleMailboxMessage;
-import org.apache.james.metrics.tests.RecordingMetricFactory;
import org.apache.james.server.blob.deduplication.DeDuplicationBlobStore;
import org.apache.james.utils.UpdatableTickingClock;
import org.junit.jupiter.api.BeforeEach;
@@ -80,8 +77,7 @@ public class PostgresMessageMapperRowLevelSecurityTest {
@BeforeEach
public void setUp() {
BlobId.Factory blobIdFactory = new HashBlobId.Factory();
- postgresMailboxSessionMapperFactory = new PostgresMailboxSessionMapperFactory(new PostgresExecutor.Factory(new DomainImplPostgresConnectionFactory(postgresExtension.getConnectionFactory()),
- postgresExtension.getPostgresConfiguration(), new RecordingMetricFactory()),
+ postgresMailboxSessionMapperFactory = new PostgresMailboxSessionMapperFactory(postgresExtension.getExecutorFactory(),
new UpdatableTickingClock(Instant.now()),
new DeDuplicationBlobStore(new MemoryBlobStoreDAO(), BucketName.DEFAULT, blobIdFactory),
blobIdFactory);
diff --git a/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/user/PostgresSubscriptionMapperRowLevelSecurityTest.java b/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/user/PostgresSubscriptionMapperRowLevelSecurityTest.java
index a28bd34087..a1db7adcd1 100644
--- a/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/user/PostgresSubscriptionMapperRowLevelSecurityTest.java
+++ b/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/user/PostgresSubscriptionMapperRowLevelSecurityTest.java
@@ -22,14 +22,12 @@ package org.apache.james.mailbox.postgres.user;
import static org.assertj.core.api.Assertions.assertThat;
import org.apache.james.backends.postgres.PostgresExtension;
-import org.apache.james.backends.postgres.utils.DomainImplPostgresConnectionFactory;
import org.apache.james.backends.postgres.utils.PostgresExecutor;
import org.apache.james.core.Username;
import org.apache.james.mailbox.MailboxSession;
import org.apache.james.mailbox.MailboxSessionUtil;
import org.apache.james.mailbox.store.user.SubscriptionMapperFactory;
import org.apache.james.mailbox.store.user.model.Subscription;
-import org.apache.james.metrics.tests.RecordingMetricFactory;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
@@ -42,8 +40,7 @@ public class PostgresSubscriptionMapperRowLevelSecurityTest {
@BeforeEach
public void setUp() {
- PostgresExecutor.Factory executorFactory = new PostgresExecutor.Factory(new DomainImplPostgresConnectionFactory(postgresExtension.getConnectionFactory()),
- postgresExtension.getPostgresConfiguration(), new RecordingMetricFactory());
+ PostgresExecutor.Factory executorFactory = postgresExtension.getExecutorFactory();
subscriptionMapperFactory = session -> new PostgresSubscriptionMapper(new PostgresSubscriptionDAO(executorFactory.create(session.getUser().getDomainPart())));
}
diff --git a/mpt/impl/imap-mailbox/postgres/src/test/java/org/apache/james/mpt/imapmailbox/postgres/host/PostgresHostSystemExtension.java b/mpt/impl/imap-mailbox/postgres/src/test/java/org/apache/james/mpt/imapmailbox/postgres/host/PostgresHostSystemExtension.java
index c3f3f16360..9e53890c03 100644
--- a/mpt/impl/imap-mailbox/postgres/src/test/java/org/apache/james/mpt/imapmailbox/postgres/host/PostgresHostSystemExtension.java
+++ b/mpt/impl/imap-mailbox/postgres/src/test/java/org/apache/james/mpt/imapmailbox/postgres/host/PostgresHostSystemExtension.java
@@ -38,7 +38,7 @@ public class PostgresHostSystemExtension implements BeforeEachCallback, AfterEac
private final PostgresExtension postgresExtension;
public PostgresHostSystemExtension() {
- this.postgresExtension = PostgresExtension.withRowLevelSecurity(PostgresModule.aggregateModules(
+ this.postgresExtension = PostgresExtension.withoutRowLevelSecurity(PostgresModule.aggregateModules(
PostgresMailboxAggregateModule.MODULE,
PostgresQuotaModule.MODULE));
try {
diff --git a/server/data/data-jmap-postgres/src/test/java/org/apache/james/jmap/postgres/upload/PostgresUploadRepositoryTest.java b/server/data/data-jmap-postgres/src/test/java/org/apache/james/jmap/postgres/upload/PostgresUploadRepositoryTest.java
index e8738bcb8c..c9876fe423 100644
--- a/server/data/data-jmap-postgres/src/test/java/org/apache/james/jmap/postgres/upload/PostgresUploadRepositoryTest.java
+++ b/server/data/data-jmap-postgres/src/test/java/org/apache/james/jmap/postgres/upload/PostgresUploadRepositoryTest.java
@@ -37,7 +37,7 @@ import org.junit.jupiter.api.extension.RegisterExtension;
class PostgresUploadRepositoryTest implements UploadRepositoryContract {
@RegisterExtension
- static PostgresExtension postgresExtension = PostgresExtension.withRowLevelSecurity(
+ static PostgresExtension postgresExtension = PostgresExtension.withoutRowLevelSecurity(
PostgresModule.aggregateModules(PostgresUploadModule.MODULE));
private UploadRepository testee;
private UpdatableTickingClock clock;
diff --git a/server/data/data-jmap-postgres/src/test/java/org/apache/james/jmap/postgres/upload/PostgresUploadServiceTest.java b/server/data/data-jmap-postgres/src/test/java/org/apache/james/jmap/postgres/upload/PostgresUploadServiceTest.java
index 2884acd333..86a1608485 100644
--- a/server/data/data-jmap-postgres/src/test/java/org/apache/james/jmap/postgres/upload/PostgresUploadServiceTest.java
+++ b/server/data/data-jmap-postgres/src/test/java/org/apache/james/jmap/postgres/upload/PostgresUploadServiceTest.java
@@ -41,7 +41,7 @@ import org.junit.jupiter.api.extension.RegisterExtension;
public class PostgresUploadServiceTest implements UploadServiceContract {
@RegisterExtension
- static PostgresExtension postgresExtension = PostgresExtension.withRowLevelSecurity(
+ static PostgresExtension postgresExtension = PostgresExtension.withoutRowLevelSecurity(
PostgresModule.aggregateModules(PostgresUploadModule.MODULE, PostgresQuotaModule.MODULE));
private PostgresUploadRepository uploadRepository;
@@ -54,7 +54,7 @@ public class PostgresUploadServiceTest implements UploadServiceContract {
BlobStore blobStore = new DeDuplicationBlobStore(new MemoryBlobStoreDAO(), BucketName.DEFAULT, blobIdFactory);
PostgresUploadDAO uploadDAO = new PostgresUploadDAO(postgresExtension.getNonRLSPostgresExecutor(), blobIdFactory);
PostgresUploadDAO.Factory uploadFactory = new PostgresUploadDAO.Factory(blobIdFactory, postgresExtension.getExecutorFactory());
- uploadRepository = new PostgresUploadRepository( blobStore, Clock.systemUTC(),uploadFactory, uploadDAO);
+ uploadRepository = new PostgresUploadRepository(blobStore, Clock.systemUTC(), uploadFactory, uploadDAO);
uploadUsageRepository = new PostgresUploadUsageRepository(new PostgresQuotaCurrentValueDAO(postgresExtension.getPostgresExecutor()));
testee = new UploadServiceDefaultImpl(uploadRepository, uploadUsageRepository, UploadServiceContract.TEST_CONFIGURATION());
}
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org