james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [05/10] james-project git commit: JAMES-2441 Rely on POJO for Cassandra configuration
Date Mon, 02 Jul 2018 04:49:31 GMT
http://git-wip-us.apache.org/repos/asf/james-project/blob/c767bf79/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraAttachmentDAO.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraAttachmentDAO.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraAttachmentDAO.java
index e3d05a5..2e5c767 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraAttachmentDAO.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraAttachmentDAO.java
@@ -39,7 +39,7 @@ import java.util.stream.Stream;
 
 import javax.inject.Inject;
 
-import org.apache.james.backends.cassandra.init.CassandraConfiguration;
+import org.apache.james.backends.cassandra.init.configuration.CassandraConfiguration;
 import org.apache.james.backends.cassandra.utils.CassandraAsyncExecutor;
 import org.apache.james.backends.cassandra.utils.CassandraUtils;
 import org.apache.james.mailbox.model.Attachment;

http://git-wip-us.apache.org/repos/asf/james-project/blob/c767bf79/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAO.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAO.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAO.java
index dadd033..8fe0284 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAO.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageDAO.java
@@ -55,8 +55,8 @@ import javax.mail.util.SharedByteArrayInputStream;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.tuple.Pair;
-import org.apache.james.backends.cassandra.init.CassandraConfiguration;
 import org.apache.james.backends.cassandra.init.CassandraTypesProvider;
+import org.apache.james.backends.cassandra.init.configuration.CassandraConfiguration;
 import org.apache.james.backends.cassandra.utils.CassandraAsyncExecutor;
 import org.apache.james.backends.cassandra.utils.CassandraUtils;
 import org.apache.james.blob.api.BlobId;

http://git-wip-us.apache.org/repos/asf/james-project/blob/c767bf79/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdMapper.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdMapper.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdMapper.java
index 3209266..c59a60b 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdMapper.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdMapper.java
@@ -29,7 +29,7 @@ import java.util.stream.Stream;
 import javax.mail.Flags;
 
 import org.apache.commons.lang3.tuple.Pair;
-import org.apache.james.backends.cassandra.init.CassandraConfiguration;
+import org.apache.james.backends.cassandra.init.configuration.CassandraConfiguration;
 import org.apache.james.backends.cassandra.utils.FunctionRunnerWithRetry;
 import org.apache.james.backends.cassandra.utils.LightweightTransactionException;
 import org.apache.james.mailbox.MailboxSession;

http://git-wip-us.apache.org/repos/asf/james-project/blob/c767bf79/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageMapper.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageMapper.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageMapper.java
index 08172ed..57b1f81 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageMapper.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageMapper.java
@@ -31,7 +31,7 @@ import java.util.stream.Stream;
 import javax.mail.Flags;
 import javax.mail.Flags.Flag;
 
-import org.apache.james.backends.cassandra.init.CassandraConfiguration;
+import org.apache.james.backends.cassandra.init.configuration.CassandraConfiguration;
 import org.apache.james.mailbox.ApplicableFlagBuilder;
 import org.apache.james.mailbox.FlagsBuilder;
 import org.apache.james.mailbox.MailboxSession;

http://git-wip-us.apache.org/repos/asf/james-project/blob/c767bf79/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraModSeqProvider.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraModSeqProvider.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraModSeqProvider.java
index beca954..63e045b 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraModSeqProvider.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraModSeqProvider.java
@@ -36,7 +36,7 @@ import java.util.function.Supplier;
 
 import javax.inject.Inject;
 
-import org.apache.james.backends.cassandra.init.CassandraConfiguration;
+import org.apache.james.backends.cassandra.init.configuration.CassandraConfiguration;
 import org.apache.james.backends.cassandra.utils.CassandraAsyncExecutor;
 import org.apache.james.backends.cassandra.utils.FunctionRunnerWithRetry;
 import org.apache.james.mailbox.MailboxSession;

http://git-wip-us.apache.org/repos/asf/james-project/blob/c767bf79/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraUidProvider.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraUidProvider.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraUidProvider.java
index 0c8c0dd..b402bf8 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraUidProvider.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraUidProvider.java
@@ -34,7 +34,7 @@ import java.util.concurrent.CompletableFuture;
 
 import javax.inject.Inject;
 
-import org.apache.james.backends.cassandra.init.CassandraConfiguration;
+import org.apache.james.backends.cassandra.init.configuration.CassandraConfiguration;
 import org.apache.james.backends.cassandra.utils.CassandraAsyncExecutor;
 import org.apache.james.backends.cassandra.utils.FunctionRunnerWithRetry;
 import org.apache.james.mailbox.MailboxSession;

http://git-wip-us.apache.org/repos/asf/james-project/blob/c767bf79/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraSubscriptionManagerTest.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraSubscriptionManagerTest.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraSubscriptionManagerTest.java
index e6bf8c1..4a41d49 100644
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraSubscriptionManagerTest.java
+++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/CassandraSubscriptionManagerTest.java
@@ -21,8 +21,8 @@ package org.apache.james.mailbox.cassandra;
 
 import org.apache.james.backends.cassandra.CassandraCluster;
 import org.apache.james.backends.cassandra.DockerCassandraRule;
-import org.apache.james.backends.cassandra.init.CassandraConfiguration;
 import org.apache.james.backends.cassandra.init.CassandraModuleComposite;
+import org.apache.james.backends.cassandra.init.configuration.CassandraConfiguration;
 import org.apache.james.backends.cassandra.utils.CassandraUtils;
 import org.apache.james.blob.api.ObjectStore;
 import org.apache.james.mailbox.AbstractSubscriptionManagerTest;

http://git-wip-us.apache.org/repos/asf/james-project/blob/c767bf79/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/TestCassandraMailboxSessionMapperFactory.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/TestCassandraMailboxSessionMapperFactory.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/TestCassandraMailboxSessionMapperFactory.java
index 202ca30..61eb0c4 100644
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/TestCassandraMailboxSessionMapperFactory.java
+++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/TestCassandraMailboxSessionMapperFactory.java
@@ -19,8 +19,8 @@
 
 package org.apache.james.mailbox.cassandra;
 
