james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [7/7] james-project git commit: JAMES-2599 Binding SwiftBlobStore in tests should be done at one place
Date Thu, 22 Nov 2018 10:51:40 GMT
JAMES-2599 Binding SwiftBlobStore in tests should be done at one place


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

Branch: refs/heads/master
Commit: a966c5e7e20620185a21e395866f85f32c80944d
Parents: 71a2004
Author: tran tien duc <dtran@linagora.com>
Authored: Thu Nov 22 11:14:06 2018 +0700
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Thu Nov 22 17:50:55 2018 +0700

----------------------------------------------------------------------
 .../mpt/smtp/CassandraRabbitMQSwiftSmtpTestRule.java      |  2 --
 .../apache/james/CassandraRabbitMQSwiftJmapTestRule.java  |  3 ---
 .../org/apache/james/modules/SwiftBlobStoreExtension.java |  6 +++++-
 .../apache/james/modules/TestSwiftBlobStoreModule.java    | 10 +++++++++-
 .../jmap/rabbitmq/RabbitMQSpamAssassinContractTest.java   |  3 ---
 .../james/jmap/rabbitmq/cucumber/RabbitMQStepdefs.java    |  3 ---
 6 files changed, 14 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/a966c5e7/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/java/org/apache/james/mpt/smtp/CassandraRabbitMQSwiftSmtpTestRule.java
----------------------------------------------------------------------
diff --git a/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/java/org/apache/james/mpt/smtp/CassandraRabbitMQSwiftSmtpTestRule.java
b/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/java/org/apache/james/mpt/smtp/CassandraRabbitMQSwiftSmtpTestRule.java
index e1b32a5..71d6dd9 100644
--- a/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/java/org/apache/james/mpt/smtp/CassandraRabbitMQSwiftSmtpTestRule.java
+++ b/mpt/impl/smtp/cassandra-rabbitmq-swift/src/test/java/org/apache/james/mpt/smtp/CassandraRabbitMQSwiftSmtpTestRule.java
@@ -30,7 +30,6 @@ import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.dnsservice.api.InMemoryDNSService;
 import org.apache.james.modules.TestRabbitMQModule;
 import org.apache.james.modules.TestSwiftBlobStoreModule;
-import org.apache.james.modules.blobstore.BlobStoreChoosingConfiguration;
 import org.apache.james.modules.blobstore.BlobStoreChoosingModule;
 import org.apache.james.modules.protocols.ProtocolHandlerModule;
 import org.apache.james.modules.protocols.SMTPServerModule;
@@ -163,7 +162,6 @@ public class CassandraRabbitMQSwiftSmtpTestRule implements TestRule, SmtpHostSys
                     .toInstance(DefaultConfigurationBuilder::new))
             .overrideWith(new TestRabbitMQModule(DockerRabbitMQSingleton.SINGLETON))
             .overrideWith(new TestSwiftBlobStoreModule())
