This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 8bfca93 CAMEL-16400: split unit and integration tests for
camel-elasticsearch-rest (#5335)
8bfca93 is described below
commit 8bfca9372d39fbf05172d5d0fdb35c484bb30c8f
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Mon Apr 12 06:27:02 2021 +0200
CAMEL-16400: split unit and integration tests for camel-elasticsearch-rest
(#5335)
---
components/camel-elasticsearch-rest/pom.xml | 71 ++--------------------
.../ElasticsearchBulkIT.java} | 4 +-
.../ElasticsearchClusterIndexIT.java} | 6 +-
...lasticsearchGetSearchDeleteExistsUpdateIT.java} | 6 +-
.../ElasticsearchIndexIT.java} | 6 +-
.../ElasticsearchPingIT.java} | 4 +-
.../ElasticsearchScrollSearchIT.java} | 5 +-
.../ElasticsearchSizeLimitIT.java} | 4 +-
.../ElasticsearchTestSupport.java} | 9 +--
9 files changed, 31 insertions(+), 84 deletions(-)
diff --git a/components/camel-elasticsearch-rest/pom.xml
b/components/camel-elasticsearch-rest/pom.xml
index 27e513d..6725e99 100644
--- a/components/camel-elasticsearch-rest/pom.xml
+++ b/components/camel-elasticsearch-rest/pom.xml
@@ -117,72 +117,11 @@
<reuseForks>false</reuseForks>
</configuration>
</plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ </plugin>
</plugins>
</build>
-
-
- <profiles>
- <profile>
- <id>elasticsearch-skip-tests</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skipTests>true</skipTests>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <!-- activate test if the docker socket file is accessible -->
- <profile>
- <id>elasticsearch-tests-docker-file</id>
- <activation>
- <file>
- <exists>/var/run/docker.sock</exists>
- </file>
- </activation>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skipTests>${skipTests}</skipTests>
- <systemPropertyVariables>
-
<visibleassertions.silence>true</visibleassertions.silence>
- </systemPropertyVariables>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <!-- activate test if the DOCKER_HOST env var is set -->
- <profile>
- <id>elasticsearch-tests-docker-env</id>
- <activation>
- <property>
- <name>env.DOCKER_HOST</name>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skipTests>${skipTests}</skipTests>
- <systemPropertyVariables>
-
<visibleassertions.silence>true</visibleassertions.silence>
- </systemPropertyVariables>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
</project>
diff --git
a/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchBulkTest.java
b/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/integration/ElasticsearchBulkIT.java
similarity index 97%
rename from
components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchBulkTest.java
rename to
components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/integration/ElasticsearchBulkIT.java
index fb08c84..3d60eca 100644
---
a/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchBulkTest.java
+++
b/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/integration/ElasticsearchBulkIT.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.component.elasticsearch;
+package org.apache.camel.component.elasticsearch.integration;
import java.util.ArrayList;
import java.util.HashMap;
@@ -34,7 +34,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
-public class ElasticsearchBulkTest extends ElasticsearchBaseTest {
+public class ElasticsearchBulkIT extends ElasticsearchTestSupport {
@Test
public void testBulkIndex() throws Exception {
diff --git
a/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchClusterIndexTest.java
b/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/integration/ElasticsearchClusterIndexIT.java
similarity index 93%
rename from
components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchClusterIndexTest.java
rename to
components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/integration/ElasticsearchClusterIndexIT.java
index 98f25fa..b77e6a8 100644
---
a/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchClusterIndexTest.java
+++
b/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/integration/ElasticsearchClusterIndexIT.java
@@ -14,12 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.component.elasticsearch;
+package org.apache.camel.component.elasticsearch.integration;
import java.util.HashMap;
import java.util.Map;
import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.elasticsearch.ElasticsearchConstants;
+import org.apache.camel.component.elasticsearch.ElasticsearchOperation;
import org.apache.http.impl.client.BasicResponseHandler;
import org.elasticsearch.action.get.GetRequest;
import org.elasticsearch.client.Request;
@@ -30,7 +32,7 @@ import static
org.apache.camel.test.junit5.TestSupport.assertStringContains;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
-public class ElasticsearchClusterIndexTest extends ElasticsearchBaseTest {
+public class ElasticsearchClusterIndexIT extends ElasticsearchTestSupport {
@Test
public void indexWithIpAndPort() throws Exception {
Map<String, String> map = createIndexedData();
diff --git
a/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchGetSearchDeleteExistsUpdateTest.java
b/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/integration/ElasticsearchGetSearchDeleteExistsUpdateIT.java
similarity index 98%
rename from
components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchGetSearchDeleteExistsUpdateTest.java
rename to
components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/integration/ElasticsearchGetSearchDeleteExistsUpdateIT.java
index f432251..911b736 100644
---
a/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchGetSearchDeleteExistsUpdateTest.java
+++
b/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/integration/ElasticsearchGetSearchDeleteExistsUpdateIT.java
@@ -14,12 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.component.elasticsearch;
+package org.apache.camel.component.elasticsearch.integration;
import java.util.HashMap;
import java.util.Map;
import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.elasticsearch.ElasticsearchConstants;
+import org.apache.camel.component.elasticsearch.ElasticsearchOperation;
import org.elasticsearch.action.DocWriteResponse;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.action.delete.DeleteResponse;
@@ -41,7 +43,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
-public class ElasticsearchGetSearchDeleteExistsUpdateTest extends
ElasticsearchBaseTest {
+public class ElasticsearchGetSearchDeleteExistsUpdateIT extends
ElasticsearchTestSupport {
@Test
public void testGet() throws Exception {
diff --git
a/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchIndexTest.java
b/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/integration/ElasticsearchIndexIT.java
similarity index 93%
rename from
components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchIndexTest.java
rename to
components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/integration/ElasticsearchIndexIT.java
index 2447bd8..c667548 100644
---
a/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchIndexTest.java
+++
b/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/integration/ElasticsearchIndexIT.java
@@ -14,19 +14,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.component.elasticsearch;
+package org.apache.camel.component.elasticsearch.integration;
import java.util.HashMap;
import java.util.Map;
import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.elasticsearch.ElasticsearchConstants;
+import org.apache.camel.component.elasticsearch.ElasticsearchOperation;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
-public class ElasticsearchIndexTest extends ElasticsearchBaseTest {
+public class ElasticsearchIndexIT extends ElasticsearchTestSupport {
@Test
public void testIndex() throws Exception {
diff --git
a/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchPingTest.java
b/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/integration/ElasticsearchPingIT.java
similarity index 91%
rename from
components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchPingTest.java
rename to
components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/integration/ElasticsearchPingIT.java
index c314020..312fd76 100644
---
a/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchPingTest.java
+++
b/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/integration/ElasticsearchPingIT.java
@@ -14,14 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.component.elasticsearch;
+package org.apache.camel.component.elasticsearch.integration;
import org.apache.camel.builder.RouteBuilder;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertTrue;
-public class ElasticsearchPingTest extends ElasticsearchBaseTest {
+public class ElasticsearchPingIT extends ElasticsearchTestSupport {
@Test
public void testPing() throws Exception {
diff --git
a/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchScrollSearchTest.java
b/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/integration/ElasticsearchScrollSearchIT.java
similarity index 97%
rename from
components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchScrollSearchTest.java
rename to
components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/integration/ElasticsearchScrollSearchIT.java
index 1004b40..93b9aef 100644
---
a/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchScrollSearchTest.java
+++
b/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/integration/ElasticsearchScrollSearchIT.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.component.elasticsearch;
+package org.apache.camel.component.elasticsearch.integration;
import java.io.IOException;
import java.util.ArrayList;
@@ -27,6 +27,7 @@ import org.apache.camel.Exchange;
import org.apache.camel.builder.AggregationStrategies;
import org.apache.camel.builder.ExchangeBuilder;
import org.apache.camel.builder.RouteBuilder;
+import
org.apache.camel.component.elasticsearch.ElasticsearchScrollRequestIterator;
import org.apache.camel.component.mock.MockEndpoint;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.client.Request;
@@ -42,7 +43,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
-public class ElasticsearchScrollSearchTest extends ElasticsearchBaseTest {
+public class ElasticsearchScrollSearchIT extends ElasticsearchTestSupport {
private static final String TWITTER_ES_INDEX_NAME = "twitter";
private static final String SPLIT_TWITTER_ES_INDEX_NAME = "split-" +
TWITTER_ES_INDEX_NAME;
diff --git
a/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchSizeLimitTest.java
b/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/integration/ElasticsearchSizeLimitIT.java
similarity index 95%
rename from
components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchSizeLimitTest.java
rename to
components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/integration/ElasticsearchSizeLimitIT.java
index 98bcea2..cc2d045 100644
---
a/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchSizeLimitTest.java
+++
b/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/integration/ElasticsearchSizeLimitIT.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.component.elasticsearch;
+package org.apache.camel.component.elasticsearch.integration;
import java.util.HashMap;
import java.util.Map;
@@ -26,7 +26,7 @@ import org.elasticsearch.search.SearchHits;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
-public class ElasticsearchSizeLimitTest extends ElasticsearchBaseTest {
+public class ElasticsearchSizeLimitIT extends ElasticsearchTestSupport {
@Disabled("Looks like there were some assumption related to test executed
before")
@Test
diff --git
a/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchBaseTest.java
b/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/integration/ElasticsearchTestSupport.java
similarity index 94%
rename from
components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchBaseTest.java
rename to
components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/integration/ElasticsearchTestSupport.java
index a2bf304..b432d69 100644
---
a/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/ElasticsearchBaseTest.java
+++
b/components/camel-elasticsearch-rest/src/test/java/org/apache/camel/component/elasticsearch/integration/ElasticsearchTestSupport.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.component.elasticsearch;
+package org.apache.camel.component.elasticsearch.integration;
import java.net.HttpURLConnection;
import java.time.Duration;
@@ -22,6 +22,7 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.camel.CamelContext;
+import org.apache.camel.component.elasticsearch.ElasticsearchComponent;
import
org.apache.camel.test.infra.elasticsearch.services.ElasticSearchLocalContainerService;
import org.apache.camel.test.infra.elasticsearch.services.ElasticSearchService;
import
org.apache.camel.test.infra.elasticsearch.services.ElasticSearchServiceFactory;
@@ -37,7 +38,7 @@ import
org.testcontainers.containers.wait.strategy.HttpWaitStrategy;
import org.testcontainers.utility.Base58;
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
-public class ElasticsearchBaseTest extends CamelTestSupport {
+public class ElasticsearchTestSupport extends CamelTestSupport {
public static final int ELASTICSEARCH_DEFAULT_PORT = 9200;
public static final int ELASTICSEARCH_DEFAULT_TCP_PORT = 9300;
@@ -45,14 +46,14 @@ public class ElasticsearchBaseTest extends CamelTestSupport
{
@RegisterExtension
public static ElasticSearchService service = ElasticSearchServiceFactory
.builder()
- .addLocalMapping(ElasticsearchBaseTest::createElasticSearchService)
+
.addLocalMapping(ElasticsearchTestSupport::createElasticSearchService)
.build();
protected static String clusterName = "docker-cluster";
protected static RestClient restClient;
protected static RestHighLevelClient client;
- private static final Logger LOG =
LoggerFactory.getLogger(ElasticsearchBaseTest.class);
+ private static final Logger LOG =
LoggerFactory.getLogger(ElasticsearchTestSupport.class);
private static ElasticSearchLocalContainerService
createElasticSearchService() {
ElasticSearchLocalContainerService ret = new
ElasticSearchLocalContainerService();