-import org.apache.james.backends.cassandra.init.CassandraConfiguration;
 import org.apache.james.backends.cassandra.init.CassandraTypesProvider;
+import org.apache.james.backends.cassandra.init.configuration.CassandraConfiguration;
 import org.apache.james.backends.cassandra.utils.CassandraUtils;
 import org.apache.james.blob.cassandra.CassandraBlobId;
 import org.apache.james.blob.cassandra.CassandraBlobsDAO;

http://git-wip-us.apache.org/repos/asf/james-project/blob/c767bf79/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraACLMapperTest.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraACLMapperTest.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraACLMapperTest.java
index 41f9535..3970d9e 100644
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraACLMapperTest.java
+++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraACLMapperTest.java
@@ -32,7 +32,7 @@ import java.util.concurrent.TimeoutException;
 
 import org.apache.james.backends.cassandra.CassandraCluster;
 import org.apache.james.backends.cassandra.DockerCassandraRule;
-import org.apache.james.backends.cassandra.init.CassandraConfiguration;
+import org.apache.james.backends.cassandra.init.configuration.CassandraConfiguration;
 import org.apache.james.backends.cassandra.utils.CassandraUtils;
 import org.apache.james.mailbox.cassandra.ids.CassandraId;
 import org.apache.james.mailbox.cassandra.modules.CassandraAclModule;

http://git-wip-us.apache.org/repos/asf/james-project/blob/c767bf79/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraAttachmentDAOTest.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraAttachmentDAOTest.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraAttachmentDAOTest.java
index 4f53c2f..6944618 100644
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraAttachmentDAOTest.java
+++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraAttachmentDAOTest.java
@@ -26,7 +26,7 @@ import java.util.Optional;
 
 import org.apache.james.backends.cassandra.CassandraCluster;
 import org.apache.james.backends.cassandra.DockerCassandraRule;
-import org.apache.james.backends.cassandra.init.CassandraConfiguration;
+import org.apache.james.backends.cassandra.init.configuration.CassandraConfiguration;
 import org.apache.james.backends.cassandra.utils.CassandraUtils;
 import org.apache.james.mailbox.cassandra.modules.CassandraAttachmentModule;
 import org.apache.james.mailbox.model.Attachment;

http://git-wip-us.apache.org/repos/asf/james-project/blob/c767bf79/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraAttachmentFallbackTest.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraAttachmentFallbackTest.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraAttachmentFallbackTest.java
index 175c479..6a8517a 100644
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraAttachmentFallbackTest.java
+++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraAttachmentFallbackTest.java
@@ -26,8 +26,8 @@ import java.nio.charset.StandardCharsets;
 
 import org.apache.james.backends.cassandra.CassandraCluster;
 import org.apache.james.backends.cassandra.DockerCassandraRule;
-import org.apache.james.backends.cassandra.init.CassandraConfiguration;
 import org.apache.james.backends.cassandra.init.CassandraModuleComposite;
+import org.apache.james.backends.cassandra.init.configuration.CassandraConfiguration;
 import org.apache.james.backends.cassandra.utils.CassandraUtils;
 import org.apache.james.blob.api.BlobId;
 import org.apache.james.blob.cassandra.CassandraBlobId;

http://git-wip-us.apache.org/repos/asf/james-project/blob/c767bf79/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxMapperConcurrencyTest.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxMapperConcurrencyTest.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxMapperConcurrencyTest.java
index b995a73..20e339d 100644
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxMapperConcurrencyTest.java
+++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxMapperConcurrencyTest.java
@@ -26,8 +26,8 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.james.backends.cassandra.CassandraCluster;
 import org.apache.james.backends.cassandra.DockerCassandraRule;
-import org.apache.james.backends.cassandra.init.CassandraConfiguration;
 import org.apache.james.backends.cassandra.init.CassandraModuleComposite;
+import org.apache.james.backends.cassandra.init.configuration.CassandraConfiguration;
 import org.apache.james.backends.cassandra.utils.CassandraUtils;
 import org.apache.james.mailbox.cassandra.modules.CassandraAclModule;
 import org.apache.james.mailbox.cassandra.modules.CassandraMailboxModule;

http://git-wip-us.apache.org/repos/asf/james-project/blob/c767bf79/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxMapperTest.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxMapperTest.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxMapperTest.java
index 1f502ce..8442e02 100644
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxMapperTest.java
+++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMailboxMapperTest.java
@@ -27,8 +27,8 @@ import java.util.List;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.james.backends.cassandra.CassandraCluster;
 import org.apache.james.backends.cassandra.DockerCassandraRule;
-import org.apache.james.backends.cassandra.init.CassandraConfiguration;
 import org.apache.james.backends.cassandra.init.CassandraModuleComposite;
+import org.apache.james.backends.cassandra.init.configuration.CassandraConfiguration;
 import org.apache.james.backends.cassandra.utils.CassandraUtils;
 import org.apache.james.mailbox.cassandra.ids.CassandraId;
 import org.apache.james.mailbox.cassandra.modules.CassandraAclModule;

http://git-wip-us.apache.org/repos/asf/james-project/blob/c767bf79/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdMapperTest.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdMapperTest.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdMapperTest.java
index d6d0f65..f0ab6ae 100644
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdMapperTest.java
+++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/CassandraMessageIdMapperTest.java
@@ -25,8 +25,8 @@ import java.util.List;
 
 import org.apache.james.backends.cassandra.CassandraCluster;
 import org.apache.james.backends.cassandra.DockerCassandraRule;
-import org.apache.james.backends.cassandra.init.CassandraConfiguration;
 import org.apache.james.backends.cassandra.init.CassandraModuleComposite;
+import org.apache.james.backends.cassandra.init.configuration.CassandraConfiguration;
 import org.apache.james.blob.cassandra.CassandraBlobModule;
 import org.apache.james.mailbox.cassandra.CassandraMailboxSessionMapperFactory;
 import org.apache.james.mailbox.cassandra.TestCassandraMailboxSessionMapperFactory;

