This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/master by this push:
new 62d2b10 Add native support for Elasticsearch REST
62d2b10 is described below
commit 62d2b10b24802a008419a8fcded4defe11db8c4c
Author: James Netherton <[email protected]>
AuthorDate: Wed Apr 29 13:12:23 2020 +0100
Add native support for Elasticsearch REST
Fixes #896
---
.github/test-categories.yaml | 1 +
.../pages/list-of-camel-quarkus-extensions.adoc | 6 +-
.../rest/it/ElasticsearchRestResource.java | 51 -----------
extensions-jvm/pom.xml | 1 -
.../elasticsearch-rest/deployment/pom.xml | 6 +-
.../deployment/ElasticsearchRestProcessor.java | 18 ----
.../elasticsearch-rest/pom.xml | 3 +-
.../elasticsearch-rest/runtime/pom.xml | 10 ++-
.../main/resources/META-INF/quarkus-extension.yaml | 10 +--
extensions/pom.xml | 1 +
.../elasticsearch-rest}/pom.xml | 55 +++++++++++-
.../rest/it/ElasticsearchRestResource.java | 99 ++++++++++++++++++++++
.../rest/it/ElasticSearchTestResource.java | 70 +++++++++++++++
.../elasticsearch/rest/it/ElasticsearchRestIT.java | 17 +---
.../rest/it/ElasticsearchRestTest.java | 86 +++++++++++++++++++
integration-tests/pom.xml | 1 +
pom.xml | 1 +
poms/bom/pom.xml | 11 +++
.../quarkus/maven/UpdateDocExtensionsListMojo.java | 5 ++
19 files changed, 351 insertions(+), 101 deletions(-)
diff --git a/.github/test-categories.yaml b/.github/test-categories.yaml
index b27fc0a..6f50383 100644
--- a/.github/test-categories.yaml
+++ b/.github/test-categories.yaml
@@ -22,6 +22,7 @@ categories:
- aws2
- azure
- consul
+ - elasticsearch-rest
core:
- core
- core-impl
diff --git a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
index f26e8a1..b2706df 100644
--- a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
+++ b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
@@ -241,9 +241,9 @@ Level | Since | Description
`dozer:name` | Native +
Stable | 1.0.0-M1 | The dozer component provides the ability to map between
Java beans using the Dozer mapping library.
-|
link:https://camel.apache.org/components/latest/elasticsearch-rest-component.html[Elastichsearch
Rest] (camel-quarkus-elasticsearch-rest) +
-`elasticsearch-rest:clusterName` | JVM +
- Preview | 1.0.0-M6 | The elasticsearch component is used for interfacing with
ElasticSearch server using REST API.
+|
link:https://camel.apache.org/components/latest/elasticsearch-rest-component.html[Elasticsearch
Rest] (camel-quarkus-elasticsearch-rest) +
+`elasticsearch-rest:clusterName` | Native +
+ Stable | 1.0.0-M6 | The elasticsearch component is used for interfacing with
ElasticSearch server using REST API.
| link:https://camel.apache.org/components/latest/exec-component.html[Exec]
(camel-quarkus-exec) +
`exec:executable` | Native +
diff --git
a/extensions-jvm/elasticsearch-rest/integration-test/src/main/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticsearchRestResource.java
b/extensions-jvm/elasticsearch-rest/integration-test/src/main/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticsearchRestResource.java
deleted file mode 100644
index eb55700..0000000
---
a/extensions-jvm/elasticsearch-rest/integration-test/src/main/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticsearchRestResource.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.camel.quarkus.component.elasticsearch.rest.it;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.apache.camel.CamelContext;
-import org.jboss.logging.Logger;
-
-@Path("/elasticsearch-rest")
-@ApplicationScoped
-public class ElasticsearchRestResource {
-
- private static final Logger LOG =
Logger.getLogger(ElasticsearchRestResource.class);
-
- private static final String COMPONENT_ELASTICSEARCH_REST =
"elasticsearch-rest";
- @Inject
- CamelContext context;
-
- @Path("/load/component/elasticsearch-rest")
- @GET
- @Produces(MediaType.TEXT_PLAIN)
- public Response loadComponentElasticsearchRest() throws Exception {
- /* This is an autogenerated test */
- if (context.getComponent(COMPONENT_ELASTICSEARCH_REST) != null) {
- return Response.ok().build();
- }
- LOG.warnf("Could not load [%s] from the Camel context",
COMPONENT_ELASTICSEARCH_REST);
- return Response.status(500, COMPONENT_ELASTICSEARCH_REST + " could not
be loaded from the Camel context").build();
- }
-}
diff --git a/extensions-jvm/pom.xml b/extensions-jvm/pom.xml
index b6d24dd..361b119 100644
--- a/extensions-jvm/pom.xml
+++ b/extensions-jvm/pom.xml
@@ -52,7 +52,6 @@
<module>debezium-mysql</module>
<module>debezium-postgres</module>
<module>debezium-sqlserver</module>
- <module>elasticsearch-rest</module>
<module>google-bigquery</module>
<module>google-pubsub</module>
<module>groovy</module>
diff --git a/extensions-jvm/elasticsearch-rest/deployment/pom.xml
b/extensions/elasticsearch-rest/deployment/pom.xml
similarity index 92%
rename from extensions-jvm/elasticsearch-rest/deployment/pom.xml
rename to extensions/elasticsearch-rest/deployment/pom.xml
index 09eae07..a20ab3a 100644
--- a/extensions-jvm/elasticsearch-rest/deployment/pom.xml
+++ b/extensions/elasticsearch-rest/deployment/pom.xml
@@ -27,7 +27,7 @@
</parent>
<artifactId>camel-quarkus-elasticsearch-rest-deployment</artifactId>
- <name>Camel Quarkus :: Elastichsearch Rest :: Deployment</name>
+ <name>Camel Quarkus :: Elasticsearch Rest :: Deployment</name>
<dependencyManagement>
<dependencies>
@@ -43,6 +43,10 @@
<dependencies>
<dependency>
+ <groupId>io.quarkus</groupId>
+
<artifactId>quarkus-elasticsearch-rest-client-deployment</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-core-deployment</artifactId>
</dependency>
diff --git
a/extensions-jvm/elasticsearch-rest/deployment/src/main/java/org/apache/camel/quarkus/component/elasticsearch/rest/deployment/ElasticsearchRestProcessor.java
b/extensions/elasticsearch-rest/deployment/src/main/java/org/apache/camel/quarkus/component/elasticsearch/rest/deployment/ElasticsearchRestProcessor.java
similarity index 62%
rename from
extensions-jvm/elasticsearch-rest/deployment/src/main/java/org/apache/camel/quarkus/component/elasticsearch/rest/deployment/ElasticsearchRestProcessor.java
rename to
extensions/elasticsearch-rest/deployment/src/main/java/org/apache/camel/quarkus/component/elasticsearch/rest/deployment/ElasticsearchRestProcessor.java
index 95ea08a..0684e1f 100644
---
a/extensions-jvm/elasticsearch-rest/deployment/src/main/java/org/apache/camel/quarkus/component/elasticsearch/rest/deployment/ElasticsearchRestProcessor.java
+++
b/extensions/elasticsearch-rest/deployment/src/main/java/org/apache/camel/quarkus/component/elasticsearch/rest/deployment/ElasticsearchRestProcessor.java
@@ -17,31 +17,13 @@
package org.apache.camel.quarkus.component.elasticsearch.rest.deployment;
import io.quarkus.deployment.annotations.BuildStep;
-import io.quarkus.deployment.annotations.ExecutionTime;
-import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.FeatureBuildItem;
-import io.quarkus.deployment.pkg.steps.NativeBuild;
-import org.apache.camel.quarkus.core.JvmOnlyRecorder;
-import org.jboss.logging.Logger;
class ElasticsearchRestProcessor {
- private static final Logger LOG =
Logger.getLogger(ElasticsearchRestProcessor.class);
-
private static final String FEATURE = "camel-elasticsearch-rest";
@BuildStep
FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE);
}
-
- /**
- * Remove this once this extension starts supporting the native mode.
- */
- @BuildStep(onlyIf = NativeBuild.class)
- @Record(value = ExecutionTime.RUNTIME_INIT)
- void warnJvmInNative(JvmOnlyRecorder recorder) {
- JvmOnlyRecorder.warnJvmInNative(LOG, FEATURE); // warn at build time
- recorder.warnJvmInNative(FEATURE); // warn at runtime
- }
-
}
diff --git a/extensions-jvm/elasticsearch-rest/pom.xml
b/extensions/elasticsearch-rest/pom.xml
similarity index 94%
rename from extensions-jvm/elasticsearch-rest/pom.xml
rename to extensions/elasticsearch-rest/pom.xml
index 858280a..15f4fc6 100644
--- a/extensions-jvm/elasticsearch-rest/pom.xml
+++ b/extensions/elasticsearch-rest/pom.xml
@@ -27,12 +27,11 @@
</parent>
<artifactId>camel-quarkus-elasticsearch-rest-parent</artifactId>
- <name>Camel Quarkus :: Elastichsearch Rest</name>
+ <name>Camel Quarkus :: Elasticsearch Rest</name>
<packaging>pom</packaging>
<modules>
<module>deployment</module>
<module>runtime</module>
- <module>integration-test</module>
</modules>
</project>
diff --git a/extensions-jvm/elasticsearch-rest/runtime/pom.xml
b/extensions/elasticsearch-rest/runtime/pom.xml
similarity index 89%
rename from extensions-jvm/elasticsearch-rest/runtime/pom.xml
rename to extensions/elasticsearch-rest/runtime/pom.xml
index 0fc558e..c7aac00 100644
--- a/extensions-jvm/elasticsearch-rest/runtime/pom.xml
+++ b/extensions/elasticsearch-rest/runtime/pom.xml
@@ -27,7 +27,7 @@
</parent>
<artifactId>camel-quarkus-elasticsearch-rest</artifactId>
- <name>Camel Quarkus :: Elastichsearch Rest :: Runtime</name>
+ <name>Camel Quarkus :: Elasticsearch Rest :: Runtime</name>
<description>The elasticsearch component is used for interfacing with
ElasticSearch server using REST API.</description>
<properties>
@@ -48,6 +48,14 @@
<dependencies>
<dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-elasticsearch-rest-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.elasticsearch.client</groupId>
+ <artifactId>elasticsearch-rest-high-level-client</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-core</artifactId>
</dependency>
diff --git
a/extensions-jvm/elasticsearch-rest/runtime/src/main/resources/META-INF/quarkus-extension.yaml
b/extensions/elasticsearch-rest/runtime/src/main/resources/META-INF/quarkus-extension.yaml
similarity index 83%
rename from
extensions-jvm/elasticsearch-rest/runtime/src/main/resources/META-INF/quarkus-extension.yaml
rename to
extensions/elasticsearch-rest/runtime/src/main/resources/META-INF/quarkus-extension.yaml
index 92f87a9..45f62d3 100644
---
a/extensions-jvm/elasticsearch-rest/runtime/src/main/resources/META-INF/quarkus-extension.yaml
+++
b/extensions/elasticsearch-rest/runtime/src/main/resources/META-INF/quarkus-extension.yaml
@@ -16,14 +16,12 @@
#
---
-name: "Elastichsearch Rest"
+name: "Elasticsearch Rest"
description: "The elasticsearch component is used for interfacing with
ElasticSearch server using REST API."
metadata:
- unlisted: true
keywords:
- - "monitoring"
- - "search"
- guide:
"https://camel.apache.org/components/latest/elasticsearch-rest-component.html"
+ - "camel"
+ - "elasticsearch"
+ guide: "https://quarkus.io/guides/camel"
categories:
- "integration"
- status: "preview"
diff --git a/extensions/pom.xml b/extensions/pom.xml
index 349a5cb..c3057c5 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -70,6 +70,7 @@
<module>dataformat</module>
<module>direct</module>
<module>dozer</module>
+ <module>elasticsearch-rest</module>
<module>endpointdsl</module>
<module>exec</module>
<module>fhir</module>
diff --git a/extensions-jvm/elasticsearch-rest/integration-test/pom.xml
b/integration-tests/elasticsearch-rest/pom.xml
similarity index 62%
rename from extensions-jvm/elasticsearch-rest/integration-test/pom.xml
rename to integration-tests/elasticsearch-rest/pom.xml
index a68c5f8..58ce959 100644
--- a/extensions-jvm/elasticsearch-rest/integration-test/pom.xml
+++ b/integration-tests/elasticsearch-rest/pom.xml
@@ -21,13 +21,13 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-elasticsearch-rest-parent</artifactId>
+ <artifactId>camel-quarkus-integration-tests</artifactId>
<version>1.1.0-SNAPSHOT</version>
</parent>
- <artifactId>camel-quarkus-elasticsearch-rest-integration-test</artifactId>
- <name>Camel Quarkus :: Elastichsearch Rest :: Integration Test</name>
- <description>Integration tests for Camel Quarkus Elastichsearch Rest
extension</description>
+ <artifactId>camel-quarkus-integration-test-elasticsearch-rest</artifactId>
+ <name>Camel Quarkus :: Integration Test :: Elasticsearch Rest</name>
+ <description>Integration tests for Camel Quarkus Elasticsearch Rest
extension</description>
<properties>
<!-- mvnd, a.k.a. Maven Daemon: https://github.com/gnodet/mvnd -->
@@ -39,6 +39,18 @@
<mvnd.builder.rule>camel-quarkus-elasticsearch-rest-deployment,camel-quarkus-support-policy-deployment</mvnd.builder.rule>
</properties>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-bom-test</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
<dependencies>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
@@ -60,6 +72,11 @@
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+
<artifactId>camel-quarkus-integration-testcontainers-support</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
@@ -77,4 +94,34 @@
</plugin>
</plugins>
</build>
+
+ <profiles>
+ <profile>
+ <id>native</id>
+ <activation>
+ <property>
+ <name>native</name>
+ </property>
+ </activation>
+ <properties>
+ <quarkus.package.type>native</quarkus.package.type>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
diff --git
a/integration-tests/elasticsearch-rest/src/main/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticsearchRestResource.java
b/integration-tests/elasticsearch-rest/src/main/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticsearchRestResource.java
new file mode 100644
index 0000000..9d2b1b3
--- /dev/null
+++
b/integration-tests/elasticsearch-rest/src/main/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticsearchRestResource.java
@@ -0,0 +1,99 @@
+/*
+ * 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.camel.quarkus.component.elasticsearch.rest.it;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.PATCH;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.elasticsearch.ElasticsearchConstants;
+import org.elasticsearch.action.get.GetResponse;
+
+@Path("/elasticsearch-rest")
+@ApplicationScoped
+public class ElasticsearchRestResource {
+
+ @Inject
+ ProducerTemplate producerTemplate;
+
+ @Path("/get")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response getData(@QueryParam("indexId") String indexId) throws
Exception {
+ GetResponse response = producerTemplate
+
.requestBody("elasticsearch-rest://elasticsearch?operation=GetById&indexName=test",
indexId, GetResponse.class);
+
+ if (response.getSource() == null) {
+ return Response.status(404).build();
+ }
+ return
Response.ok().entity(response.getSource().get("test-key")).build();
+ }
+
+ @Path("/index")
+ @POST
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response indexData(String indexValue) throws Exception {
+ Map<String, String> data = createIndexedData(indexValue);
+ String indexId =
producerTemplate.requestBody("elasticsearch-rest://elasticsearch?operation=Index&indexName=test",
data,
+ String.class);
+ return Response
+ .created(new URI("https://camel.apache.org/"))
+ .entity(indexId)
+ .build();
+ }
+
+ @Path("/update")
+ @PATCH
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response updateData(@QueryParam("indexId") String indexId, String
indexValue) throws Exception {
+ Map<String, String> data = createIndexedData(indexValue);
+ Map<String, Object> headers = new HashMap<>();
+ headers.put(ElasticsearchConstants.PARAM_INDEX_ID, indexId);
+
+
producerTemplate.requestBodyAndHeaders("elasticsearch-rest://elasticsearch?operation=Update&indexName=test",
data,
+ headers);
+ return Response.ok().build();
+ }
+
+ @Path("/delete")
+ @DELETE
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response deleteData(@QueryParam("indexId") String indexId) throws
Exception {
+
producerTemplate.requestBody("elasticsearch-rest://elasticsearch?operation=Delete&indexName=test",
indexId);
+ return Response.noContent().build();
+ }
+
+ private Map<String, String> createIndexedData(String indexValue) {
+ Map<String, String> map = new HashMap<>();
+ map.put("test-key", indexValue);
+ return map;
+ }
+
+}
diff --git
a/integration-tests/elasticsearch-rest/src/test/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticSearchTestResource.java
b/integration-tests/elasticsearch-rest/src/test/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticSearchTestResource.java
new file mode 100644
index 0000000..e2b42ee
--- /dev/null
+++
b/integration-tests/elasticsearch-rest/src/test/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticSearchTestResource.java
@@ -0,0 +1,70 @@
+/*
+ * 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.camel.quarkus.component.elasticsearch.rest.it;
+
+import java.util.Map;
+
+import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
+import org.apache.camel.util.CollectionHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.containers.output.Slf4jLogConsumer;
+import org.testcontainers.containers.wait.strategy.Wait;
+import org.testcontainers.utility.TestcontainersConfiguration;
+
+public class ElasticSearchTestResource implements
QuarkusTestResourceLifecycleManager {
+
+ private static final Logger LOGGER =
LoggerFactory.getLogger(ElasticSearchTestResource.class);
+ private static final String ELASTICSEARCH_IMAGE = "elasticsearch:7.6.1";
+ private static final int ELASTICSEARCH_PORT = 9200;
+
+ private GenericContainer container;
+
+ @Override
+ public Map<String, String> start() {
+ LOGGER.info(TestcontainersConfiguration.getInstance().toString());
+
+ try {
+ container = new GenericContainer(ELASTICSEARCH_IMAGE)
+ .withExposedPorts(ELASTICSEARCH_PORT)
+ .withLogConsumer(new Slf4jLogConsumer(LOGGER))
+ .withEnv("discovery.type", "single-node")
+ .waitingFor(Wait.forListeningPort());
+
+ container.start();
+
+ return CollectionHelper.mapOf(
+ "camel.component.elasticsearch-rest.host-addresses",
+ String.format("localhost:%s",
container.getMappedPort(ELASTICSEARCH_PORT)));
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public void stop() {
+ try {
+ if (container != null) {
+ container.stop();
+ }
+ } catch (Exception e) {
+ // Ignored
+ }
+ }
+}
diff --git
a/extensions-jvm/elasticsearch-rest/integration-test/src/test/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticsearchRestTest.java
b/integration-tests/elasticsearch-rest/src/test/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticsearchRestIT.java
similarity index 68%
rename from
extensions-jvm/elasticsearch-rest/integration-test/src/test/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticsearchRestTest.java
rename to
integration-tests/elasticsearch-rest/src/test/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticsearchRestIT.java
index 5d47065..688634c 100644
---
a/extensions-jvm/elasticsearch-rest/integration-test/src/test/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticsearchRestTest.java
+++
b/integration-tests/elasticsearch-rest/src/test/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticsearchRestIT.java
@@ -16,19 +16,8 @@
*/
package org.apache.camel.quarkus.component.elasticsearch.rest.it;
-import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
-import org.junit.jupiter.api.Test;
-
-@QuarkusTest
-class ElasticsearchRestTest {
-
- @Test
- public void loadComponentElasticsearchRest() {
- /* A simple autogenerated test */
-
RestAssured.get("/elasticsearch-rest/load/component/elasticsearch-rest")
- .then()
- .statusCode(200);
- }
+import io.quarkus.test.junit.NativeImageTest;
+@NativeImageTest
+class ElasticsearchRestIT extends ElasticsearchRestTest {
}
diff --git
a/integration-tests/elasticsearch-rest/src/test/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticsearchRestTest.java
b/integration-tests/elasticsearch-rest/src/test/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticsearchRestTest.java
new file mode 100644
index 0000000..ba1f296
--- /dev/null
+++
b/integration-tests/elasticsearch-rest/src/test/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticsearchRestTest.java
@@ -0,0 +1,86 @@
+/*
+ * 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.camel.quarkus.component.elasticsearch.rest.it;
+
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.Matchers.is;
+
+@QuarkusTest
+@QuarkusTestResource(ElasticSearchTestResource.class)
+class ElasticsearchRestTest {
+
+ @Test
+ public void loadComponentElasticsearchRest() {
+ String message = "Hello Camel Quarkus Elasticsearch";
+
+ // Index data
+ String indexId = RestAssured.given()
+ .contentType(ContentType.TEXT)
+ .body(message)
+ .post("/elasticsearch-rest/index")
+ .then()
+ .statusCode(201)
+ .extract()
+ .body()
+ .asString();
+
+ // Retrieve indexed data
+ RestAssured.given()
+ .queryParam("indexId", indexId)
+ .get("/elasticsearch-rest/get")
+ .then()
+ .statusCode(200)
+ .body(is(message));
+
+ // Update indexed data
+ String updatedMessage = message + " Updated";
+ RestAssured.given()
+ .contentType(ContentType.TEXT)
+ .queryParam("indexId", indexId)
+ .body(updatedMessage)
+ .patch("/elasticsearch-rest/update")
+ .then()
+ .statusCode(200);
+
+ // Verify updated data
+ RestAssured.given()
+ .queryParam("indexId", indexId)
+ .get("/elasticsearch-rest/get")
+ .then()
+ .statusCode(200)
+ .body(is(updatedMessage));
+
+ // Delete indexed data
+ RestAssured.given()
+ .queryParam("indexId", indexId)
+ .delete("/elasticsearch-rest/delete")
+ .then()
+ .statusCode(204);
+
+ // Verify data deleted
+ RestAssured.given()
+ .queryParam("indexId", indexId)
+ .get("/elasticsearch-rest/get")
+ .then()
+ .statusCode(404);
+ }
+}
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 1c182af..20d489a 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -74,6 +74,7 @@
<module>dataformat</module>
<module>dataformats-json</module>
<module>dozer</module>
+ <module>elasticsearch-rest</module>
<module>exec</module>
<module>fhir</module>
<module>file</module>
diff --git a/pom.xml b/pom.xml
index 2981063..e015688 100644
--- a/pom.xml
+++ b/pom.xml
@@ -46,6 +46,7 @@
<awssdk1-swf-libs.version>1.11.22</awssdk1-swf-libs.version>
<awssdk2.version>2.11.5</awssdk2.version>
<camel.version>3.2.0</camel.version>
+ <elasticsearch.version>7.6.1</elasticsearch.version>
<freemarker.version>2.3.30</freemarker.version>
<github-api.version>1.111</github-api.version>
<google-http-client.version>1.22.0</google-http-client.version>
diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml
index 44d29e7..0e1d047 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -455,6 +455,12 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-elasticsearch-rest</artifactId>
<version>${camel.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.elasticsearch.client</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
@@ -2063,6 +2069,11 @@
<version>${stax2.version}</version>
</dependency>
<dependency>
+ <groupId>org.elasticsearch.client</groupId>
+ <artifactId>elasticsearch-rest-high-level-client</artifactId>
+ <version>${elasticsearch.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>${javassist.version}</version>
diff --git
a/tooling/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/UpdateDocExtensionsListMojo.java
b/tooling/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/UpdateDocExtensionsListMojo.java
index d49004d..9e17590 100644
---
a/tooling/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/UpdateDocExtensionsListMojo.java
+++
b/tooling/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/UpdateDocExtensionsListMojo.java
@@ -127,6 +127,11 @@ public class UpdateDocExtensionsListMojo extends
AbstractMojo {
final DataFormatModel delegate = (DataFormatModel)
m.delegate;
delegate.setName("bindy");
}
+ // TODO: Fix typo in ES REST metadata. Remove for
Camel 3.3.0.
+ if (m.delegate.getName().equals("elasticsearch-rest"))
{
+ final ComponentModel delegate = (ComponentModel)
m.delegate;
+ delegate.setTitle("Elasticsearch Rest");
+ }
})
.sorted()
.collect(Collectors.toList());