-            .overrideWith(binder -> binder.bind(BlobStoreChoosingConfiguration.class).toInstance(BlobStoreChoosingConfiguration.objectStorage()))
             .overrideWith(
                 binder -> binder.bind(ClusterConfiguration.class).toInstance(
                     ClusterConfiguration.builder()

http://git-wip-us.apache.org/repos/asf/james-project/blob/a966c5e7/server/container/guice/cassandra-rabbitmq-guice/src/test/java/org/apache/james/CassandraRabbitMQSwiftJmapTestRule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-rabbitmq-guice/src/test/java/org/apache/james/CassandraRabbitMQSwiftJmapTestRule.java
b/server/container/guice/cassandra-rabbitmq-guice/src/test/java/org/apache/james/CassandraRabbitMQSwiftJmapTestRule.java
index b969028..b38851a 100644
--- a/server/container/guice/cassandra-rabbitmq-guice/src/test/java/org/apache/james/CassandraRabbitMQSwiftJmapTestRule.java
+++ b/server/container/guice/cassandra-rabbitmq-guice/src/test/java/org/apache/james/CassandraRabbitMQSwiftJmapTestRule.java
@@ -28,7 +28,6 @@ import org.apache.james.modules.TestESMetricReporterModule;
 import org.apache.james.modules.TestJMAPServerModule;
 import org.apache.james.modules.TestRabbitMQModule;
 import org.apache.james.modules.TestSwiftBlobStoreModule;
-import org.apache.james.modules.blobstore.BlobStoreChoosingConfiguration;
 import org.apache.james.server.core.configuration.Configuration;
 import org.junit.rules.TemporaryFolder;
 import org.junit.rules.TestRule;
@@ -68,8 +67,6 @@ public class CassandraRabbitMQSwiftJmapTestRule implements TestRule {
             .overrideWith(binder -> binder.bind(TextExtractor.class).to(PDFTextExtractor.class))
             .overrideWith(new TestRabbitMQModule(DockerRabbitMQSingleton.SINGLETON))
             .overrideWith(new TestSwiftBlobStoreModule())
-            .overrideWith(binder -> binder.bind(BlobStoreChoosingConfiguration.class)
-                .toInstance(BlobStoreChoosingConfiguration.objectStorage()))
             .overrideWith(new TestJMAPServerModule(LIMIT_TO_10_MESSAGES))
             .overrideWith(new TestESMetricReporterModule())
             .overrideWith(guiceModuleTestRule.getModule())

http://git-wip-us.apache.org/repos/asf/james-project/blob/a966c5e7/server/container/guice/cassandra-rabbitmq-guice/src/test/java/org/apache/james/modules/SwiftBlobStoreExtension.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-rabbitmq-guice/src/test/java/org/apache/james/modules/SwiftBlobStoreExtension.java
b/server/container/guice/cassandra-rabbitmq-guice/src/test/java/org/apache/james/modules/SwiftBlobStoreExtension.java
index 5d7b25f..71d4d92 100644
--- a/server/container/guice/cassandra-rabbitmq-guice/src/test/java/org/apache/james/modules/SwiftBlobStoreExtension.java
+++ b/server/container/guice/cassandra-rabbitmq-guice/src/test/java/org/apache/james/modules/SwiftBlobStoreExtension.java
@@ -20,10 +20,12 @@
 package org.apache.james.modules;
 
 import org.apache.james.GuiceModuleTestExtension;
+import org.apache.james.modules.blobstore.BlobStoreChoosingConfiguration;
 import org.apache.james.modules.objectstorage.guice.DockerSwiftTestRule;
 import org.junit.jupiter.api.extension.ExtensionContext;
 
 import com.google.inject.Module;
+import com.google.inject.util.Modules;
 
 public class SwiftBlobStoreExtension implements GuiceModuleTestExtension {
 
@@ -41,6 +43,8 @@ public class SwiftBlobStoreExtension implements GuiceModuleTestExtension
{
 
     @Override
     public Module getModule() {
-        return swiftRule.getModule();
+        return Modules.override(swiftRule.getModule())
+            .with(binder -> binder.bind(BlobStoreChoosingConfiguration.class)
+                .toInstance(BlobStoreChoosingConfiguration.objectStorage()));
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/a966c5e7/server/container/guice/cassandra-rabbitmq-guice/src/test/java/org/apache/james/modules/TestSwiftBlobStoreModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-rabbitmq-guice/src/test/java/org/apache/james/modules/TestSwiftBlobStoreModule.java
b/server/container/guice/cassandra-rabbitmq-guice/src/test/java/org/apache/james/modules/TestSwiftBlobStoreModule.java
index ef50cf7..2f4a052 100644
--- a/server/container/guice/cassandra-rabbitmq-guice/src/test/java/org/apache/james/modules/TestSwiftBlobStoreModule.java
+++ b/server/container/guice/cassandra-rabbitmq-guice/src/test/java/org/apache/james/modules/TestSwiftBlobStoreModule.java
@@ -19,9 +19,12 @@
 
 package org.apache.james.modules;
 
+import org.apache.james.modules.blobstore.BlobStoreChoosingConfiguration;
 import org.apache.james.modules.objectstorage.guice.DockerSwiftTestRule;
 
 import com.google.inject.AbstractModule;
+import com.google.inject.Module;
+import com.google.inject.util.Modules;
 
 public class TestSwiftBlobStoreModule extends AbstractModule {
 
@@ -33,6 +36,11 @@ public class TestSwiftBlobStoreModule extends AbstractModule {
 
     @Override
     protected void configure() {
-        install(dockerSwiftTestRule.getModule());
+        Module testSwiftBlobStoreModule = Modules
+            .override(dockerSwiftTestRule.getModule())
+            .with(binder -> binder.bind(BlobStoreChoosingConfiguration.class)
+                .toInstance(BlobStoreChoosingConfiguration.objectStorage()));
+
+        install(testSwiftBlobStoreModule);
     }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/a966c5e7/server/protocols/jmap-integration-testing/rabbitmq-jmap-integration-testing/src/test/java/org/apache/james/jmap/rabbitmq/RabbitMQSpamAssassinContractTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/rabbitmq-jmap-integration-testing/src/test/java/org/apache/james/jmap/rabbitmq/RabbitMQSpamAssassinContractTest.java
b/server/protocols/jmap-integration-testing/rabbitmq-jmap-integration-testing/src/test/java/org/apache/james/jmap/rabbitmq/RabbitMQSpamAssassinContractTest.java
index ecb72e5..c74dedf 100644
--- a/server/protocols/jmap-integration-testing/rabbitmq-jmap-integration-testing/src/test/java/org/apache/james/jmap/rabbitmq/RabbitMQSpamAssassinContractTest.java
+++ b/server/protocols/jmap-integration-testing/rabbitmq-jmap-integration-testing/src/test/java/org/apache/james/jmap/rabbitmq/RabbitMQSpamAssassinContractTest.java
@@ -31,7 +31,6 @@ import org.apache.james.mailbox.store.search.PDFTextExtractor;
 import org.apache.james.modules.RabbitMQExtension;
 import org.apache.james.modules.SwiftBlobStoreExtension;
 import org.apache.james.modules.TestJMAPServerModule;
-import org.apache.james.modules.blobstore.BlobStoreChoosingConfiguration;
 import org.junit.jupiter.api.extension.RegisterExtension;
 
 class RabbitMQSpamAssassinContractTest implements SpamAssassinContract {
@@ -49,8 +48,6 @@ class RabbitMQSpamAssassinContractTest implements SpamAssassinContract {
         .server(configuration -> GuiceJamesServer.forConfiguration(configuration)
             .combineWith(CassandraRabbitMQJamesServerMain.MODULES)
             .overrideWith(binder -> binder.bind(TextExtractor.class).to(PDFTextExtractor.class))
-            .overrideWith(binder -> binder.bind(BlobStoreChoosingConfiguration.class)
-                .toInstance(BlobStoreChoosingConfiguration.objectStorage()))
             .overrideWith(new TestJMAPServerModule(LIMIT_TO_20_MESSAGES)))
         .build();
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/a966c5e7/server/protocols/jmap-integration-testing/rabbitmq-jmap-integration-testing/src/test/java/org/apache/james/jmap/rabbitmq/cucumber/RabbitMQStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/rabbitmq-jmap-integration-testing/src/test/java/org/apache/james/jmap/rabbitmq/cucumber/RabbitMQStepdefs.java
b/server/protocols/jmap-integration-testing/rabbitmq-jmap-integration-testing/src/test/java/org/apache/james/jmap/rabbitmq/cucumber/RabbitMQStepdefs.java
index 088c72b..83cbab3 100644
--- a/server/protocols/jmap-integration-testing/rabbitmq-jmap-integration-testing/src/test/java/org/apache/james/jmap/rabbitmq/cucumber/RabbitMQStepdefs.java
+++ b/server/protocols/jmap-integration-testing/rabbitmq-jmap-integration-testing/src/test/java/org/apache/james/jmap/rabbitmq/cucumber/RabbitMQStepdefs.java
@@ -41,7 +41,6 @@ import org.apache.james.modules.TestElasticSearchModule;
 import org.apache.james.modules.TestJMAPServerModule;
 import org.apache.james.modules.TestRabbitMQModule;
 import org.apache.james.modules.TestSwiftBlobStoreModule;
-import org.apache.james.modules.blobstore.BlobStoreChoosingConfiguration;
 import org.apache.james.modules.objectstorage.guice.DockerSwiftTestRule;
 import org.apache.james.server.CassandraTruncateTableTask;
 import org.apache.james.server.core.configuration.Configuration;
@@ -91,8 +90,6 @@ public class RabbitMQStepdefs {
             .overrideWith(new TestESMetricReporterModule())
             .overrideWith(new TestRabbitMQModule(rabbitMQServer.dockerRabbitMQ()))
             .overrideWith(new TestSwiftBlobStoreModule())
-            .overrideWith(binder -> binder.bind(BlobStoreChoosingConfiguration.class)
-                .toInstance(BlobStoreChoosingConfiguration.objectStorage()))
             .overrideWith(new TestElasticSearchModule(embeddedElasticSearch))
             .overrideWith(cassandraServer.getModule())
             .overrideWith(binder -> binder.bind(TextExtractor.class).to(DefaultTextExtractor.class))


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