http://git-wip-us.apache.org/repos/asf/james-project/blob/c767bf79/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/migration/AttachmentV2MigrationTest.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/migration/AttachmentV2MigrationTest.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/migration/AttachmentV2MigrationTest.java
index 68d53a6..e98f59b 100644
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/migration/AttachmentV2MigrationTest.java
+++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/migration/AttachmentV2MigrationTest.java
@@ -30,8 +30,8 @@ import java.util.stream.Stream;
 
 import org.apache.james.backends.cassandra.CassandraCluster;
 import org.apache.james.backends.cassandra.DockerCassandraRule;
-import org.apache.james.backends.cassandra.init.CassandraConfiguration;
 import org.apache.james.backends.cassandra.init.CassandraModuleComposite;
+import org.apache.james.backends.cassandra.init.configuration.CassandraConfiguration;
 import org.apache.james.backends.cassandra.migration.Migration;
 import org.apache.james.backends.cassandra.utils.CassandraUtils;
 import org.apache.james.blob.cassandra.CassandraBlobId;

http://git-wip-us.apache.org/repos/asf/james-project/blob/c767bf79/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/migration/MailboxPathV2MigrationTest.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/migration/MailboxPathV2MigrationTest.java b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/migration/MailboxPathV2MigrationTest.java
index 00867a5..c1da035 100644
--- a/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/migration/MailboxPathV2MigrationTest.java
+++ b/mailbox/cassandra/src/test/java/org/apache/james/mailbox/cassandra/mail/migration/MailboxPathV2MigrationTest.java
@@ -23,8 +23,8 @@ import static org.assertj.core.api.Assertions.assertThat;
 
 import org.apache.james.backends.cassandra.CassandraCluster;
 import org.apache.james.backends.cassandra.DockerCassandraRule;
-import org.apache.james.backends.cassandra.init.CassandraConfiguration;
 import org.apache.james.backends.cassandra.init.CassandraModuleComposite;
+import org.apache.james.backends.cassandra.init.configuration.CassandraConfiguration;
 import org.apache.james.backends.cassandra.utils.CassandraUtils;
 import org.apache.james.mailbox.cassandra.ids.CassandraId;
 import org.apache.james.mailbox.cassandra.mail.CassandraACLMapper;

http://git-wip-us.apache.org/repos/asf/james-project/blob/c767bf79/server/blob/blob-cassandra/src/main/java/org/apache/james/blob/cassandra/CassandraBlobsDAO.java
----------------------------------------------------------------------
diff --git a/server/blob/blob-cassandra/src/main/java/org/apache/james/blob/cassandra/CassandraBlobsDAO.java b/server/blob/blob-cassandra/src/main/java/org/apache/james/blob/cassandra/CassandraBlobsDAO.java
index 0c47757..7c8eda8 100644
--- a/server/blob/blob-cassandra/src/main/java/org/apache/james/blob/cassandra/CassandraBlobsDAO.java
+++ b/server/blob/blob-cassandra/src/main/java/org/apache/james/blob/cassandra/CassandraBlobsDAO.java
@@ -33,7 +33,7 @@ import java.util.stream.Stream;
 import javax.inject.Inject;
 
 import org.apache.commons.lang3.tuple.Pair;
-import org.apache.james.backends.cassandra.init.CassandraConfiguration;
+import org.apache.james.backends.cassandra.init.configuration.CassandraConfiguration;
 import org.apache.james.backends.cassandra.utils.CassandraAsyncExecutor;
 import org.apache.james.blob.api.BlobId;
 import org.apache.james.blob.api.ObjectStore;

http://git-wip-us.apache.org/repos/asf/james-project/blob/c767bf79/server/blob/blob-cassandra/src/test/java/org/apache/james/blob/cassandra/CassandraBlobsDAOTest.java
----------------------------------------------------------------------
diff --git a/server/blob/blob-cassandra/src/test/java/org/apache/james/blob/cassandra/CassandraBlobsDAOTest.java b/server/blob/blob-cassandra/src/test/java/org/apache/james/blob/cassandra/CassandraBlobsDAOTest.java
index 918730a..9eab5eb 100644
--- a/server/blob/blob-cassandra/src/test/java/org/apache/james/blob/cassandra/CassandraBlobsDAOTest.java
+++ b/server/blob/blob-cassandra/src/test/java/org/apache/james/blob/cassandra/CassandraBlobsDAOTest.java
@@ -27,7 +27,7 @@ import java.nio.charset.StandardCharsets;
 import org.apache.james.backends.cassandra.CassandraCluster;
 import org.apache.james.backends.cassandra.DockerCassandraExtension;
 import org.apache.james.backends.cassandra.DockerCassandraExtension.DockerCassandra;
-import org.apache.james.backends.cassandra.init.CassandraConfiguration;
+import org.apache.james.backends.cassandra.init.configuration.CassandraConfiguration;
 import org.apache.james.blob.api.BlobId;
 import org.apache.james.blob.api.ObjectStore;
 import org.apache.james.blob.api.ObjectStoreContract;

http://git-wip-us.apache.org/repos/asf/james-project/blob/c767bf79/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraSessionModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraSessionModule.java b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraSessionModule.java
index 523cbc8..4214367 100644
--- a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraSessionModule.java
+++ b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraSessionModule.java
@@ -20,18 +20,17 @@ package org.apache.james.modules.mailbox;
 
 import java.io.FileNotFoundException;
 import java.util.List;
-import java.util.Optional;
 import java.util.Set;
 import java.util.concurrent.ScheduledExecutorService;
 
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.PropertiesConfiguration;
 import org.apache.james.backends.cassandra.components.CassandraModule;
-import org.apache.james.backends.cassandra.init.CassandraConfiguration;
 import org.apache.james.backends.cassandra.init.CassandraModuleComposite;
-import org.apache.james.backends.cassandra.init.CassandraSessionConfiguration;
 import org.apache.james.backends.cassandra.init.CassandraZonedDateTimeModule;
 import org.apache.james.backends.cassandra.init.SessionWithInitializedTablesFactory;
+import org.apache.james.backends.cassandra.init.configuration.CassandraConfiguration;
+import org.apache.james.backends.cassandra.init.configuration.ClusterConfiguration;
 import org.apache.james.backends.cassandra.utils.CassandraUtils;
 import org.apache.james.backends.cassandra.versions.CassandraSchemaVersionDAO;
 import org.apache.james.backends.cassandra.versions.CassandraSchemaVersionManager;
