Re: [PR] JAMES-2586 Implement PoolBackedPostgresConnectionFactory [james-project]
hungphan227 commented on code in PR #2190: URL: https://github.com/apache/james-project/pull/2190#discussion_r1568191076 ## backends-common/postgres/src/main/java/org/apache/james/backends/postgres/utils/PoolBackedPostgresConnectionFactory.java: ## @@ -0,0 +1,93 @@ +/ + * 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.time.Duration; +import java.util.Optional; + +import org.apache.james.core.Domain; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import io.r2dbc.pool.ConnectionPool; +import io.r2dbc.pool.ConnectionPoolConfiguration; +import io.r2dbc.spi.Connection; +import io.r2dbc.spi.ConnectionFactory; +import reactor.core.publisher.Mono; + +public class PoolBackedPostgresConnectionFactory implements JamesPostgresConnectionFactory { Review Comment: Move this issue to another ticket https://github.com/linagora/james-project/issues/5166 -- 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
[PR] JAMES-4031 Add configuration tests for RabbitMQ cluster usage [james-project]
quantranhong1999 opened a new pull request, #2206: URL: https://github.com/apache/james-project/pull/2206 Actually, we supported the case with the `hosts` configuration. -- 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 postgresql updated (2afd8618ec -> 2f1f036a81)
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 2afd8618ec JAMES-2586 [UPDATE] [PGSQL] more javax APIs migrated to jakarta new 921e6017db [BUILD] Jenkinsfile - add module server/blob/blob-postgres new 2f1f036a81 JAMES-2586 Disable some unstable tests of PostgresBlobStoreDAOTest The 2 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: Jenkinsfile | 1 + .../org/apache/james/blob/postgres/PostgresBlobStoreDAOTest.java | 9 + 2 files changed, 10 insertions(+) - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
Re: [PR] [BUILD] Jenkinsfile - add module server/blob/blob-postgres [james-project]
Arsnael merged PR #2200: URL: https://github.com/apache/james-project/pull/2200 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
(james-project) 02/02: JAMES-2586 Disable some unstable tests of PostgresBlobStoreDAOTest
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 2f1f036a8144bb96fde682f881bcb376a9e3c512 Author: Tung Tran AuthorDate: Mon Apr 15 09:45:05 2024 +0700 JAMES-2586 Disable some unstable tests of PostgresBlobStoreDAOTest --- .../org/apache/james/blob/postgres/PostgresBlobStoreDAOTest.java | 9 + 1 file changed, 9 insertions(+) diff --git a/server/blob/blob-postgres/src/test/java/org/apache/james/blob/postgres/PostgresBlobStoreDAOTest.java b/server/blob/blob-postgres/src/test/java/org/apache/james/blob/postgres/PostgresBlobStoreDAOTest.java index 7ef69a0390..1c2e8bcbef 100644 --- a/server/blob/blob-postgres/src/test/java/org/apache/james/blob/postgres/PostgresBlobStoreDAOTest.java +++ b/server/blob/blob-postgres/src/test/java/org/apache/james/blob/postgres/PostgresBlobStoreDAOTest.java @@ -68,5 +68,14 @@ class PostgresBlobStoreDAOTest implements BlobStoreDAOContract { public void mixingSaveReadAndDeleteShouldReturnConsistentState() { } +@Override +@Disabled("The test is not valid because the upload parallelism with big blobs takes time and the test does not waiting for the end of the upload") +public void readShouldNotReadPartiallyWhenDeletingConcurrentlyBigBlob() { +} + +@Override +@Disabled("The test is not valid because the upload parallelism with big blobs takes time and the test does not waiting for the end of the upload") +public void readBytesShouldNotReadPartiallyWhenDeletingConcurrentlyBigBlob() { +} } - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
(james-project) 01/02: JAMES-4028 MailImpl: More compact version of Mail.getName
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 commit d09b3cb23470dd096608ea84a4d027efbb36c570 Author: Benoit TELLIER AuthorDate: Mon Apr 15 16:14:01 2024 +0200 JAMES-4028 MailImpl: More compact version of Mail.getName On a production system we encountered a JMAP query for which the clause count of OpenSearch (- 1024) was exceeded. This commit makes sure that it is not linked to the overall right filtering strategy pushing the mailboxes to search in onto the search query. --- .../core/src/main/java/org/apache/james/server/core/MailImpl.java | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/container/core/src/main/java/org/apache/james/server/core/MailImpl.java b/server/container/core/src/main/java/org/apache/james/server/core/MailImpl.java index fd6fd0d3a2..d1c5aa74c8 100644 --- a/server/container/core/src/main/java/org/apache/james/server/core/MailImpl.java +++ b/server/container/core/src/main/java/org/apache/james/server/core/MailImpl.java @@ -44,6 +44,7 @@ import jakarta.mail.internet.MimeMessage; import jakarta.mail.internet.ParseException; import org.apache.commons.lang3.RandomStringUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; import org.apache.james.core.MailAddress; import org.apache.james.core.MaybeSender; @@ -323,7 +324,7 @@ public class MailImpl implements Disposable, Mail { @VisibleForTesting static String deriveNewName(String currentName) throws MessagingException { char separator = '!'; int loopThreshold = 7; -int suffixLength = 9; +int suffixLength = 5; int suffixMaxLength = loopThreshold * suffixLength; int nameMaxLength = suffixMaxLength + 13; @@ -342,7 +343,7 @@ public class MailImpl implements Disposable, Mail { } private static String generateRandomSuffix(int suffixLength, char separator) { -return "-" + separator + RandomStringUtils.randomNumeric(suffixLength - 2); +return separator + RandomStringUtils.randomAlphanumeric(suffixLength - 1); } private static void detectPossibleLoop(String currentName, int loopThreshold, char separator) throws MessagingException { @@ -788,7 +789,7 @@ public class MailImpl implements Disposable, Mail { * @return the new identifier */ public static String getId() { -return "Mail" + System.currentTimeMillis() + "-" + UUID.randomUUID(); +return "Mail" + System.currentTimeMillis() + "-" + RandomStringUtils.randomAlphanumeric(20); } @Override - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
(james-project) branch master updated (854e8d9a5a -> 143dc949fa)
This is an automated email from the ASF dual-hosted git repository. rcordier pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git from 854e8d9a5a JAMES-3498 Modify the access for CassandraEventDeadLetters, CassandraEventDeadLettersDAO new d09b3cb234 JAMES-4028 MailImpl: More compact version of Mail.getName new 143dc949fa JAMES-4028 MailImpl: More compact version of Mail.getName The 2 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: .../core/src/main/java/org/apache/james/server/core/MailImpl.java | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
(james-project) 02/02: JAMES-4028 MailImpl: More compact version of Mail.getName
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 commit 143dc949fad03ab9ced0d518aeba6de4edd68a77 Author: Benoit TELLIER AuthorDate: Mon Apr 15 21:43:51 2024 +0200 JAMES-4028 MailImpl: More compact version of Mail.getName On a production system we encountered a JMAP query for which the clause count of OpenSearch (- 1024) was exceeded. This commit makes sure that it is not linked to the overall right filtering strategy pushing the mailboxes to search in onto the search query. --- .../core/src/main/java/org/apache/james/server/core/MailImpl.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/server/container/core/src/main/java/org/apache/james/server/core/MailImpl.java b/server/container/core/src/main/java/org/apache/james/server/core/MailImpl.java index d1c5aa74c8..6f2a24c736 100644 --- a/server/container/core/src/main/java/org/apache/james/server/core/MailImpl.java +++ b/server/container/core/src/main/java/org/apache/james/server/core/MailImpl.java @@ -31,7 +31,6 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.UUID; import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -44,7 +43,6 @@ import jakarta.mail.internet.MimeMessage; import jakarta.mail.internet.ParseException; import org.apache.commons.lang3.RandomStringUtils; -import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; import org.apache.james.core.MailAddress; import org.apache.james.core.MaybeSender; - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
(james-project) 01/02: [BUILD] Jenkinsfile - add module server/blob/blob-postgres
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 921e6017db7f8eafd4db1a56aa1e3dc318c3d72e Author: Tung Tran AuthorDate: Mon Apr 15 09:44:25 2024 +0700 [BUILD] Jenkinsfile - add module server/blob/blob-postgres --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 1299da2b91..8dce5e1b27 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -41,6 +41,7 @@ pipeline { POSTGRES_MODULES = 'backends-common/postgres,' + 'mailbox/postgres,' + +'server/blob/blob-postgres,' + 'server/data/data-postgres,' + 'server/data/data-jmap-postgres,' + 'server/container/guice/postgres-common,' + - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
Re: [PR] JAMES-4028 MailImpl: More compact version of Mail.getName [james-project]
Arsnael merged PR #2201: URL: https://github.com/apache/james-project/pull/2201 -- 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] [EXPERIMENT] JAMES-2586 Implement PoolBackedPostgresConnectionFactory [james-project]
Arsnael commented on PR #2190: URL: https://github.com/apache/james-project/pull/2190#issuecomment-2060239534 @hungphan227 can you take care of remaining comments please? -- 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-3498 Modify the access for CassandraEventDeadLetters, CassandraEventDeadLettersDAO
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 854e8d9a5a JAMES-3498 Modify the access for CassandraEventDeadLetters, CassandraEventDeadLettersDAO 854e8d9a5a is described below commit 854e8d9a5a0153a80a946433b748ac8250ff22e7 Author: Tung Tran AuthorDate: Tue Apr 16 18:06:19 2024 +0700 JAMES-3498 Modify the access for CassandraEventDeadLetters, CassandraEventDeadLettersDAO Make it public for easy create manually by constructor via Guice --- .../main/java/org/apache/james/events/CassandraEventDeadLetters.java | 4 ++-- .../java/org/apache/james/events/CassandraEventDeadLettersDAO.java| 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/event-bus/cassandra/src/main/java/org/apache/james/events/CassandraEventDeadLetters.java b/event-bus/cassandra/src/main/java/org/apache/james/events/CassandraEventDeadLetters.java index 2a0828f80a..63699ac9a6 100644 --- a/event-bus/cassandra/src/main/java/org/apache/james/events/CassandraEventDeadLetters.java +++ b/event-bus/cassandra/src/main/java/org/apache/james/events/CassandraEventDeadLetters.java @@ -32,8 +32,8 @@ public class CassandraEventDeadLetters implements EventDeadLetters { private final CassandraEventDeadLettersGroupDAO cassandraEventDeadLettersGroupDAO; @Inject -CassandraEventDeadLetters(CassandraEventDeadLettersDAO cassandraEventDeadLettersDAO, - CassandraEventDeadLettersGroupDAO cassandraEventDeadLettersGroupDAO) { +public CassandraEventDeadLetters(CassandraEventDeadLettersDAO cassandraEventDeadLettersDAO, + CassandraEventDeadLettersGroupDAO cassandraEventDeadLettersGroupDAO) { this.cassandraEventDeadLettersDAO = cassandraEventDeadLettersDAO; this.cassandraEventDeadLettersGroupDAO = cassandraEventDeadLettersGroupDAO; } diff --git a/event-bus/cassandra/src/main/java/org/apache/james/events/CassandraEventDeadLettersDAO.java b/event-bus/cassandra/src/main/java/org/apache/james/events/CassandraEventDeadLettersDAO.java index a60e21b437..4014caa13d 100644 --- a/event-bus/cassandra/src/main/java/org/apache/james/events/CassandraEventDeadLettersDAO.java +++ b/event-bus/cassandra/src/main/java/org/apache/james/events/CassandraEventDeadLettersDAO.java @@ -49,7 +49,7 @@ public class CassandraEventDeadLettersDAO { private final PreparedStatement containEventsStatement; @Inject -CassandraEventDeadLettersDAO(CqlSession session, EventSerializer eventSerializer) { +public CassandraEventDeadLettersDAO(CqlSession session, EventSerializer eventSerializer) { this.executor = new CassandraAsyncExecutor(session); this.eventSerializer = eventSerializer; this.insertStatement = prepareInsertStatement(session); - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
Re: [PR] JAMES-3498 Modify the access for CassandraEventDeadLetters, CassandraEventDeadLettersDAO [james-project]
Arsnael merged PR #2205: URL: https://github.com/apache/james-project/pull/2205 -- 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] [EXPERIMENT] JAMES-2586 Implement PoolBackedPostgresConnectionFactory [james-project]
chibenwa commented on code in PR #2190: URL: https://github.com/apache/james-project/pull/2190#discussion_r1567202422 ## server/container/guice/postgres-common/src/main/java/org/apache/james/modules/data/PostgresCommonModule.java: ## @@ -76,14 +76,14 @@ PostgresConfiguration provideConfiguration(PropertiesProvider propertiesProvider @Singleton JamesPostgresConnectionFactory provideJamesPostgresConnectionFactory(PostgresConfiguration postgresConfiguration, ConnectionFactory connectionFactory, - @Named(JamesPostgresConnectionFactory.NON_RLS_INJECT) JamesPostgresConnectionFactory singlePostgresConnectionFactory) { + @Named(JamesPostgresConnectionFactory.NON_RLS_INJECT) JamesPostgresConnectionFactory jamesPostgresConnectionFactory) { if (postgresConfiguration.rowLevelSecurityEnabled()) { LOGGER.info("PostgreSQL row level security enabled"); -LOGGER.info("Implementation for PostgreSQL connection factory: {}", DomainImplPostgresConnectionFactory.class.getName()); -return new DomainImplPostgresConnectionFactory(connectionFactory); +LOGGER.info("Implementation for PostgreSQL connection factory: {}", PoolBackedPostgresConnectionFactory.class.getName()); +return new PoolBackedPostgresConnectionFactory(true, connectionFactory); } -LOGGER.info("Implementation for PostgreSQL connection factory: {}", SinglePostgresConnectionFactory.class.getName()); -return singlePostgresConnectionFactory; +LOGGER.info("Implementation for PostgreSQL connection factory: {}", PoolBackedPostgresConnectionFactory.class.getName()); +return new PoolBackedPostgresConnectionFactory(false, connectionFactory); Review Comment: As far as I can tell, comment is not handled. -- 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] [EXPERIMENT] JAMES-2586 Implement PoolBackedPostgresConnectionFactory [james-project]
chibenwa commented on code in PR #2190: URL: https://github.com/apache/james-project/pull/2190#discussion_r1567201565 ## backends-common/postgres/src/main/java/org/apache/james/backends/postgres/utils/PoolBackedPostgresConnectionFactory.java: ## @@ -0,0 +1,93 @@ +/ + * 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.time.Duration; +import java.util.Optional; + +import org.apache.james.core.Domain; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import io.r2dbc.pool.ConnectionPool; +import io.r2dbc.pool.ConnectionPoolConfiguration; +import io.r2dbc.spi.Connection; +import io.r2dbc.spi.ConnectionFactory; +import reactor.core.publisher.Mono; + +public class PoolBackedPostgresConnectionFactory implements JamesPostgresConnectionFactory { +private static final Logger LOGGER = LoggerFactory.getLogger(PoolBackedPostgresConnectionFactory.class); +private static final Domain DEFAULT = Domain.of("default"); +private static final String DEFAULT_DOMAIN_ATTRIBUTE_VALUE = ""; +private static final int INITIAL_SIZE = 10; +private static final int MAX_SIZE = 20; +private static final Duration MAX_IDLE_TIME = Duration.ofMillis(5000); + +private final boolean rowLevelSecurityEnabled; +private final ConnectionPool pool; + +public PoolBackedPostgresConnectionFactory(boolean rowLevelSecurityEnabled, Optional maxSize, ConnectionFactory connectionFactory) { +this.rowLevelSecurityEnabled = rowLevelSecurityEnabled; +final ConnectionPoolConfiguration configuration = ConnectionPoolConfiguration.builder(connectionFactory) Review Comment: We tend generally not to make the code unreadable with final variables as we never reassign variables in the first place. -- 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
[PR] JAMES-3498 Modify the access for CassandraEventDeadLetters, CassandraEventDeadLettersDAO [james-project]
vttranlina opened a new pull request, #2205: URL: https://github.com/apache/james-project/pull/2205 Make it public for easy create manually by the constructor via Guice -- 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] [EXPERIMENT] JAMES-2586 Implement PoolBackedPostgresConnectionFactory [james-project]
hungphan227 commented on code in PR #2190: URL: https://github.com/apache/james-project/pull/2190#discussion_r1567118794 ## backends-common/postgres/src/main/java/org/apache/james/backends/postgres/utils/PoolBackedPostgresConnectionFactory.java: ## @@ -0,0 +1,93 @@ +/ + * 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.time.Duration; +import java.util.Optional; + +import org.apache.james.core.Domain; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import io.r2dbc.pool.ConnectionPool; +import io.r2dbc.pool.ConnectionPoolConfiguration; +import io.r2dbc.spi.Connection; +import io.r2dbc.spi.ConnectionFactory; +import reactor.core.publisher.Mono; + +public class PoolBackedPostgresConnectionFactory implements JamesPostgresConnectionFactory { +private static final Logger LOGGER = LoggerFactory.getLogger(PoolBackedPostgresConnectionFactory.class); +private static final Domain DEFAULT = Domain.of("default"); +private static final String DEFAULT_DOMAIN_ATTRIBUTE_VALUE = ""; +private static final int INITIAL_SIZE = 10; +private static final int MAX_SIZE = 20; +private static final Duration MAX_IDLE_TIME = Duration.ofMillis(5000); + +private final boolean rowLevelSecurityEnabled; +private final ConnectionPool pool; + +public PoolBackedPostgresConnectionFactory(boolean rowLevelSecurityEnabled, Optional maxSize, ConnectionFactory connectionFactory) { +this.rowLevelSecurityEnabled = rowLevelSecurityEnabled; +final ConnectionPoolConfiguration configuration = ConnectionPoolConfiguration.builder(connectionFactory) Review Comment: just to make sure it is assigned only once -- 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-4029 Fix infinite loop with Bounce + forward
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 ad58064c1b JAMES-4029 Fix infinite loop with Bounce + forward ad58064c1b is described below commit ad58064c1bcd53ed82fc2e3080d20b4d0e7843eb Author: Benoit TELLIER AuthorDate: Mon Apr 15 20:54:24 2024 +0200 JAMES-4029 Fix infinite loop with Bounce + forward --- .../mailets/ForwardBounceLoopIntegrationTest.java | 156 + .../mailets/redirect/ProcessRedirectNotify.java| 7 + 2 files changed, 163 insertions(+) diff --git a/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/ForwardBounceLoopIntegrationTest.java b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/ForwardBounceLoopIntegrationTest.java new file mode 100644 index 00..75d421438f --- /dev/null +++ b/server/mailet/integration-testing/src/test/java/org/apache/james/mailets/ForwardBounceLoopIntegrationTest.java @@ -0,0 +1,156 @@ +/ + * 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.mailets; + +import static org.apache.james.mailets.configuration.CommonProcessors.ERROR_REPOSITORY; +import static org.apache.james.mailets.configuration.Constants.DEFAULT_DOMAIN; +import static org.apache.james.mailets.configuration.Constants.LOCALHOST_IP; +import static org.apache.james.mailets.configuration.Constants.PASSWORD; +import static org.apache.james.mailets.configuration.MailetConfiguration.TO_TRANSPORT; +import static org.apache.james.mailets.configuration.ProcessorConfiguration.STATE_BOUNCES; +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.File; + +import org.apache.james.core.Username; +import org.apache.james.mailets.configuration.CommonProcessors; +import org.apache.james.mailets.configuration.MailetConfiguration; +import org.apache.james.mailets.configuration.MailetContainer; +import org.apache.james.mailets.configuration.ProcessorConfiguration; +import org.apache.james.modules.protocols.SmtpGuiceProbe; +import org.apache.james.rrt.lib.Mapping; +import org.apache.james.rrt.lib.MappingSource; +import org.apache.james.transport.mailets.Bounce; +import org.apache.james.transport.mailets.ToProcessor; +import org.apache.james.transport.matchers.All; +import org.apache.james.transport.matchers.RecipientIs; +import org.apache.james.utils.DataProbeImpl; +import org.apache.james.utils.FilteringManagementProbeImpl; +import org.apache.james.utils.GuiceProbe; +import org.apache.james.utils.MailRepositoryProbeImpl; +import org.apache.james.utils.SMTPMessageSender; +import org.apache.james.utils.SpoolerProbe; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; +import org.junit.jupiter.api.io.TempDir; +import org.testcontainers.shaded.org.awaitility.Awaitility; + +import com.google.inject.multibindings.Multibinder; + +public class ForwardBounceLoopIntegrationTest { + +private static final Username SENDER = Username.of("sender@" + DEFAULT_DOMAIN); +private static final Username ALICE = Username.of("alice@" + DEFAULT_DOMAIN); +private static final Username BOB = Username.of("bob@" + DEFAULT_DOMAIN); +private static final Username CEDRIC = Username.of("cedric@" + DEFAULT_DOMAIN); +private TemporaryJamesServer jamesServer; +private MailRepositoryProbeImpl mailRepositoryProbe; + +@RegisterExtension +public SMTPMessageSender messageSender = new SMTPMessageSender(DEFAULT_DOMAIN); +private DataProbeImpl dataProbe; + +private void setUp(File temporaryFolder, MailetContainer.Builder mailetConfiguration) throws Exception
Re: [PR] JAMES-4029 Fix infinite loop with Bounce + forward [james-project]
Arsnael merged PR #2203: URL: https://github.com/apache/james-project/pull/2203 -- 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-4028 MailImpl: More compact version of Mail.getName [james-project]
Arsnael commented on PR #2201: URL: https://github.com/apache/james-project/pull/2201#issuecomment-2058598056 > Explanation are on the JIRA ticket: https://issues.apache.org/jira/browse/JAMES-4028 My bad, missed it, thanks :) -- 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-3946 add a memory implementation of the DropList [james-project]
Arsnael merged PR #2197: URL: https://github.com/apache/james-project/pull/2197 -- 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 droplist updated: JAMES-3946 add a memory implementation of the DropList (#2197)
This is an automated email from the ASF dual-hosted git repository. rcordier pushed a commit to branch droplist in repository https://gitbox.apache.org/repos/asf/james-project.git The following commit(s) were added to refs/heads/droplist by this push: new ae8bfc4a35 JAMES-3946 add a memory implementation of the DropList (#2197) ae8bfc4a35 is described below commit ae8bfc4a35535a8f69147025ed1df28e368013ac Author: Maksim <85022218+maxxx...@users.noreply.github.com> AuthorDate: Tue Apr 16 12:00:22 2024 +0300 JAMES-3946 add a memory implementation of the DropList (#2197) --- .../apache/james/droplists/api/DropListEntry.java | 71 .../james/droplists/api/DropListContract.java | 190 + .../james/droplists/api/DropListEntryTest.java | 128 +- .../james/droplists/memory/MemoryDropList.java | 97 +++ .../james/droplists/memory/MemoryDropListTest.java | 39 + 5 files changed, 407 insertions(+), 118 deletions(-) diff --git a/server/data/data-api/src/main/java/org/apache/james/droplists/api/DropListEntry.java b/server/data/data-api/src/main/java/org/apache/james/droplists/api/DropListEntry.java index ab73cc4e51..7bec40408f 100644 --- a/server/data/data-api/src/main/java/org/apache/james/droplists/api/DropListEntry.java +++ b/server/data/data-api/src/main/java/org/apache/james/droplists/api/DropListEntry.java @@ -18,12 +18,16 @@ / package org.apache.james.droplists.api; -import static org.apache.james.core.Domain.MAXIMUM_DOMAIN_LENGTH; +import static org.apache.james.droplists.api.OwnerScope.DOMAIN; import static org.apache.james.droplists.api.OwnerScope.GLOBAL; +import static org.apache.james.droplists.api.OwnerScope.USER; import java.util.Objects; import java.util.Optional; +import org.apache.james.core.Domain; +import org.apache.james.core.MailAddress; + import com.google.common.base.MoreObjects; import com.google.common.base.Preconditions; @@ -34,53 +38,58 @@ public class DropListEntry { } public static class Builder { -private Optional ownerScope = Optional.empty(); -private String owner; +private OwnerScope ownerScope; +private Optional owner = Optional.empty(); private DeniedEntityType deniedEntityType; private String deniedEntity; -public Builder ownerScope(OwnerScope ownerScope) { -this.ownerScope = Optional.ofNullable(ownerScope); +public Builder userOwner(MailAddress mailAddress) { +Preconditions.checkNotNull(mailAddress); +this.owner = Optional.of(mailAddress.toString()); +this.ownerScope = USER; +return this; +} + +public Builder domainOwner(Domain domain) { +Preconditions.checkNotNull(domain); +this.owner = Optional.of(domain.asString()); +this.ownerScope = DOMAIN; return this; } -public Builder owner(String owner) { -Preconditions.checkNotNull(owner); -this.owner = owner; +public Builder forAll() { +this.ownerScope = GLOBAL; return this; } -public Builder deniedEntityType(DeniedEntityType deniedEntityType) { -Preconditions.checkNotNull(deniedEntityType); -this.deniedEntityType = deniedEntityType; +public Builder denyDomain(Domain domain) { +Preconditions.checkNotNull(domain); +this.deniedEntity = domain.asString(); +this.deniedEntityType = DeniedEntityType.DOMAIN; return this; } -public Builder deniedEntity(String deniedEntity) { -Preconditions.checkNotNull(deniedEntity); -this.deniedEntity = deniedEntity; +public Builder denyAddress(MailAddress mailAddress) { +Preconditions.checkNotNull(mailAddress); +this.deniedEntity = mailAddress.toString(); +this.deniedEntityType = DeniedEntityType.ADDRESS; return this; } public DropListEntry build() { -OwnerScope scope = ownerScope.orElse(GLOBAL); -Preconditions.checkArgument(owner != null && !owner.trim().isBlank(), "owner must not be null, empty, or blank"); -Preconditions.checkArgument(owner.length() <= MAXIMUM_DOMAIN_LENGTH, -"owner length should not be longer than %s characters", MAXIMUM_DOMAIN_LENGTH); Preconditions.checkArgument(deniedEntityType != null, "`deniedEntityType` is mandatory"); +Preconditions.checkArgument(ownerScope != null, "`ownerScope` is mandatory"); Preconditions.checkArgument(deniedEntity != null && !deniedEntity.isBlank(), "`deniedEntity` must not be null, empty, or blank"); -Preconditions.checkArgument(deniedEntity.length() <= MAXIMUM_DOMAIN_LENGTH, -
Re: [PR] [FIX] Multi-mailbox search should not fail when user has many mailboxes [james-project]
chibenwa merged PR #2198: URL: https://github.com/apache/james-project/pull/2198 -- 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 (9166b778cb -> b351841813)
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 9166b778cb [ENHANCEMENT] More information in mailrepository audit log add b351841813 [FIX] Multi-mailbox search should not fail when user has many mailboxes (#2198) No new revisions were added by this update. Summary of changes: .../opensearch/OpenSearchIntegrationTest.java | 37 ++ 1 file changed, 37 insertions(+) - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
Re: [PR] JAMES-4030 Carry over Bouncer exceptions [james-project]
chibenwa commented on PR #2204: URL: https://github.com/apache/james-project/pull/2204#issuecomment-2058328807 forgotten -- 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