This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit f20869c59c222bea5247ee98446acea22745ca39
Author: Tran Tien Duc <dt...@linagora.com>
AuthorDate: Wed May 8 16:09:20 2019 +0700

    JAMES-2717 Replace embedded ES in RabbitMQ cucumber tests
---
 .../awss3/CucumberElasticSearchSingleton.java      | 27 ++++++++++++++++++++++
 .../cucumber/awss3/RabbitMQAwsS3Stepdefs.java      | 25 ++++++++++----------
 2 files changed, 39 insertions(+), 13 deletions(-)

diff --git 
a/server/protocols/jmap-integration-testing/rabbitmq-jmap-integration-testing/src/test/java/org/apache/james/jmap/rabbitmq/cucumber/awss3/CucumberElasticSearchSingleton.java
 
b/server/protocols/jmap-integration-testing/rabbitmq-jmap-integration-testing/src/test/java/org/apache/james/jmap/rabbitmq/cucumber/awss3/CucumberElasticSearchSingleton.java
new file mode 100644
index 0000000..d1bfed0
--- /dev/null
+++ 
b/server/protocols/jmap-integration-testing/rabbitmq-jmap-integration-testing/src/test/java/org/apache/james/jmap/rabbitmq/cucumber/awss3/CucumberElasticSearchSingleton.java
@@ -0,0 +1,27 @@
+/****************************************************************
+ * 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.jmap.rabbitmq.cucumber.awss3;
+
+import org.apache.james.DockerElasticSearchRule;
+
+class CucumberElasticSearchSingleton {
+
+    static final DockerElasticSearchRule elasticSearch = new 
DockerElasticSearchRule();
+
+}
diff --git 
a/server/protocols/jmap-integration-testing/rabbitmq-jmap-integration-testing/src/test/java/org/apache/james/jmap/rabbitmq/cucumber/awss3/RabbitMQAwsS3Stepdefs.java
 
b/server/protocols/jmap-integration-testing/rabbitmq-jmap-integration-testing/src/test/java/org/apache/james/jmap/rabbitmq/cucumber/awss3/RabbitMQAwsS3Stepdefs.java
index 01d6747..9241c6b 100644
--- 
a/server/protocols/jmap-integration-testing/rabbitmq-jmap-integration-testing/src/test/java/org/apache/james/jmap/rabbitmq/cucumber/awss3/RabbitMQAwsS3Stepdefs.java
+++ 
b/server/protocols/jmap-integration-testing/rabbitmq-jmap-integration-testing/src/test/java/org/apache/james/jmap/rabbitmq/cucumber/awss3/RabbitMQAwsS3Stepdefs.java
@@ -28,16 +28,15 @@ import 
org.apache.activemq.store.memory.MemoryPersistenceAdapter;
 import org.apache.james.CassandraRabbitMQJamesServerMain;
 import org.apache.james.CleanupTasksPerformer;
 import org.apache.james.DockerCassandraRule;
+import org.apache.james.DockerElasticSearchRule;
 import org.apache.james.GuiceJamesServer;
-import org.apache.james.backends.es.EmbeddedElasticSearch;
 import org.apache.james.jmap.methods.integration.cucumber.ImapStepdefs;
 import org.apache.james.jmap.methods.integration.cucumber.MainStepdefs;
 import org.apache.james.mailbox.cassandra.ids.CassandraMessageId;
 import org.apache.james.mailbox.extractor.TextExtractor;
 import org.apache.james.mailbox.store.extractor.DefaultTextExtractor;
 import org.apache.james.modules.DockerRabbitMQRule;
-import org.apache.james.modules.TestEmbeddedESMetricReporterModule;
-import org.apache.james.modules.TestEmbeddedElasticSearchModule;
+import org.apache.james.modules.TestDockerESMetricReporterModule;
 import org.apache.james.modules.TestJMAPServerModule;
 import org.apache.james.modules.TestRabbitMQModule;
 import org.apache.james.modules.objectstorage.aws.s3.DockerAwsS3TestRule;
@@ -58,11 +57,11 @@ public class RabbitMQAwsS3Stepdefs {
     private static final int JMAP_GET_MESSAGE_LIST_MAXIMUM_LIMIT = 10;
     private final MainStepdefs mainStepdefs;
     private final ImapStepdefs imapStepdefs;
-    private TemporaryFolder temporaryFolder = new TemporaryFolder();
-    private EmbeddedElasticSearch embeddedElasticSearch = new 
EmbeddedElasticSearch(temporaryFolder);
-    private DockerCassandraRule cassandraServer = 
CucumberCassandraSingleton.cassandraServer;
-    private DockerRabbitMQRule rabbitMQServer = 
CucumberRabbitMQSingleton.rabbitMQServer;
-    private DockerAwsS3TestRule swiftServer = 
CucumberAwsS3Singleton.awsS3Server;
+    private final TemporaryFolder temporaryFolder = new TemporaryFolder();
+    private final DockerCassandraRule cassandraServer = 
CucumberCassandraSingleton.cassandraServer;
+    private final DockerElasticSearchRule elasticSearch = 
CucumberElasticSearchSingleton.elasticSearch;
+    private final DockerRabbitMQRule rabbitMQServer = 
CucumberRabbitMQSingleton.rabbitMQServer;
+    private final DockerAwsS3TestRule swiftServer = 
CucumberAwsS3Singleton.awsS3Server;
 
     @Inject
     private RabbitMQAwsS3Stepdefs(MainStepdefs mainStepdefs, ImapStepdefs 
imapStepdefs) {
@@ -75,9 +74,9 @@ public class RabbitMQAwsS3Stepdefs {
         cassandraServer.start();
         rabbitMQServer.start();
         swiftServer.start();
+        elasticSearch.start();
 
         temporaryFolder.create();
-        embeddedElasticSearch.before();
         mainStepdefs.messageIdFactory = new CassandraMessageId.Factory();
         Configuration configuration = Configuration.builder()
                 .workingDirectory(temporaryFolder.newFolder())
@@ -87,16 +86,16 @@ public class RabbitMQAwsS3Stepdefs {
         mainStepdefs.jmapServer = 
GuiceJamesServer.forConfiguration(configuration)
                 .combineWith(CassandraRabbitMQJamesServerMain.MODULES)
                 .overrideWith(new 
TestJMAPServerModule(JMAP_GET_MESSAGE_LIST_MAXIMUM_LIMIT))
-                .overrideWith(new TestEmbeddedESMetricReporterModule())
+                .overrideWith(new 
TestDockerESMetricReporterModule(elasticSearch.getDockerEs().getHttpHost()))
                 .overrideWith(new 
TestRabbitMQModule(rabbitMQServer.dockerRabbitMQ()))
                 .overrideWith(swiftServer.getModule())
-                .overrideWith(new 
TestEmbeddedElasticSearchModule(embeddedElasticSearch))
+                .overrideWith(elasticSearch.getModule())
                 .overrideWith(cassandraServer.getModule())
                 .overrideWith(binder -> 
binder.bind(TextExtractor.class).to(DefaultTextExtractor.class))
                 .overrideWith((binder) -> 
binder.bind(PersistenceAdapter.class).to(MemoryPersistenceAdapter.class))
                 .overrideWith(binder -> Multibinder.newSetBinder(binder, 
CleanupTasksPerformer.CleanupTask.class).addBinding().to(CassandraTruncateTableTask.class))
                 .overrideWith((binder -> 
binder.bind(CleanupTasksPerformer.class).asEagerSingleton()));
-        mainStepdefs.awaitMethod = () -> 
embeddedElasticSearch.awaitForElasticSearch();
+        mainStepdefs.awaitMethod = () -> 
elasticSearch.getDockerEs().awaitForElasticSearch();
         mainStepdefs.init();
     }
 
@@ -104,7 +103,7 @@ public class RabbitMQAwsS3Stepdefs {
     public void tearDown() {
         ignoreFailures(imapStepdefs::closeConnections,
                 mainStepdefs::tearDown,
-                () -> embeddedElasticSearch.after(),
+                () -> elasticSearch.getDockerEs().cleanUpData(),
                 () -> temporaryFolder.delete());
     }
 


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

Reply via email to