@@ -64,18 +63,6 @@ public class CassandraSessionModule extends AbstractModule {
 
     private static final String LOCALHOST = "127.0.0.1";
     private static final String BATCHSIZES_FILE_NAME = "batchsizes";
-    private static final String MAILBOX_MAX_RETRY_ACL = "mailbox.max.retry.acl";
-    private static final String MAILBOX_MAX_RETRY_MODSEQ = "mailbox.max.retry.modseq";
-    private static final String MAILBOX_MAX_RETRY_UID = "mailbox.max.retry.uid";
-    private static final String MAILBOX_MAX_RETRY_MESSAGE_FLAGS_UPDATE = "mailbox.max.retry.message.flags.update";
-    private static final String MAILBOX_MAX_RETRY_MESSAGE_ID_FLAGS_UPDATE = "mailbox.max.retry.message.id.flags.update";
-    private static final String FETCH_ADVANCE_ROW_COUNT = "fetch.advance.row.count";
-    private static final String CHUNK_SIZE_FLAGS_UPDATE = "chunk.size.flags.update";
-    private static final String CHUNK_SIZE_MESSAGE_READ = "chunk.size.message.read";
-    private static final String CHUNK_SIZE_EXPUNGE = "chunk.size.expunge";
-    private static final String BLOB_PART_SIZE = "mailbox.blob.part.size";
-    private static final String ATTACHMENT_V2_MIGRATION_READ_TIMEOUT = "attachment.v2.migration.read.timeout";
-    private static final String MESSAGE_ATTACHMENTID_READ_TIMEOUT = "message.attachmentids.read.timeout";
     private static final String CASSANDRA_NODES = "cassandra.nodes";
 
     @Override
@@ -105,12 +92,6 @@ public class CassandraSessionModule extends AbstractModule {
 
     @Provides
     @Singleton
-    CassandraSessionConfiguration getCassandraSessionConfiguration(PropertiesProvider propertiesProvider) {
-        return () -> getConfiguration(propertiesProvider);
-    }
-
-    @Provides
-    @Singleton
     BatchSizes getBatchSizesConfiguration(PropertiesProvider propertiesProvider) {
         try {
             PropertiesConfiguration configuration = propertiesProvider.getConfiguration(BATCHSIZES_FILE_NAME);
@@ -139,35 +120,14 @@ public class CassandraSessionModule extends AbstractModule {
     @VisibleForTesting
     @Provides
     @Singleton
-    CassandraConfiguration provideCassandraConfiguration(CassandraSessionConfiguration sessionConfiguration) throws ConfigurationException {
-        PropertiesConfiguration propertiesConfiguration = sessionConfiguration.getConfiguration();
-
-        return CassandraConfiguration.builder()
-            .aclMaxRetry(Optional.ofNullable(
-                propertiesConfiguration.getInteger(MAILBOX_MAX_RETRY_ACL, null)))
-            .modSeqMaxRetry(Optional.ofNullable(
-                propertiesConfiguration.getInteger(MAILBOX_MAX_RETRY_MODSEQ, null)))
-            .uidMaxRetry(Optional.ofNullable(
-                propertiesConfiguration.getInteger(MAILBOX_MAX_RETRY_UID, null)))
-            .flagsUpdateMessageMaxRetry(Optional.ofNullable(
-                propertiesConfiguration.getInteger(MAILBOX_MAX_RETRY_MESSAGE_FLAGS_UPDATE, null)))
-            .flagsUpdateMessageIdMaxRetry(Optional.ofNullable(
-                propertiesConfiguration.getInteger(MAILBOX_MAX_RETRY_MESSAGE_ID_FLAGS_UPDATE, null)))
-            .fetchNextPageInAdvanceRow(Optional.ofNullable(
-                propertiesConfiguration.getInteger(FETCH_ADVANCE_ROW_COUNT, null)))
-            .flagsUpdateChunkSize(Optional.ofNullable(
-                propertiesConfiguration.getInteger(CHUNK_SIZE_FLAGS_UPDATE, null)))
-            .messageReadChunkSize(Optional.ofNullable(
-                propertiesConfiguration.getInteger(CHUNK_SIZE_MESSAGE_READ, null)))
-            .expungeChunkSize(Optional.ofNullable(
-                propertiesConfiguration.getInteger(CHUNK_SIZE_EXPUNGE, null)))
-            .blobPartSize(Optional.ofNullable(
-                propertiesConfiguration.getInteger(BLOB_PART_SIZE, null)))
-            .attachmentV2MigrationReadTimeout(Optional.ofNullable(
-                propertiesConfiguration.getInteger(ATTACHMENT_V2_MIGRATION_READ_TIMEOUT, null)))
-            .messageAttachmentIdsReadTimeout(Optional.ofNullable(
-                propertiesConfiguration.getInteger(MESSAGE_ATTACHMENTID_READ_TIMEOUT, null)))
-            .build();
+    CassandraConfiguration provideCassandraConfiguration(PropertiesProvider propertiesProvider) throws ConfigurationException {
+        return CassandraConfiguration.from(getConfiguration(propertiesProvider));
+    }
+
+    @Provides
+    @Singleton
+    ClusterConfiguration provideClusterConfiguration(PropertiesProvider propertiesProvider) throws ConfigurationException {
+        return ClusterConfiguration.from(getConfiguration(propertiesProvider));
     }
 
     private PropertiesConfiguration getConfiguration(PropertiesProvider propertiesProvider) throws ConfigurationException {

http://git-wip-us.apache.org/repos/asf/james-project/blob/c767bf79/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/ResilientClusterProvider.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/ResilientClusterProvider.java b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/ResilientClusterProvider.java
index 67fda54..65c949f 100644
--- a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/ResilientClusterProvider.java
+++ b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/ResilientClusterProvider.java
@@ -20,85 +20,53 @@
 package org.apache.james.modules.mailbox;
 
 import java.time.LocalDateTime;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Optional;
 import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
 
 import javax.annotation.PreDestroy;
 import javax.inject.Inject;
 import javax.inject.Provider;
 import javax.inject.Singleton;
 
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.PropertiesConfiguration;
-import org.apache.james.backends.cassandra.init.CassandraSessionConfiguration;
 import org.apache.james.backends.cassandra.init.ClusterBuilder;
 import org.apache.james.backends.cassandra.init.ClusterWithKeyspaceCreatedFactory;
-import org.apache.james.backends.cassandra.init.QueryLoggerConfiguration;
-import org.apache.james.util.Host;
+import org.apache.james.backends.cassandra.init.configuration.ClusterConfiguration;
 import org.apache.james.utils.RetryExecutorUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.datastax.driver.core.Cluster;
-import com.datastax.driver.core.HostDistance;
-import com.datastax.driver.core.PerHostPercentileTracker;
-import com.datastax.driver.core.PoolingOptions;
-import com.datastax.driver.core.QueryLogger;
 import com.datastax.driver.core.exceptions.NoHostAvailableException;
-import com.github.steveash.guavate.Guavate;
 import com.nurkiewicz.asyncretry.AsyncRetryExecutor;
 import com.nurkiewicz.asyncretry.function.RetryCallable;
 
 @Singleton
 public class ResilientClusterProvider implements Provider<Cluster> {
-
-    public static final String CASSANDRA_KEYSPACE = "cassandra.keyspace";
-    private static final int DEFAULT_CONNECTION_MAX_RETRIES = 10;
-    private static final int DEFAULT_CONNECTION_MIN_DELAY = 5000;
-    private static final long CASSANDRA_HIGHEST_TRACKABLE_LATENCY_MILLIS = TimeUnit.SECONDS.toMillis(10);
-    private static final int DEFAULT_REPLICATION_FACTOR = 1;
-    private static final String DEFAULT_KEYSPACE = "apache_james";
-    private static final int DEFAULT_READ_TIMEOUT_MILLIS = 5000;
-    private static final int DEFAULT_CONNECT_TIMEOUT_MILLIS = 5000;
-    private static final String CASSANDRA_NODES = "cassandra.nodes";
-
     private static final Logger LOGGER = LoggerFactory.getLogger(ResilientClusterProvider.class);
+
     private final Cluster cluster;
 
     @Inject
-    private ResilientClusterProvider(CassandraSessionConfiguration cassandraSessionConfiguration, AsyncRetryExecutor executor) throws ConfigurationException, ExecutionException, InterruptedException {
-        PropertiesConfiguration configuration = cassandraSessionConfiguration.getConfiguration();
-        List<Host> servers = listCassandraServers(configuration);
-
-        QueryLoggerConfiguration queryLoggerConfiguration = getCassandraQueryLoggerConf(configuration);
-
-        int maxRetries = configuration.getInt("cassandra.retryConnection.maxRetries", DEFAULT_CONNECTION_MAX_RETRIES);
-        int minDelay = configuration.getInt("cassandra.retryConnection.minDelay", DEFAULT_CONNECTION_MIN_DELAY);
-
-        cluster = RetryExecutorUtil.retryOnExceptions(executor, maxRetries, minDelay, NoHostAvailableException.class)
-                .getWithRetry(getClusterRetryCallable(configuration, servers, queryLoggerConfiguration))
+    private ResilientClusterProvider(ClusterConfiguration configuration, AsyncRetryExecutor executor) throws ExecutionException, InterruptedException {
+        cluster = RetryExecutorUtil.retryOnExceptions(executor, configuration.getMaxRetry(), configuration.getMinDelay(), NoHostAvailableException.class)
+                .getWithRetry(getClusterRetryCallable(configuration))
                 .get();
     }
 
-    private RetryCallable<Cluster> getClusterRetryCallable(PropertiesConfiguration configuration, List<Host> servers, QueryLoggerConfiguration queryLoggerConfiguration) {
-        LOGGER.info("Trying to connect to Cassandra service at {} (list {})", LocalDateTime.now(), servers);
+    private RetryCallable<Cluster> getClusterRetryCallable(ClusterConfiguration configuration) {
+        LOGGER.info("Trying to connect to Cassandra service at {} (list {})", LocalDateTime.now(), configuration.getHosts());
 
         return context -> {
             Cluster cluster = ClusterBuilder.builder()
-                    .servers(servers)
-                    .poolingOptions(readPoolingOptions(configuration))
-                    .queryLoggerConfiguration(queryLoggerConfiguration)
-                    .readTimeoutMillis(configuration.getInt("cassandra.readTimeoutMillis", DEFAULT_READ_TIMEOUT_MILLIS))
-                    .connectTimeoutMillis(configuration.getInt("cassandra.connectTimeoutMillis", DEFAULT_CONNECT_TIMEOUT_MILLIS))
+                    .servers(configuration.getHosts())
+                    .poolingOptions(configuration.getPoolingOptions())
+                    .queryLoggerConfiguration(configuration.getQueryLoggerConfiguration())
+                    .readTimeoutMillis(configuration.getReadTimeoutMillis())
+                    .connectTimeoutMillis(configuration.getConnectTimeoutMillis())
                     .build();
             try {
                 return ClusterWithKeyspaceCreatedFactory
-                    .config(cluster,
-                            configuration.getString(CASSANDRA_KEYSPACE, DEFAULT_KEYSPACE))
-                    .replicationFactor(configuration.getInt("cassandra.replication.factor", DEFAULT_REPLICATION_FACTOR))
+                    .config(cluster, configuration.getKeyspace())
+                    .replicationFactor(configuration.getReplicationFactor())
                     .clusterWithInitializedKeyspace();
             } catch (Exception e) {
                 cluster.close();
@@ -107,85 +75,6 @@ public class ResilientClusterProvider implements Provider<Cluster> {
         };
     }
 
-    private Optional<PoolingOptions> readPoolingOptions(PropertiesConfiguration configuration) {
-
-        Optional<Integer> maxConnections = Optional.ofNullable(configuration.getInteger("cassandra.pooling.local.max.connections", null));
-        Optional<Integer> maxRequests = Optional.ofNullable(configuration.getInteger("cassandra.pooling.local.max.requests", null));
-        Optional<Integer> poolingTimeout = Optional.ofNullable(configuration.getInteger("cassandra.pooling.timeout", null));
-        Optional<Integer> heartbeatTimeout = Optional.ofNullable(configuration.getInteger("cassandra.pooling.heartbeat.timeout", null));
-
-        if (!maxConnections.isPresent()
-            && !maxRequests.isPresent()
-            && !poolingTimeout.isPresent()
-            && !heartbeatTimeout.isPresent()) {
-            return Optional.empty();
-        }
-        PoolingOptions result = new PoolingOptions();
-
-        maxConnections.ifPresent(value -> {
-            result.setMaxConnectionsPerHost(HostDistance.LOCAL, value);
-            result.setMaxConnectionsPerHost(HostDistance.REMOTE, value);
-        });
-        maxRequests.ifPresent(value -> {
-            result.setMaxRequestsPerConnection(HostDistance.LOCAL, value);
-            result.setMaxRequestsPerConnection(HostDistance.REMOTE, value);
-        });
-        poolingTimeout.ifPresent(result::setPoolTimeoutMillis);
-        heartbeatTimeout.ifPresent(result::setHeartbeatIntervalSeconds);
-
-        return Optional.of(result);
-    }
-
-    private List<Host> listCassandraServers(PropertiesConfiguration configuration) {
-        String[] ipAndPorts = configuration.getStringArray(CASSANDRA_NODES);
-
-        return Arrays.stream(ipAndPorts)
-                .map(string -> Host.parseConfString(string, ClusterBuilder.DEFAULT_CASSANDRA_PORT))
-                .collect(Guavate.toImmutableList());
-    }
-
-    private Optional<Integer> getOptionalIntegerFromConf(PropertiesConfiguration configuration, String key) {
-        return Optional.ofNullable(configuration.getInteger(key, null));
-    }
-
-    private Optional<Double> getOptionalDoubleFromConf(PropertiesConfiguration configuration, String key) {
-        return Optional.ofNullable(configuration.getDouble(key, null));
-    }
-
-    private QueryLoggerConfiguration getCassandraQueryLoggerConf(PropertiesConfiguration configuration) {
-        QueryLoggerConfiguration.Builder builder = QueryLoggerConfiguration.builder();
-
-        Optional<Long> constantThreshold = getOptionalIntegerFromConf(configuration, "cassandra.query.logger.constant.threshold")
-            .map(Long::valueOf);
-
-        constantThreshold.ifPresent(builder::withConstantThreshold);
-
-        getOptionalIntegerFromConf(configuration, "cassandra.query.logger.max.logged.parameters")
-            .ifPresent(builder::withMaxLoggedParameters);
-
-        getOptionalIntegerFromConf(configuration, "cassandra.query.logger.max.query.string.length")
-            .ifPresent(builder::withMaxQueryStringLength);
-
-        getOptionalIntegerFromConf(configuration, "cassandra.query.logger.max.parameter.value.length")
-            .ifPresent(builder::withMaxParameterValueLength);
-
-        Optional<Double> percentileLatencyConf = getOptionalDoubleFromConf(configuration, "cassandra.query.slow.query.latency.threshold.percentile");
-
-        if (!percentileLatencyConf.isPresent() && !constantThreshold.isPresent()) {
-            percentileLatencyConf = Optional.of(QueryLogger.DEFAULT_SLOW_QUERY_THRESHOLD_PERCENTILE);
-        }
-
-        percentileLatencyConf.ifPresent(slowQueryLatencyThresholdPercentile -> {
-            PerHostPercentileTracker tracker = PerHostPercentileTracker
-                .builder(CASSANDRA_HIGHEST_TRACKABLE_LATENCY_MILLIS)
-                .build();
-
-            builder.withDynamicThreshold(tracker, slowQueryLatencyThresholdPercentile);
-        });
-
-        return builder.build();
-    }
-
     @Override
     public Cluster get() {
         return cluster;

http://git-wip-us.apache.org/repos/asf/james-project/blob/c767bf79/server/container/guice/cassandra-guice/src/main/java/org/apache/james/server/CassandraProbe.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/server/CassandraProbe.java b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/server/CassandraProbe.java
index ff03013..8bb6952 100644
--- a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/server/CassandraProbe.java
+++ b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/server/CassandraProbe.java
@@ -21,20 +21,18 @@ package org.apache.james.server;
 
 import javax.inject.Inject;
 
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.james.backends.cassandra.init.CassandraSessionConfiguration;
-import org.apache.james.modules.mailbox.ResilientClusterProvider;
+import org.apache.james.backends.cassandra.init.configuration.ClusterConfiguration;
 import org.apache.james.utils.GuiceProbe;
 
 public class CassandraProbe implements GuiceProbe {
-    private final CassandraSessionConfiguration configuration;
+    private final ClusterConfiguration clusterConfiguration;
 
     @Inject
-    public CassandraProbe(CassandraSessionConfiguration configuration) {
-        this.configuration = configuration;
+    public CassandraProbe(ClusterConfiguration configuration) {
+        this.clusterConfiguration = configuration;
     }
 
-    public String getKeyspace() throws ConfigurationException {
-        return configuration.getConfiguration().getString(ResilientClusterProvider.CASSANDRA_KEYSPACE);
+    public String getKeyspace() {
+        return clusterConfiguration.getKeyspace();
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/c767bf79/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraLogConfigurationTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraLogConfigurationTest.java b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraLogConfigurationTest.java
deleted file mode 100644
index 090c1ff..0000000
--- a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraLogConfigurationTest.java
+++ /dev/null
@@ -1,131 +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;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.nio.ByteBuffer;
-import java.nio.channels.SocketChannel;
-import java.nio.charset.Charset;
-
-import org.apache.commons.configuration.PropertiesConfiguration;
-import org.apache.james.backends.cassandra.init.CassandraSessionConfiguration;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import com.google.inject.ProvisionException;
-
-public class CassandraLogConfigurationTest {
-
-    private static final int IMAP_PORT = 1143;
-
-    private final DockerCassandraRule dockerCassandraRule = new DockerCassandraRule();
-
-    @Rule
-    public CassandraJmapTestRule cassandraJmapTestRule = new CassandraJmapTestRule(dockerCassandraRule,
-            new EmbeddedElasticSearchRule());
-
-    @Rule
-    public ExpectedException thrown = ExpectedException.none();
-
-    private GuiceJamesServer jamesServer;
-    private SocketChannel socketChannel;
-
-    @Before
-    public void setUp() throws IOException {
-        socketChannel = SocketChannel.open();
-    }
-
-    @After
-    public void after() throws IOException {
-        socketChannel.close();
-        if (jamesServer != null) {
-            jamesServer.stop();
-        }
-    }
-
-    @Test
-    public void serverShouldStartWithMinimalConfigAboutAConstantThresholdSlowQueryLogger() throws Exception {
-        jamesServer = cassandraJmapTestRule.jmapServer(
-            (binder) -> binder.bind(CassandraSessionConfiguration.class).toInstance(() -> {
-                PropertiesConfiguration configuration = dockerCassandraRule.getCassandraConfigurationForDocker("keyspace1");
-
-                configuration.addProperty("cassandra.query.logger.constant.threshold", 100);
-
-                return configuration;
-            }));
-
-        assertThatServerStartCorrectly();
-    }
-
-    @Test
-    public void serverShouldStartWithPersonalizedConfigAboutPercentileSlowQuerryLogger() throws Exception {
-        jamesServer = cassandraJmapTestRule.jmapServer(
-            (binder) ->
-                binder.bind(CassandraSessionConfiguration.class).toInstance(() -> {
-                    PropertiesConfiguration configuration = dockerCassandraRule.getCassandraConfigurationForDocker("keyspace2");
-
-                    configuration.addProperty("cassandra.query.slow.query.latency.threshold.percentile", 90);
-                    configuration.addProperty("cassandra.query.logger.max.logged.parameters", 9);
-                    configuration.addProperty("cassandra.query.logger.max.query.string.length", 9000);
-                    configuration.addProperty("cassandra.query.logger.max.parameter.value.length", 90);
-
-                    return configuration;
-                }));
-
-        assertThatServerStartCorrectly();
-    }
-
-    @Test
-    public void serverStartShouldFailIfConfigAboutLoggerIsInvalid() throws Exception {
-        thrown.expect(ProvisionException.class);
-
-        jamesServer = cassandraJmapTestRule.jmapServer(
-            (binder) ->
-                binder.bind(CassandraSessionConfiguration.class).toInstance(() -> {
-                    PropertiesConfiguration configuration = dockerCassandraRule.getCassandraConfigurationForDocker("keyspace3");
-
-                    configuration.addProperty("cassandra.query.slow.query.latency.threshold.percentile", 90);
-                    configuration.addProperty("cassandra.query.logger.constant.threshold", 100);
-
-                    return configuration;
-                }));
-
-        assertThatServerStartCorrectly();
-    }
-
-    private void assertThatServerStartCorrectly() throws Exception {
-        jamesServer.start();
-        socketChannel.connect(new InetSocketAddress("127.0.0.1", IMAP_PORT));
-        assertThat(getServerConnectionResponse(socketChannel)).startsWith("* OK JAMES IMAP4rev1 Server");
-    }
-
-    private String getServerConnectionResponse(SocketChannel socketChannel) throws IOException {
-        ByteBuffer byteBuffer = ByteBuffer.allocate(1000);
-        socketChannel.read(byteBuffer);
-        byte[] bytes = byteBuffer.array();
-        return new String(bytes, Charset.forName("UTF-8"));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/c767bf79/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraNodeConfTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraNodeConfTest.java b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraNodeConfTest.java
index 1124382..1950bd8 100644
--- a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraNodeConfTest.java
+++ b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraNodeConfTest.java
@@ -26,16 +26,14 @@ import java.nio.ByteBuffer;
 import java.nio.channels.SocketChannel;
 import java.nio.charset.Charset;
 
-import org.apache.commons.configuration.PropertiesConfiguration;
-import org.apache.james.backends.cassandra.init.CassandraSessionConfiguration;
+import org.apache.james.backends.cassandra.init.configuration.ClusterConfiguration;
+import org.apache.james.util.Host;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.testcontainers.DockerClientFactory;
 
-import com.google.common.base.Joiner;
-
 public class CassandraNodeConfTest {
 
     private static final int CASSANDRA_PORT = 9042;
@@ -77,22 +75,24 @@ public class CassandraNodeConfTest {
     @Test
     public void serverShouldStartWhenOneCassandraNodeIsUnreachable() throws Exception {
         String unreachableNode = "10.2.3.42";
-        PropertiesConfiguration configuration = getCassandraConfigurationForDocker(
-                Joiner.on(',')
-                    .join(unreachableNode, 
-                          dockerCassandraRule.getIp() + ":" + dockerCassandraRule.getMappedPort(CASSANDRA_PORT)));
+
 
         jamesServer = cassandraJmapTestRule.jmapServer(
-                (binder) -> binder.bind(CassandraSessionConfiguration.class).toInstance(() -> configuration));
+            (binder) -> binder.bind(ClusterConfiguration.class)
+                .toInstance(clusterWithHosts(
+                    Host.from(unreachableNode, 9042),
+                    dockerCassandraRule.getHost())));
 
         assertThatServerStartCorrectly();
     }
 
+
     @Test
     public void configShouldWorkWithNonDefaultPort() throws Exception {
-        PropertiesConfiguration configuration = getCassandraConfigurationForDocker(getDockerHostIp() + ":" + dockerCassandraRule.getMappedPort(CASSANDRA_PORT));
         jamesServer = cassandraJmapTestRule.jmapServer(
-                (binder) -> binder.bind(CassandraSessionConfiguration.class).toInstance(() -> configuration));
+            (binder) -> binder.bind(ClusterConfiguration.class)
+                .toInstance(clusterWithHosts(
+                    Host.from(getDockerHostIp(), dockerCassandraRule.getMappedPort(CASSANDRA_PORT)))));
 
         assertThatServerStartCorrectly();
     }
@@ -103,16 +103,14 @@ public class CassandraNodeConfTest {
         assertThat(getServerConnectionResponse(socketChannel)).startsWith("* OK JAMES IMAP4rev1 Server");
     }
 
-    private PropertiesConfiguration getCassandraConfigurationForDocker(String confIps) {
-        PropertiesConfiguration configuration = new PropertiesConfiguration();
-
-        configuration.addProperty("cassandra.nodes", confIps);
-        configuration.addProperty("cassandra.keyspace", "apache_james");
-        configuration.addProperty("cassandra.replication.factor", 1);
-        configuration.addProperty("cassandra.retryConnection.maxRetries", 10);
-        configuration.addProperty("cassandra.retryConnection", 5000);
-
-        return configuration;
+    private ClusterConfiguration clusterWithHosts(Host... hosts) {
+        return ClusterConfiguration.builder()
+            .hosts(hosts)
+            .keyspace("apache_james")
+            .replicationFactor(1)
+            .maxRetry(10)
+            .minDelay(5000)
+            .build();
     }
 
     private String getServerConnectionResponse(SocketChannel socketChannel) throws IOException {

http://git-wip-us.apache.org/repos/asf/james-project/blob/c767bf79/server/container/guice/cassandra-guice/src/test/java/org/apache/james/DockerCassandraRule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/DockerCassandraRule.java b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/DockerCassandraRule.java
index 11ff70c..1196586 100644
--- a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/DockerCassandraRule.java
+++ b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/DockerCassandraRule.java
@@ -18,9 +18,9 @@
  ****************************************************************/
 
 package org.apache.james;
-import org.apache.commons.configuration.PropertiesConfiguration;
 import org.apache.commons.text.RandomStringGenerator;
-import org.apache.james.backends.cassandra.init.CassandraSessionConfiguration;
+import org.apache.james.backends.cassandra.init.configuration.ClusterConfiguration;
+import org.apache.james.util.Host;
 import org.junit.runner.Description;
 import org.junit.runners.model.Statement;
 import org.testcontainers.containers.GenericContainer;
@@ -31,18 +31,6 @@ import com.google.inject.Module;
 public class DockerCassandraRule implements GuiceModuleTestRule {
 
     private org.apache.james.backends.cassandra.DockerCassandraRule cassandraContainer = new org.apache.james.backends.cassandra.DockerCassandraRule();
-    
-    public PropertiesConfiguration getCassandraConfigurationForDocker(String keyspace) {
-        PropertiesConfiguration configuration = new PropertiesConfiguration();
-
-        configuration.addProperty("cassandra.nodes", cassandraContainer.getIp() + ":" + cassandraContainer.getBindingPort());
-        configuration.addProperty("cassandra.keyspace", keyspace);
-        configuration.addProperty("cassandra.replication.factor", 1);
-        configuration.addProperty("cassandra.retryConnection.maxRetries", 20);
-        configuration.addProperty("cassandra.retryConnection.minDelay", 5000);
-
-        return configuration;
-    }
 
     @Override
     public Statement apply(Statement base, Description description) {
@@ -56,13 +44,24 @@ public class DockerCassandraRule implements GuiceModuleTestRule {
     @Override
     public Module getModule() {
         String keyspace = new RandomStringGenerator.Builder().withinRange('a', 'z').build().generate(12);
-        return (binder) -> binder.bind(CassandraSessionConfiguration.class).toInstance(() -> getCassandraConfigurationForDocker(keyspace));
+        return (binder) -> binder.bind(ClusterConfiguration.class)
+            .toInstance(ClusterConfiguration.builder()
+                .host(cassandraContainer.getHost())
+                .keyspace(keyspace)
+                .replicationFactor(1)
+                .maxRetry(20)
+                .minDelay(5000)
+                .build());
     }
 
     public String getIp() {
         return cassandraContainer.getIp();
     }
 
+    public Host getHost() {
+        return cassandraContainer.getHost();
+    }
+
     public Integer getMappedPort(int originalPort) {
         return cassandraContainer.getBindingPort();
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/c767bf79/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/mailbox/CassandraSessionModuleTest.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/mailbox/CassandraSessionModuleTest.java b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/mailbox/CassandraSessionModuleTest.java
deleted file mode 100644
index 39bc3ad..0000000
--- a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/modules/mailbox/CassandraSessionModuleTest.java
+++ /dev/null
@@ -1,68 +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.modules.mailbox;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.PropertiesConfiguration;
-import org.apache.james.backends.cassandra.init.CassandraConfiguration;
-import org.junit.Before;
-import org.junit.Test;
-
-public class CassandraSessionModuleTest {
-
-    private CassandraSessionModule cassandraSessionModule;
-
-    @Before
-    public void setUp() {
-        cassandraSessionModule = new CassandraSessionModule();
-    }
-
-    @Test
-    public void provideCassandraConfigurationShouldReturnDefaultOnEmptyConfigurationFile() throws ConfigurationException {
-        CassandraConfiguration configuration = cassandraSessionModule.provideCassandraConfiguration(PropertiesConfiguration::new);
-
-        assertThat(configuration).isEqualTo(CassandraConfiguration.DEFAULT_CONFIGURATION);
-    }
-
-    @Test
-    public void provideCassandraConfigurationShouldReturnRightConfigurationFile() throws ConfigurationException {
-        CassandraConfiguration configuration = cassandraSessionModule.provideCassandraConfiguration(
-            () -> new PropertiesConfiguration(ClassLoader.getSystemResource("modules/mailbox/cassandra.properties")));
-
-        assertThat(configuration)
-            .isEqualTo(CassandraConfiguration.builder()
-                .aclMaxRetry(1)
-                .modSeqMaxRetry(2)
-                .uidMaxRetry(3)
-                .flagsUpdateMessageMaxRetry(4)
-                .flagsUpdateMessageIdMaxRetry(5)
-                .fetchNextPageInAdvanceRow(6)
-                .flagsUpdateChunkSize(7)
-                .messageReadChunkSize(8)
-                .expungeChunkSize(9)
-                .blobPartSize(10)
-                .attachmentV2MigrationReadTimeout(11)
-                .messageAttachmentIdsReadTimeout(12)
-                .build());
-    }
-
-}


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message