You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2019/05/10 11:30:20 UTC
[james-project] 07/17: JAMES-2717 Adding DockerElasticSearchRule
for junit4 tests
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 5bb4b29540ef41e843aec2a1caf932b80345c466
Author: Tran Tien Duc <dt...@linagora.com>
AuthorDate: Wed May 8 19:00:02 2019 +0700
JAMES-2717 Adding DockerElasticSearchRule for junit4 tests
---
.../james/backends/es/DockerElasticSearchRule.java | 50 ++++++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/DockerElasticSearchRule.java b/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/DockerElasticSearchRule.java
new file mode 100644
index 0000000..7e140dc
--- /dev/null
+++ b/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/DockerElasticSearchRule.java
@@ -0,0 +1,50 @@
+/****************************************************************
+ * 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.es;
+
+import org.apache.james.util.Host;
+import org.junit.rules.ExternalResource;
+
+public class DockerElasticSearchRule extends ExternalResource {
+
+ private final DockerElasticSearch dockerElasticSearch = DockerElasticSearchSingleton.INSTANCE;
+
+ @Override
+ protected void before() throws Throwable {
+ dockerElasticSearch.start();
+ }
+
+ @Override
+ protected void after() {
+ dockerElasticSearch.cleanUpData();
+ }
+
+ public ClientProvider clientProvider() {
+ return dockerElasticSearch.clientProvider();
+ }
+
+ public void awaitForElasticSearch() {
+ dockerElasticSearch.awaitForElasticSearch();
+ }
+
+ public Host getTcpHost() {
+ return dockerElasticSearch.getTcpHost();
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org