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 2023/11/20 07:29:50 UTC
(james-project) 01/04: JAMES-2586 Rename SimpleJamesPostgresConnectionFactory -> 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 c0bd7911021886af05d28797e1531ee76456b7a3
Author: Tung Tran <vt...@linagora.com>
AuthorDate: Mon Nov 13 17:23:07 2023 +0700
JAMES-2586 Rename SimpleJamesPostgresConnectionFactory -> DomainImplPostgresConnectionFactory
---
...ctionFactory.java => DomainImplPostgresConnectionFactory.java} | 6 +++---
.../james/backends/postgres/ConnectionThreadSafetyTest.java | 6 +++---
...toryTest.java => DomainImplPostgresConnectionFactoryTest.java} | 8 ++++----
.../apache/james/mailbox/postgres/JpaMailboxManagerProvider.java | 6 ++----
.../james/mailbox/postgres/PostgresSubscriptionManagerTest.java | 4 ++--
.../postgres/mail/PostgresMailboxMapperRowLevelSecurityTest.java | 4 ++--
.../postgres/mail/task/JPARecomputeCurrentQuotasServiceTest.java | 4 ++--
.../user/PostgresSubscriptionMapperRowLevelSecurityTest.java | 4 ++--
.../james/mpt/imapmailbox/postgres/host/PostgresHostSystem.java | 4 ++--
.../java/org/apache/james/modules/data/PostgresCommonModule.java | 6 +++---
10 files changed, 25 insertions(+), 27 deletions(-)
diff --git a/backends-common/postgres/src/main/java/org/apache/james/backends/postgres/utils/SimpleJamesPostgresConnectionFactory.java b/backends-common/postgres/src/main/java/org/apache/james/backends/postgres/utils/DomainImplPostgresConnectionFactory.java
similarity index 94%
rename from backends-common/postgres/src/main/java/org/apache/james/backends/postgres/utils/SimpleJamesPostgresConnectionFactory.java
rename to backends-common/postgres/src/main/java/org/apache/james/backends/postgres/utils/DomainImplPostgresConnectionFactory.java
index 7bd1cf0122..552eae74a8 100644
--- a/backends-common/postgres/src/main/java/org/apache/james/backends/postgres/utils/SimpleJamesPostgresConnectionFactory.java
+++ b/backends-common/postgres/src/main/java/org/apache/james/backends/postgres/utils/DomainImplPostgresConnectionFactory.java
@@ -33,8 +33,8 @@ import io.r2dbc.spi.Connection;
import io.r2dbc.spi.ConnectionFactory;
import reactor.core.publisher.Mono;
-public class SimpleJamesPostgresConnectionFactory implements JamesPostgresConnectionFactory {
- private static final Logger LOGGER = LoggerFactory.getLogger(SimpleJamesPostgresConnectionFactory.class);
+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 = "";
@@ -42,7 +42,7 @@ public class SimpleJamesPostgresConnectionFactory implements JamesPostgresConnec
private final Map<Domain, Connection> mapDomainToConnection = new ConcurrentHashMap<>();
@Inject
- public SimpleJamesPostgresConnectionFactory(ConnectionFactory connectionFactory) {
+ public DomainImplPostgresConnectionFactory(ConnectionFactory connectionFactory) {
this.connectionFactory = connectionFactory;
}
diff --git a/backends-common/postgres/src/test/java/org/apache/james/backends/postgres/ConnectionThreadSafetyTest.java b/backends-common/postgres/src/test/java/org/apache/james/backends/postgres/ConnectionThreadSafetyTest.java
index 80b927a5a2..4cdecdc86d 100644
--- a/backends-common/postgres/src/test/java/org/apache/james/backends/postgres/ConnectionThreadSafetyTest.java
+++ b/backends-common/postgres/src/test/java/org/apache/james/backends/postgres/ConnectionThreadSafetyTest.java
@@ -29,7 +29,7 @@ import java.util.Vector;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Stream;
-import org.apache.james.backends.postgres.utils.SimpleJamesPostgresConnectionFactory;
+import org.apache.james.backends.postgres.utils.DomainImplPostgresConnectionFactory;
import org.apache.james.core.Domain;
import org.apache.james.util.concurrency.ConcurrentTestRunner;
import org.jetbrains.annotations.NotNull;
@@ -60,11 +60,11 @@ public class ConnectionThreadSafetyTest {
static PostgresExtension postgresExtension = PostgresExtension.empty();
private static PostgresqlConnection postgresqlConnection;
- private static SimpleJamesPostgresConnectionFactory jamesPostgresConnectionFactory;
+ private static DomainImplPostgresConnectionFactory jamesPostgresConnectionFactory;
@BeforeAll
static void beforeAll() {
- jamesPostgresConnectionFactory = new SimpleJamesPostgresConnectionFactory(postgresExtension.getConnectionFactory());
+ jamesPostgresConnectionFactory = new DomainImplPostgresConnectionFactory(postgresExtension.getConnectionFactory());
postgresqlConnection = (PostgresqlConnection) postgresExtension.getConnection().block();
}
diff --git a/backends-common/postgres/src/test/java/org/apache/james/backends/postgres/SimpleJamesPostgresConnectionFactoryTest.java b/backends-common/postgres/src/test/java/org/apache/james/backends/postgres/DomainImplPostgresConnectionFactoryTest.java
similarity index 93%
rename from backends-common/postgres/src/test/java/org/apache/james/backends/postgres/SimpleJamesPostgresConnectionFactoryTest.java
rename to backends-common/postgres/src/test/java/org/apache/james/backends/postgres/DomainImplPostgresConnectionFactoryTest.java
index 10d7b8f84e..dc4b320953 100644
--- a/backends-common/postgres/src/test/java/org/apache/james/backends/postgres/SimpleJamesPostgresConnectionFactoryTest.java
+++ b/backends-common/postgres/src/test/java/org/apache/james/backends/postgres/DomainImplPostgresConnectionFactoryTest.java
@@ -29,7 +29,7 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.james.backends.postgres.utils.JamesPostgresConnectionFactory;
-import org.apache.james.backends.postgres.utils.SimpleJamesPostgresConnectionFactory;
+import org.apache.james.backends.postgres.utils.DomainImplPostgresConnectionFactory;
import org.apache.james.core.Domain;
import org.apache.james.util.concurrency.ConcurrentTestRunner;
import org.jetbrains.annotations.Nullable;
@@ -45,12 +45,12 @@ import io.r2dbc.spi.Connection;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
-public class SimpleJamesPostgresConnectionFactoryTest extends JamesPostgresConnectionFactoryTest {
+public class DomainImplPostgresConnectionFactoryTest extends JamesPostgresConnectionFactoryTest {
@RegisterExtension
static PostgresExtension postgresExtension = PostgresExtension.empty();
private PostgresqlConnection postgresqlConnection;
- private SimpleJamesPostgresConnectionFactory jamesPostgresConnectionFactory;
+ private DomainImplPostgresConnectionFactory jamesPostgresConnectionFactory;
JamesPostgresConnectionFactory jamesPostgresConnectionFactory() {
return jamesPostgresConnectionFactory;
@@ -58,7 +58,7 @@ public class SimpleJamesPostgresConnectionFactoryTest extends JamesPostgresConne
@BeforeEach
void beforeEach() {
- jamesPostgresConnectionFactory = new SimpleJamesPostgresConnectionFactory(postgresExtension.getConnectionFactory());
+ jamesPostgresConnectionFactory = new DomainImplPostgresConnectionFactory(postgresExtension.getConnectionFactory());
postgresqlConnection = (PostgresqlConnection) postgresExtension.getConnection().block();
}
diff --git a/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/JpaMailboxManagerProvider.java b/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/JpaMailboxManagerProvider.java
index 9a93f28f23..980804d2cc 100644
--- a/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/JpaMailboxManagerProvider.java
+++ b/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/JpaMailboxManagerProvider.java
@@ -26,7 +26,7 @@ import javax.persistence.EntityManagerFactory;
import org.apache.james.backends.jpa.JPAConfiguration;
import org.apache.james.backends.jpa.JpaTestCluster;
import org.apache.james.backends.postgres.PostgresExtension;
-import org.apache.james.backends.postgres.utils.SimpleJamesPostgresConnectionFactory;
+import org.apache.james.backends.postgres.utils.DomainImplPostgresConnectionFactory;
import org.apache.james.events.EventBusTestFixture;
import org.apache.james.events.InVMEventBus;
import org.apache.james.events.MemoryEventDeadLetters;
@@ -38,8 +38,6 @@ import org.apache.james.mailbox.acl.UnionMailboxACLResolver;
import org.apache.james.mailbox.postgres.mail.JPAModSeqProvider;
import org.apache.james.mailbox.postgres.mail.JPAUidProvider;
import org.apache.james.mailbox.postgres.openjpa.OpenJPAMailboxManager;
-import org.apache.james.mailbox.postgres.JPAAttachmentContentLoader;
-import org.apache.james.mailbox.postgres.PostgresMailboxSessionMapperFactory;
import org.apache.james.mailbox.store.SessionProviderImpl;
import org.apache.james.mailbox.store.StoreMailboxAnnotationManager;
import org.apache.james.mailbox.store.StoreRightManager;
@@ -68,7 +66,7 @@ public class JpaMailboxManagerProvider {
.build();
PostgresMailboxSessionMapperFactory mf = new PostgresMailboxSessionMapperFactory(entityManagerFactory, new JPAUidProvider(entityManagerFactory), new JPAModSeqProvider(entityManagerFactory), jpaConfiguration,
- new SimpleJamesPostgresConnectionFactory(postgresExtension.getConnectionFactory()));
+ new DomainImplPostgresConnectionFactory(postgresExtension.getConnectionFactory()));
MailboxACLResolver aclResolver = new UnionMailboxACLResolver();
MessageParser messageParser = new MessageParser();
diff --git a/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/PostgresSubscriptionManagerTest.java b/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/PostgresSubscriptionManagerTest.java
index 39343b7b1a..ebf07bf37f 100644
--- a/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/PostgresSubscriptionManagerTest.java
+++ b/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/PostgresSubscriptionManagerTest.java
@@ -23,7 +23,7 @@ import javax.persistence.EntityManagerFactory;
import org.apache.james.backends.jpa.JPAConfiguration;
import org.apache.james.backends.jpa.JpaTestCluster;
import org.apache.james.backends.postgres.PostgresExtension;
-import org.apache.james.backends.postgres.utils.SimpleJamesPostgresConnectionFactory;
+import org.apache.james.backends.postgres.utils.DomainImplPostgresConnectionFactory;
import org.apache.james.events.EventBusTestFixture;
import org.apache.james.events.InVMEventBus;
import org.apache.james.events.MemoryEventDeadLetters;
@@ -66,7 +66,7 @@ class PostgresSubscriptionManagerTest implements SubscriptionManagerContract {
new JPAUidProvider(entityManagerFactory),
new JPAModSeqProvider(entityManagerFactory),
jpaConfiguration,
- new SimpleJamesPostgresConnectionFactory(postgresExtension.getConnectionFactory()));
+ new DomainImplPostgresConnectionFactory(postgresExtension.getConnectionFactory()));
InVMEventBus eventBus = new InVMEventBus(new InVmEventDelivery(new RecordingMetricFactory()), EventBusTestFixture.RETRY_BACKOFF_CONFIGURATION, new MemoryEventDeadLetters());
subscriptionManager = new StoreSubscriptionManager(mapperFactory, mapperFactory, eventBus);
}
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 2233e24b65..3eb23fe07e 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,8 +22,8 @@ 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.backends.postgres.utils.SimpleJamesPostgresConnectionFactory;
import org.apache.james.core.Username;
import org.apache.james.mailbox.MailboxSession;
import org.apache.james.mailbox.MailboxSessionUtil;
@@ -45,7 +45,7 @@ public class PostgresMailboxMapperRowLevelSecurityTest {
@BeforeEach
public void setUp() {
mailboxMapperFactory = session -> new PostgresMailboxMapper(new PostgresMailboxDAO(new PostgresExecutor(
- new SimpleJamesPostgresConnectionFactory(postgresExtension.getConnectionFactory())
+ new DomainImplPostgresConnectionFactory(postgresExtension.getConnectionFactory())
.getConnection(session.getUser().getDomainPart()))));
}
diff --git a/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/mail/task/JPARecomputeCurrentQuotasServiceTest.java b/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/mail/task/JPARecomputeCurrentQuotasServiceTest.java
index 10a76bae46..ca3b89df12 100644
--- a/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/mail/task/JPARecomputeCurrentQuotasServiceTest.java
+++ b/mailbox/postgres/src/test/java/org/apache/james/mailbox/postgres/mail/task/JPARecomputeCurrentQuotasServiceTest.java
@@ -25,7 +25,7 @@ import org.apache.commons.configuration2.BaseHierarchicalConfiguration;
import org.apache.james.backends.jpa.JPAConfiguration;
import org.apache.james.backends.jpa.JpaTestCluster;
import org.apache.james.backends.postgres.PostgresExtension;
-import org.apache.james.backends.postgres.utils.SimpleJamesPostgresConnectionFactory;
+import org.apache.james.backends.postgres.utils.DomainImplPostgresConnectionFactory;
import org.apache.james.domainlist.api.DomainList;
import org.apache.james.domainlist.jpa.model.JPADomain;
import org.apache.james.mailbox.MailboxManager;
@@ -89,7 +89,7 @@ class JPARecomputeCurrentQuotasServiceTest implements RecomputeCurrentQuotasServ
new JPAUidProvider(entityManagerFactory),
new JPAModSeqProvider(entityManagerFactory),
jpaConfiguration,
- new SimpleJamesPostgresConnectionFactory(postgresExtension.getConnectionFactory()));
+ new DomainImplPostgresConnectionFactory(postgresExtension.getConnectionFactory()));
usersRepository = new JPAUsersRepository(NO_DOMAIN_LIST);
usersRepository.setEntityManagerFactory(JPA_TEST_CLUSTER.getEntityManagerFactory());
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 69dc70eddb..b9c1c2caa0 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
@@ -23,7 +23,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import org.apache.james.backends.postgres.PostgresExtension;
import org.apache.james.backends.postgres.utils.PostgresExecutor;
-import org.apache.james.backends.postgres.utils.SimpleJamesPostgresConnectionFactory;
+import org.apache.james.backends.postgres.utils.DomainImplPostgresConnectionFactory;
import org.apache.james.core.Username;
import org.apache.james.mailbox.MailboxSession;
import org.apache.james.mailbox.MailboxSessionUtil;
@@ -42,7 +42,7 @@ public class PostgresSubscriptionMapperRowLevelSecurityTest {
@BeforeEach
public void setUp() {
subscriptionMapperFactory = session -> new PostgresSubscriptionMapper(new PostgresSubscriptionDAO(new PostgresExecutor(
- new SimpleJamesPostgresConnectionFactory(postgresExtension.getConnectionFactory())
+ new DomainImplPostgresConnectionFactory(postgresExtension.getConnectionFactory())
.getConnection(session.getUser().getDomainPart()))));
}
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 06da403d78..5c98591f0e 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
@@ -26,8 +26,8 @@ import javax.persistence.EntityManagerFactory;
import org.apache.james.backends.jpa.JPAConfiguration;
import org.apache.james.backends.jpa.JpaTestCluster;
import org.apache.james.backends.postgres.PostgresExtension;
+import org.apache.james.backends.postgres.utils.DomainImplPostgresConnectionFactory;
import org.apache.james.backends.postgres.utils.JamesPostgresConnectionFactory;
-import org.apache.james.backends.postgres.utils.SimpleJamesPostgresConnectionFactory;
import org.apache.james.core.quota.QuotaCountLimit;
import org.apache.james.core.quota.QuotaSizeLimit;
import org.apache.james.events.EventBusTestFixture;
@@ -106,7 +106,7 @@ public class PostgresHostSystem extends JamesImapHostSystem {
public void beforeAll() {
Preconditions.checkNotNull(postgresExtension.getConnectionFactory());
- postgresConnectionFactory = new SimpleJamesPostgresConnectionFactory(postgresExtension.getConnectionFactory());
+ postgresConnectionFactory = new DomainImplPostgresConnectionFactory(postgresExtension.getConnectionFactory());
}
@Override
diff --git a/server/container/guice/postgres-common/src/main/java/org/apache/james/modules/data/PostgresCommonModule.java b/server/container/guice/postgres-common/src/main/java/org/apache/james/modules/data/PostgresCommonModule.java
index b95a1fdf01..f8508438c4 100644
--- a/server/container/guice/postgres-common/src/main/java/org/apache/james/modules/data/PostgresCommonModule.java
+++ b/server/container/guice/postgres-common/src/main/java/org/apache/james/modules/data/PostgresCommonModule.java
@@ -28,7 +28,7 @@ import org.apache.james.backends.postgres.PostgresConfiguration;
import org.apache.james.backends.postgres.PostgresModule;
import org.apache.james.backends.postgres.PostgresTableManager;
import org.apache.james.backends.postgres.utils.JamesPostgresConnectionFactory;
-import org.apache.james.backends.postgres.utils.SimpleJamesPostgresConnectionFactory;
+import org.apache.james.backends.postgres.utils.DomainImplPostgresConnectionFactory;
import org.apache.james.utils.InitializationOperation;
import org.apache.james.utils.InitilizationOperationBuilder;
import org.apache.james.utils.PropertiesProvider;
@@ -46,11 +46,11 @@ import io.r2dbc.spi.ConnectionFactory;
public class PostgresCommonModule extends AbstractModule {
@Override
public void configure() {
- bind(JamesPostgresConnectionFactory.class).to(SimpleJamesPostgresConnectionFactory.class);
+ bind(JamesPostgresConnectionFactory.class).to(DomainImplPostgresConnectionFactory.class);
Multibinder.newSetBinder(binder(), PostgresModule.class);
- bind(SimpleJamesPostgresConnectionFactory.class).in(Scopes.SINGLETON);
+ bind(DomainImplPostgresConnectionFactory.class).in(Scopes.SINGLETON);
}
@Provides
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org