james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [4/7] james-project git commit: JAMES-2446 Avoid double creation trial in tests
Date Tue, 03 Jul 2018 08:51:42 GMT
JAMES-2446 Avoid double creation trial in tests


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/7a9a514e
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/7a9a514e
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/7a9a514e

Branch: refs/heads/master
Commit: 7a9a514ed21da2823f2d751e0ef827ea111ffbea
Parents: b7e2dae
Author: benwa <btellier@linagora.com>
Authored: Fri Jun 29 17:51:14 2018 +0700
Committer: benwa <btellier@linagora.com>
Committed: Tue Jul 3 15:50:45 2018 +0700

----------------------------------------------------------------------
 .../cassandra/init/SessionWithInitializedTablesFactory.java      | 2 +-
 .../org/apache/james/backends/cassandra/CassandraCluster.java    | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/7a9a514e/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/SessionWithInitializedTablesFactory.java
----------------------------------------------------------------------
diff --git a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/SessionWithInitializedTablesFactory.java
b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/SessionWithInitializedTablesFactory.java
index ebfd70b..d87b41b 100644
--- a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/SessionWithInitializedTablesFactory.java
+++ b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/SessionWithInitializedTablesFactory.java
@@ -41,7 +41,7 @@ public class SessionWithInitializedTablesFactory implements Provider<Session>
{
         this.session = createSession(cluster, clusterConfiguration.getKeyspace());
     }
 
-    public Session createSession(Cluster cluster, String keyspace) {
+    private Session createSession(Cluster cluster, String keyspace) {
         Session session = cluster.connect(keyspace);
         try {
             new CassandraTypesCreator(module, session)

http://git-wip-us.apache.org/repos/asf/james-project/blob/7a9a514e/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/CassandraCluster.java
----------------------------------------------------------------------
diff --git a/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/CassandraCluster.java
b/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/CassandraCluster.java
index 8e20b52..cc885ef 100644
--- a/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/CassandraCluster.java
+++ b/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/CassandraCluster.java
@@ -93,7 +93,9 @@ public final class CassandraCluster implements AutoCloseable {
                 .replicationFactor(REPLICATION_FACTOR)
                 .disableDurableWrites()
                 .clusterWithInitializedKeyspace();
-            return Optional.of(new SessionWithInitializedTablesFactory(clusterConfiguration,
clusterWithInitializedKeyspace, module).createSession(clusterWithInitializedKeyspace, keyspace));
+
+            return Optional.of(new SessionWithInitializedTablesFactory(clusterConfiguration,
clusterWithInitializedKeyspace, module)
+                .get());
         } catch (NoHostAvailableException exception) {
             sleep(SLEEP_BEFORE_RETRY);
             return Optional.empty();


---------------------------------------------------------------------
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