You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by zb...@apache.org on 2023/03/28 07:43:30 UTC
[camel-quarkus] 04/05: Drop Elasticsearch-rest extension
This is an automated email from the ASF dual-hosted git repository.
zbendhiba pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 387b525ba73f2522ac6be6bd91893f7985197ee6
Author: Zineb Bendhiba <be...@gmail.com>
AuthorDate: Fri Mar 24 11:38:19 2023 +0100
Drop Elasticsearch-rest extension
---
extensions/elasticsearch-rest/deployment/pom.xml | 69 ----
.../deployment/ElasticsearchRestProcessor.java | 29 --
extensions/elasticsearch-rest/pom.xml | 37 --
extensions/elasticsearch-rest/runtime/pom.xml | 105 ------
.../runtime/src/main/doc/usage.adoc | 24 --
.../main/resources/META-INF/quarkus-extension.yaml | 32 --
extensions/pom.xml | 1 -
integration-tests/elasticsearch-rest/pom.xml | 159 ---------
.../rest/it/ElasticsearchRestResource.java | 320 ------------------
.../rest/it/ElasticsearchRestRoutes.java | 73 ----
.../rest/it/ElasticSearchTestResource.java | 87 -----
.../elasticsearch/rest/it/ElasticsearchRestIT.java | 23 --
.../rest/it/ElasticsearchRestTest.java | 376 ---------------------
integration-tests/pom.xml | 1 -
14 files changed, 1336 deletions(-)
diff --git a/extensions/elasticsearch-rest/deployment/pom.xml b/extensions/elasticsearch-rest/deployment/pom.xml
deleted file mode 100644
index 3779be1e70..0000000000
--- a/extensions/elasticsearch-rest/deployment/pom.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-elasticsearch-rest-parent</artifactId>
- <version>3.0.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>camel-quarkus-elasticsearch-rest-deployment</artifactId>
- <name>Camel Quarkus :: Elasticsearch Rest :: Deployment</name>
-
- <dependencies>
- <dependency>
- <groupId>io.quarkus</groupId>
- <artifactId>quarkus-elasticsearch-rest-client-deployment</artifactId>
- </dependency>
- <dependency>
- <groupId>io.quarkus</groupId>
- <artifactId>quarkus-elasticsearch-rest-high-level-client-deployment</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-core-deployment</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-elasticsearch-rest</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <annotationProcessorPaths>
- <path>
- <groupId>io.quarkus</groupId>
- <artifactId>quarkus-extension-processor</artifactId>
- <version>${quarkus.version}</version>
- </path>
- </annotationProcessorPaths>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/extensions/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
deleted file mode 100644
index 0684e1f97d..0000000000
--- a/extensions/elasticsearch-rest/deployment/src/main/java/org/apache/camel/quarkus/component/elasticsearch/rest/deployment/ElasticsearchRestProcessor.java
+++ /dev/null
@@ -1,29 +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.deployment;
-
-import io.quarkus.deployment.annotations.BuildStep;
-import io.quarkus.deployment.builditem.FeatureBuildItem;
-
-class ElasticsearchRestProcessor {
- private static final String FEATURE = "camel-elasticsearch-rest";
-
- @BuildStep
- FeatureBuildItem feature() {
- return new FeatureBuildItem(FEATURE);
- }
-}
diff --git a/extensions/elasticsearch-rest/pom.xml b/extensions/elasticsearch-rest/pom.xml
deleted file mode 100644
index 566fea8858..0000000000
--- a/extensions/elasticsearch-rest/pom.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-extensions</artifactId>
- <version>3.0.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>camel-quarkus-elasticsearch-rest-parent</artifactId>
- <name>Camel Quarkus :: Elasticsearch Rest</name>
- <packaging>pom</packaging>
-
- <modules>
- <module>deployment</module>
- <module>runtime</module>
- </modules>
-</project>
diff --git a/extensions/elasticsearch-rest/runtime/pom.xml b/extensions/elasticsearch-rest/runtime/pom.xml
deleted file mode 100644
index d3168cc9f6..0000000000
--- a/extensions/elasticsearch-rest/runtime/pom.xml
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-elasticsearch-rest-parent</artifactId>
- <version>3.0.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>camel-quarkus-elasticsearch-rest</artifactId>
- <name>Camel Quarkus :: Elasticsearch Rest :: Runtime</name>
-
- <properties>
- <camel.quarkus.jvmSince>1.0.0</camel.quarkus.jvmSince>
- <camel.quarkus.nativeSince>1.0.0</camel.quarkus.nativeSince>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>io.quarkus</groupId>
- <artifactId>quarkus-elasticsearch-rest-client</artifactId>
- </dependency>
- <dependency>
- <groupId>io.quarkus</groupId>
- <artifactId>quarkus-elasticsearch-rest-high-level-client</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-elasticsearch-rest</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>io.quarkus</groupId>
- <artifactId>quarkus-extension-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <annotationProcessorPaths>
- <path>
- <groupId>io.quarkus</groupId>
- <artifactId>quarkus-extension-processor</artifactId>
- <version>${quarkus.version}</version>
- </path>
- </annotationProcessorPaths>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <profiles>
- <profile>
- <id>full</id>
- <activation>
- <property>
- <name>!quickly</name>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>update-extension-doc-page</id>
- <goals>
- <goal>update-extension-doc-page</goal>
- </goals>
- <phase>process-classes</phase>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-</project>
diff --git a/extensions/elasticsearch-rest/runtime/src/main/doc/usage.adoc b/extensions/elasticsearch-rest/runtime/src/main/doc/usage.adoc
deleted file mode 100644
index 6259f3c9c6..0000000000
--- a/extensions/elasticsearch-rest/runtime/src/main/doc/usage.adoc
+++ /dev/null
@@ -1,24 +0,0 @@
-This extension leverages the https://quarkus.io/guides/elasticsearch[Quarkus ElasticSearch REST Client].
-
-You can choose to configure ElasticSearch via the Quarkus https://quarkus.io/guides/elasticsearch#quarkus-elasticsearch-restclient-lowlevel_configuration[configuration properties] and the `RestClient` will be autowired into the Camel ElasticSearch component.
-
-Or you can configure ElasticSearch via the Camel ElasticSearch component / endpoint options. When doing this, you must disable autowiring in one of the ways outlined below.
-
-Disabling autowiring at the component level.
-[source,properties]
-----
-camel.component.elasticsearch-rest.autowired-enabled = false
-----
-
-Disabling autowiring at the endpoint level.
-[source,java]
-----
-from("direct:search")
- .to("elasticsearch-rest://elasticsearch?hostAddresses=localhost:9200&operation=Search&indexName=index&autowiredEnabled=false")
-----
-
-Globally disabling autowiring. Note that this disables autowiring for all components.
-[source,properties]
-----
-camel.main.autowired-enabled = false
-----
diff --git a/extensions/elasticsearch-rest/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/elasticsearch-rest/runtime/src/main/resources/META-INF/quarkus-extension.yaml
deleted file mode 100644
index f0b2b273a7..0000000000
--- a/extensions/elasticsearch-rest/runtime/src/main/resources/META-INF/quarkus-extension.yaml
+++ /dev/null
@@ -1,32 +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.
-#
-
-# This is a generated file. Do not edit directly!
-# To re-generate, run the following command from the top level directory:
-#
-# mvn -N cq:update-quarkus-metadata
-#
----
-name: "Camel Elasticsearch Rest"
-description: "Send requests to ElasticSearch via REST API"
-metadata:
- guide: "https://camel.apache.org/camel-quarkus/latest/reference/extensions/elasticsearch-rest.html"
- categories:
- - "integration"
- status:
- - "stable"
- - "deprecated"
\ No newline at end of file
diff --git a/extensions/pom.xml b/extensions/pom.xml
index c062d82b6a..28335767c6 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -95,7 +95,6 @@
<module>direct</module>
<module>disruptor</module>
<module>dropbox</module>
- <!--<module>elasticsearch-rest</module> https://github.com/apache/camel-quarkus/issues/4477 -->
<module>exec</module>
<module>fhir</module>
<module>file</module>
diff --git a/integration-tests/elasticsearch-rest/pom.xml b/integration-tests/elasticsearch-rest/pom.xml
deleted file mode 100644
index 96aabe0122..0000000000
--- a/integration-tests/elasticsearch-rest/pom.xml
+++ /dev/null
@@ -1,159 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-build-parent-it</artifactId>
- <version>3.0.0-SNAPSHOT</version>
- <relativePath>../../poms/build-parent-it/pom.xml</relativePath>
- </parent>
-
- <artifactId>camel-quarkus-integration-test-elasticsearch-rest</artifactId>
- <name>Camel Quarkus :: Integration Tests :: Elasticsearch Rest</name>
- <description>Integration tests for Camel Quarkus Elasticsearch Rest extension</description>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-direct</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-elasticsearch-rest</artifactId>
- </dependency>
- <dependency>
- <groupId>io.quarkus</groupId>
- <artifactId>quarkus-resteasy</artifactId>
- </dependency>
-
- <!-- test dependencies -->
- <dependency>
- <groupId>io.quarkus</groupId>
- <artifactId>quarkus-junit5</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.rest-assured</groupId>
- <artifactId>rest-assured</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.testcontainers</groupId>
- <artifactId>testcontainers</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>io.quarkus</groupId>
- <artifactId>quarkus-junit4-mock</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.awaitility</groupId>
- <artifactId>awaitility</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-
- <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>
- <profile>
- <id>virtualDependencies</id>
- <activation>
- <property>
- <name>!noVirtualDependencies</name>
- </property>
- </activation>
- <dependencies>
- <!-- The following dependencies guarantee that this module is built after them. You can update them by running `mvn process-resources -Pformat -N` from the source tree root directory -->
- <dependency>
- <groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-direct-deployment</artifactId>
- <version>${project.version}</version>
- <type>pom</type>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>*</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-elasticsearch-rest-deployment</artifactId>
- <version>${project.version}</version>
- <type>pom</type>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>*</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
- </profile>
- <profile>
- <id>skip-testcontainers-tests</id>
- <activation>
- <property>
- <name>skip-testcontainers-tests</name>
- </property>
- </activation>
- <properties>
- <skipTests>true</skipTests>
- </properties>
- </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
deleted file mode 100644
index ed0199a519..0000000000
--- a/integration-tests/elasticsearch-rest/src/main/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticsearchRestResource.java
+++ /dev/null
@@ -1,320 +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 java.net.URI;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import jakarta.enterprise.context.ApplicationScoped;
-import jakarta.inject.Inject;
-import jakarta.ws.rs.DELETE;
-import jakarta.ws.rs.GET;
-import jakarta.ws.rs.PATCH;
-import jakarta.ws.rs.POST;
-import jakarta.ws.rs.Path;
-import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.QueryParam;
-import jakarta.ws.rs.core.MediaType;
-import jakarta.ws.rs.core.Response;
-
-import org.apache.camel.FluentProducerTemplate;
-import org.apache.camel.component.elasticsearch.ElasticsearchConstants;
-import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
-import org.elasticsearch.action.bulk.BulkItemResponse;
-import org.elasticsearch.action.bulk.BulkRequest;
-import org.elasticsearch.action.get.GetResponse;
-import org.elasticsearch.action.index.IndexRequest;
-import org.elasticsearch.action.search.MultiSearchRequest;
-import org.elasticsearch.action.search.MultiSearchResponse.Item;
-import org.elasticsearch.action.search.SearchRequest;
-import org.elasticsearch.index.query.QueryBuilders;
-import org.elasticsearch.search.SearchHits;
-import org.elasticsearch.search.builder.SearchSourceBuilder;
-
-@Path("/elasticsearch-rest")
-@ApplicationScoped
-public class ElasticsearchRestResource {
-
- private static final String HEADER_COMPONENT = "component";
-
- @Inject
- FluentProducerTemplate fluentProducerTemplate;
-
- @Path("/get")
- @GET
- @Produces(MediaType.TEXT_PLAIN)
- public Response getData(
- @QueryParam("component") String component,
- @QueryParam("indexName") String indexName,
- @QueryParam("indexId") String indexId,
- @QueryParam("indexKey") String indexKey) {
-
- GetResponse response = fluentProducerTemplate.to("direct:get")
- .withBody(indexId)
- .withHeader(ElasticsearchConstants.PARAM_INDEX_NAME, indexName)
- .withHeader(HEADER_COMPONENT, component)
- .request(GetResponse.class);
-
- if (response.getSource() == null) {
- return Response.status(404).build();
- }
-
- return Response.ok().entity(response.getSource().get(indexKey)).build();
- }
-
- @Path("/index")
- @POST
- @Produces(MediaType.TEXT_PLAIN)
- public Response indexData(
- @QueryParam("component") String component,
- @QueryParam("indexName") String indexName,
- @QueryParam("indexKey") String indexKey,
- String indexValue) throws Exception {
-
- String indexId = fluentProducerTemplate.to("direct:index")
- .withBody(createIndexedData(indexKey, indexValue))
- .withHeader(ElasticsearchConstants.PARAM_INDEX_NAME, indexName)
- .withHeader(HEADER_COMPONENT, component)
- .request(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("component") String component,
- @QueryParam("indexName") String indexName,
- @QueryParam("indexId") String indexId,
- @QueryParam("indexKey") String indexKey,
- String indexValue) {
-
- fluentProducerTemplate.to("direct:update")
- .withBody(createIndexedData(indexKey, indexValue))
- .withHeader(ElasticsearchConstants.PARAM_INDEX_NAME, indexName)
- .withHeader(ElasticsearchConstants.PARAM_INDEX_ID, indexId)
- .withHeader(HEADER_COMPONENT, component)
- .request();
-
- return Response.ok().build();
- }
-
- @Path("/delete")
- @DELETE
- @Produces(MediaType.TEXT_PLAIN)
- public Response deleteData(
- @QueryParam("component") String component,
- @QueryParam("indexName") String indexName,
- @QueryParam("indexId") String indexId) {
-
- fluentProducerTemplate.to("direct:delete")
- .withBody(indexId)
- .withHeader(ElasticsearchConstants.PARAM_INDEX_NAME, indexName)
- .withHeader(HEADER_COMPONENT, component)
- .request();
-
- return Response.noContent().build();
- }
-
- @Path("/delete/index")
- @DELETE
- @Produces(MediaType.TEXT_PLAIN)
- public Response deleteIndexData(
- @QueryParam("component") String component,
- @QueryParam("indexName") String indexName) {
-
- DeleteIndexRequest request = new DeleteIndexRequest(indexName);
-
- Boolean result = fluentProducerTemplate.to("direct:deleteIndex")
- .withBody(request)
- .withHeader(HEADER_COMPONENT, component)
- .request(Boolean.class);
-
- return Response.ok(result).build();
- }
-
- @Path("/ping")
- @GET
- @Produces(MediaType.TEXT_PLAIN)
- public Response ping(@QueryParam("component") String component) {
- Boolean result = fluentProducerTemplate.to("direct:ping")
- .withHeader(HEADER_COMPONENT, component)
- .request(Boolean.class);
-
- return Response.ok(result).build();
- }
-
- @Path("/exists")
- @GET
- @Produces(MediaType.TEXT_PLAIN)
- public Response exists(
- @QueryParam("component") String component,
- @QueryParam("indexName") String indexName) {
-
- Boolean result = fluentProducerTemplate.to("direct:exists")
- .withHeader(ElasticsearchConstants.PARAM_INDEX_NAME, indexName)
- .withHeader(HEADER_COMPONENT, component)
- .request(Boolean.class);
-
- return Response.ok(result).build();
- }
-
- @Path("/bulk")
- @POST
- @Produces(MediaType.TEXT_PLAIN)
- public Response bulk(
- @QueryParam("component") String component,
- @QueryParam("indexName") String indexName) {
-
- BulkRequest request = new BulkRequest();
- request.add(new IndexRequest(indexName).source("camel", "quarkus"));
-
- BulkItemResponse[] result = fluentProducerTemplate.to("direct:bulk")
- .withBody(request)
- .withHeader(HEADER_COMPONENT, component)
- .request(BulkItemResponse[].class);
-
- return Response.ok(result[0].getResponse().getId()).build();
- }
-
- @Path("/bulk/index")
- @POST
- @Produces(MediaType.TEXT_PLAIN)
- public Response bulkIndex(
- @QueryParam("component") String component,
- @QueryParam("indexName") String indexName) {
-
- List<Map<String, String>> documents = new ArrayList<>();
- documents.add(createIndexedData("foo", "bar"));
- documents.add(createIndexedData("cheese", "wine"));
-
- List<BulkItemResponse> result = fluentProducerTemplate.to("direct:bulkIndex")
- .withBody(documents)
- .withHeader(ElasticsearchConstants.PARAM_INDEX_NAME, indexName)
- .withHeader(HEADER_COMPONENT, component)
- .request(List.class);
-
- String ids = result.stream().map(bulkItem -> bulkItem.getResponse().getId()).collect(Collectors.joining(","));
-
- return Response.ok(ids).build();
- }
-
- @Path("/search")
- @GET
- @Produces(MediaType.TEXT_PLAIN)
- public Response searchByMap(
- @QueryParam("component") String component,
- @QueryParam("indexKey") String indexKey,
- String searchString) {
-
- Map<String, Object> actualQuery = new HashMap<>();
- actualQuery.put(indexKey, searchString);
-
- Map<String, Object> match = new HashMap<>();
- match.put("match", actualQuery);
-
- Map<String, Object> query = new HashMap<>();
- query.put("query", match);
-
- SearchHits result = fluentProducerTemplate.to("direct:search")
- .withBody(query)
- .withHeader(HEADER_COMPONENT, component)
- .request(SearchHits.class);
-
- if (result.getHits().length > 0) {
- Map<String, Object> source = result.getAt(0).getSourceAsMap();
- return Response.ok(source.get(indexKey)).build();
- }
- return Response.ok().build();
- }
-
- @Path("/search/json")
- @GET
- @Produces(MediaType.TEXT_PLAIN)
- public Response searchByJSON(
- @QueryParam("component") String component,
- @QueryParam("indexKey") String indexKey,
- String searchString) {
-
- String query = "{\"query\":{\"match\":{\"%s\":\"%s\"}}}";
-
- SearchHits result = fluentProducerTemplate.to("direct:search")
- .withBody(String.format(query, indexKey, searchString))
- .withHeader(HEADER_COMPONENT, component)
- .request(SearchHits.class);
-
- if (result.getHits().length > 0) {
- Map<String, Object> source = result.getAt(0).getSourceAsMap();
- return Response.ok(source.get(indexKey)).build();
- }
- return Response.ok().build();
- }
-
- @Path("/search/multi")
- @GET
- @Produces(MediaType.TEXT_PLAIN)
- public Response searchMulti(
- @QueryParam("component") String component,
- @QueryParam("indexName") String indexName,
- @QueryParam("indexKey") String indexKey,
- String searchStrings) {
-
- String[] searchTerms = searchStrings.split(",");
-
- MultiSearchRequest request = new MultiSearchRequest();
- SearchRequest searchA = new SearchRequest(indexName);
- SearchSourceBuilder builderA = new SearchSourceBuilder();
- builderA.query(QueryBuilders.matchPhraseQuery(indexKey, searchTerms[0]));
- searchA.source(builderA);
- request.add(searchA);
-
- SearchRequest searchB = new SearchRequest(indexName);
- SearchSourceBuilder builderB = new SearchSourceBuilder();
- builderB.query(QueryBuilders.matchPhraseQuery(indexKey, searchTerms[1]));
- searchB.source(builderB);
- request.add(searchB);
-
- Item[] result = fluentProducerTemplate.to("direct:multiSearch")
- .withBody(request)
- .withHeader(HEADER_COMPONENT, component)
- .request(Item[].class);
-
- if (result.length > 0) {
- int totalHits = 0;
- for (Item item : result) {
- totalHits += item.getResponse().getHits().getHits().length;
- }
- return Response.ok(totalHits).build();
- }
- return Response.ok().build();
- }
-
- private Map<String, String> createIndexedData(String indexKey, String indexValue) {
- Map<String, String> map = new HashMap<>();
- map.put(indexKey, indexValue);
- return map;
- }
-
-}
diff --git a/integration-tests/elasticsearch-rest/src/main/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticsearchRestRoutes.java b/integration-tests/elasticsearch-rest/src/main/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticsearchRestRoutes.java
deleted file mode 100644
index 0aa538e3d0..0000000000
--- a/integration-tests/elasticsearch-rest/src/main/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticsearchRestRoutes.java
+++ /dev/null
@@ -1,73 +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 jakarta.inject.Named;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.elasticsearch.ElasticsearchComponent;
-import org.elasticsearch.client.RestClient;
-
-public class ElasticsearchRestRoutes extends RouteBuilder {
-
- @Override
- public void configure() {
- from("direct:bulk")
- .toD("${header.component}://elasticsearch?operation=Bulk");
-
- from("direct:bulkIndex")
- .toD("${header.component}://elasticsearch?operation=BulkIndex");
-
- from("direct:delete")
- .toD("${header.component}://elasticsearch?operation=Delete");
-
- from("direct:deleteIndex")
- .toD("${header.component}://elasticsearch?operation=DeleteIndex");
-
- from("direct:exists")
- .toD("${header.component}://elasticsearch?operation=Exists");
-
- from("direct:get")
- .toD("${header.component}://elasticsearch?operation=GetById");
-
- from("direct:index")
- .toD("${header.component}://elasticsearch?operation=Index");
-
- from("direct:multiGet")
- .toD("${header.component}://elasticsearch?operation=MultiGet");
-
- from("direct:multiSearch")
- .toD("${header.component}://elasticsearch?operation=MultiSearch");
-
- from("direct:ping")
- .toD("${header.component}://elasticsearch?operation=Ping");
-
- from("direct:search")
- .toD("${header.component}://elasticsearch?operation=Search");
-
- from("direct:update")
- .toD("${header.component}://elasticsearch?operation=Update");
- }
-
- @Named("elasticsearch-rest-quarkus")
- public ElasticsearchComponent elasticsearchQuarkus(RestClient client) {
- // Use the RestClient bean created by the Quarkus ElasticSearch extension
- ElasticsearchComponent component = new ElasticsearchComponent();
- component.setClient(client);
- return component;
- }
-}
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
deleted file mode 100644
index f878e48d07..0000000000
--- a/integration-tests/elasticsearch-rest/src/test/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticSearchTestResource.java
+++ /dev/null
@@ -1,87 +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 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.10.1";
- private static final String ELASTICSEARCH_USERNAME = "elastic";
- private static final String ELASTICSEARCH_PASSWORD = "changeme";
- 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")
- .withEnv("xpack.security.enabled", "true")
- .withEnv("ELASTIC_USERNAME", ELASTICSEARCH_USERNAME)
- .withEnv("ELASTIC_PASSWORD", ELASTICSEARCH_PASSWORD)
- .waitingFor(Wait.forListeningPort());
-
- container.start();
-
- String hostAddresses = String.format("localhost:%s", container.getMappedPort(ELASTICSEARCH_PORT));
-
- // Create 2 sets of configuration to test scenarios:
- // - Quarkus ElasticSearch REST client bean being autowired into the Camel ElasticSearch REST component
- // - Component configuration where the ElasticSearch REST client is managed by Camel (E.g autowiring disabled)
- return CollectionHelper.mapOf(
- // quarkus
- "quarkus.elasticsearch.hosts", hostAddresses,
- "quarkus.elasticsearch.username", ELASTICSEARCH_USERNAME,
- "quarkus.elasticsearch.password", ELASTICSEARCH_PASSWORD,
- // camel
- "camel.component.elasticsearch-rest.autowired-enabled", "false",
- "camel.component.elasticsearch-rest.host-addresses", hostAddresses,
- "camel.component.elasticsearch-rest.user", ELASTICSEARCH_USERNAME,
- "camel.component.elasticsearch-rest.password", ELASTICSEARCH_PASSWORD);
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public void stop() {
- try {
- if (container != null) {
- container.stop();
- }
- } catch (Exception e) {
- // Ignored
- }
- }
-}
diff --git a/integration-tests/elasticsearch-rest/src/test/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticsearchRestIT.java b/integration-tests/elasticsearch-rest/src/test/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticsearchRestIT.java
deleted file mode 100644
index 7a3c12a682..0000000000
--- a/integration-tests/elasticsearch-rest/src/test/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticsearchRestIT.java
+++ /dev/null
@@ -1,23 +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 io.quarkus.test.junit.QuarkusIntegrationTest;
-
-@QuarkusIntegrationTest
-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
deleted file mode 100644
index a1d2e4dca8..0000000000
--- a/integration-tests/elasticsearch-rest/src/test/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticsearchRestTest.java
+++ /dev/null
@@ -1,376 +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 java.util.UUID;
-import java.util.concurrent.TimeUnit;
-
-import io.quarkus.test.common.QuarkusTestResource;
-import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
-import io.restassured.http.ContentType;
-import org.awaitility.Awaitility;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.MethodSource;
-
-import static org.hamcrest.Matchers.is;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-@QuarkusTest
-@QuarkusTestResource(ElasticSearchTestResource.class)
-class ElasticsearchRestTest {
-
- @AfterEach
- public void afterEach() {
- // Clean up all indexed data
- RestAssured.given()
- .queryParam("component", "elasticsearch-rest")
- .queryParam("indexName", "_all")
- .delete("/elasticsearch-rest/delete/index")
- .then()
- .statusCode(200)
- .body(is("true"));
- }
-
- @ParameterizedTest
- @MethodSource("componentNames")
- public void testElasticsearchBasicOperations(String component) {
- String indexName = UUID.randomUUID().toString();
- String indexKey = "test-key";
- String indexValue = "Hello Camel Quarkus ElasticSearch REST";
-
- // Verify the ElasticSearch server is available
- RestAssured.given()
- .queryParam("component", component)
- .get("/elasticsearch-rest/ping")
- .then()
- .statusCode(200)
- .body(is("true"));
-
- // Index data
- String indexId = RestAssured.given()
- .queryParam("component", component)
- .queryParam("indexName", indexName)
- .queryParam("indexKey", indexKey)
- .contentType(ContentType.TEXT)
- .body(indexValue)
- .post("/elasticsearch-rest/index")
- .then()
- .statusCode(201)
- .extract()
- .body()
- .asString();
-
- // Verify index exists
- RestAssured.given()
- .queryParam("component", component)
- .queryParam("indexName", indexName)
- .get("/elasticsearch-rest/exists")
- .then()
- .statusCode(200)
- .body(is("true"));
-
- // Retrieve indexed data
- RestAssured.given()
- .queryParam("component", component)
- .queryParam("indexName", indexName)
- .queryParam("indexId", indexId)
- .queryParam("indexKey", indexKey)
- .get("/elasticsearch-rest/get")
- .then()
- .statusCode(200)
- .body(is(indexValue));
-
- // Update indexed data
- String updatedIndexValue = indexValue + " Updated";
- RestAssured.given()
- .contentType(ContentType.TEXT)
- .queryParam("component", component)
- .queryParam("indexId", indexId)
- .queryParam("indexName", indexName)
- .queryParam("indexKey", indexKey)
- .body(updatedIndexValue)
- .patch("/elasticsearch-rest/update")
- .then()
- .statusCode(200);
-
- // Verify updated data
- RestAssured.given()
- .queryParam("component", component)
- .queryParam("indexName", indexName)
- .queryParam("indexId", indexId)
- .queryParam("indexKey", indexKey)
- .get("/elasticsearch-rest/get")
- .then()
- .statusCode(200)
- .body(is(updatedIndexValue));
-
- // Delete indexed data
- RestAssured.given()
- .queryParam("component", component)
- .queryParam("indexName", indexName)
- .queryParam("indexId", indexId)
- .delete("/elasticsearch-rest/delete")
- .then()
- .statusCode(204);
-
- // Verify data deleted
- RestAssured.given()
- .queryParam("component", component)
- .queryParam("indexName", indexName)
- .queryParam("indexId", indexId)
- .queryParam("indexKey", indexKey)
- .get("/elasticsearch-rest/get")
- .then()
- .statusCode(404);
- }
-
- @ParameterizedTest
- @MethodSource("componentNames")
- public void testElasticsearchBulk(String component) {
- String indexName = UUID.randomUUID().toString();
-
- String indexId = RestAssured.given()
- .queryParam("component", component)
- .queryParam("indexName", indexName)
- .post("/elasticsearch-rest/bulk")
- .then()
- .statusCode(200)
- .extract()
- .body()
- .asString();
-
- RestAssured.given()
- .queryParam("component", component)
- .queryParam("indexName", indexName)
- .get("/elasticsearch-rest/exists")
- .then()
- .statusCode(200)
- .body(is("true"));
-
- RestAssured.given()
- .queryParam("component", component)
- .queryParam("indexName", indexName)
- .queryParam("indexId", indexId)
- .queryParam("indexKey", "camel")
- .get("/elasticsearch-rest/get")
- .then()
- .statusCode(200)
- .body(is("quarkus"));
- }
-
- @ParameterizedTest
- @MethodSource("componentNames")
- public void testElasticsearchBulkIndex(String component) {
- String indexName = UUID.randomUUID().toString();
- String indexId = RestAssured.given()
- .queryParam("component", component)
- .queryParam("indexName", indexName)
- .post("/elasticsearch-rest/bulk/index")
- .then()
- .statusCode(200)
- .extract()
- .body()
- .asString();
- assertEquals(2, indexId.split(",").length);
- }
-
- @ParameterizedTest
- @MethodSource("componentNames")
- public void testElasticsearchDeleteIndex(String component) {
- String indexName = UUID.randomUUID().toString();
- String indexKey = "test-key";
- String indexValue = "Hello Camel Quarkus ElasticSearch REST";
-
- // Index data
- RestAssured.given()
- .queryParam("component", component)
- .queryParam("indexName", indexName)
- .queryParam("indexKey", indexKey)
- .contentType(ContentType.TEXT)
- .body(indexValue)
- .post("/elasticsearch-rest/index")
- .then()
- .statusCode(201)
- .extract()
- .body()
- .asString();
-
- // Verify index exists
- RestAssured.given()
- .queryParam("component", component)
- .queryParam("indexName", indexName)
- .get("/elasticsearch-rest/exists")
- .then()
- .statusCode(200)
- .body(is("true"));
-
- // Delete indexed data
- RestAssured.given()
- .queryParam("component", component)
- .queryParam("indexName", indexName)
- .delete("/elasticsearch-rest/delete/index")
- .then()
- .statusCode(200)
- .body(is("true"));
- }
-
- @ParameterizedTest
- @MethodSource("componentNames")
- public void testElasticsearchSearch(String component) {
- String indexName = UUID.randomUUID().toString();
- String indexKey = "camel-quarkus";
- String indexValue = "Sub Atomic, Super Fast Camel Quarkus";
-
- // Index data
- RestAssured.given()
- .queryParam("component", component)
- .queryParam("indexName", indexName)
- .queryParam("indexKey", indexKey)
- .contentType(ContentType.TEXT)
- .body(indexValue)
- .post("/elasticsearch-rest/index")
- .then()
- .statusCode(201)
- .extract()
- .body()
- .asString();
-
- // Verify index exists
- RestAssured.given()
- .queryParam("component", component)
- .queryParam("indexName", indexName)
- .get("/elasticsearch-rest/exists")
- .then()
- .statusCode(200)
- .body(is("true"));
-
- // Search data
- Awaitility.await().pollInterval(50, TimeUnit.MILLISECONDS).atMost(10, TimeUnit.SECONDS).until(() -> {
- String searchResult = RestAssured.given()
- .queryParam("component", component)
- .queryParam("indexKey", indexKey)
- .body("Super Fast")
- .get("/elasticsearch-rest/search")
- .then()
- .statusCode(200)
- .extract()
- .body()
- .asString();
- return searchResult.equals(indexValue);
- });
- }
-
- @ParameterizedTest
- @MethodSource("componentNames")
- public void testElasticsearchSearchJSON(String component) {
- String indexName = UUID.randomUUID().toString();
- String indexKey = "camel-quarkus";
- String indexValue = "Sub Atomic, Super Fast Camel Quarkus";
-
- // Index data
- RestAssured.given()
- .queryParam("component", component)
- .queryParam("indexName", indexName)
- .queryParam("indexKey", indexKey)
- .contentType(ContentType.TEXT)
- .body(indexValue)
- .post("/elasticsearch-rest/index")
- .then()
- .statusCode(201)
- .extract()
- .body()
- .asString();
-
- // Verify index exists
- RestAssured.given()
- .queryParam("component", component)
- .queryParam("indexName", indexName)
- .get("/elasticsearch-rest/exists")
- .then()
- .statusCode(200)
- .body(is("true"));
-
- // Search data
- Awaitility.await().pollInterval(50, TimeUnit.MILLISECONDS).atMost(10, TimeUnit.SECONDS).until(() -> {
- String searchResult = RestAssured.given()
- .queryParam("component", component)
- .queryParam("indexKey", indexKey)
- .body("Super Fast")
- .get("/elasticsearch-rest/search/json")
- .then()
- .statusCode(200)
- .extract()
- .body()
- .asString();
- return searchResult.equals(indexValue);
- });
- }
-
- @ParameterizedTest
- @MethodSource("componentNames")
- public void testElasticsearchMultiSearch(String component) {
- String indexName = UUID.randomUUID().toString();
- String indexKey = "camel-quarkus";
- String indexValue = "Sub Atomic, Super Fast Camel Quarkus";
-
- // Index data
- RestAssured.given()
- .queryParam("component", component)
- .queryParam("indexName", indexName)
- .queryParam("indexKey", indexKey)
- .contentType(ContentType.TEXT)
- .body(indexValue)
- .post("/elasticsearch-rest/index")
- .then()
- .statusCode(201)
- .extract()
- .body()
- .asString();
-
- // Verify index exists
- RestAssured.given()
- .queryParam("component", component)
- .queryParam("indexName", indexName)
- .get("/elasticsearch-rest/exists")
- .then()
- .statusCode(200)
- .body(is("true"));
-
- // Search data
- Awaitility.await().pollInterval(50, TimeUnit.MILLISECONDS).atMost(10, TimeUnit.SECONDS).until(() -> {
- String hits = RestAssured.given()
- .queryParam("component", component)
- .queryParam("indexName", indexName)
- .queryParam("indexKey", indexKey)
- .body("Sub Atomic,Super Fast")
- .get("/elasticsearch-rest/search/multi")
- .then()
- .statusCode(200)
- .extract()
- .body()
- .asString();
- return hits.equals("2");
- });
- }
-
- @SuppressWarnings("unused")
- private static String[] componentNames() {
- return new String[] { "elasticsearch-rest", "elasticsearch-rest-quarkus" };
- }
-}
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index e0533275ca..d2c50fdddf 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -87,7 +87,6 @@
<module>digitalocean</module>
<module>disruptor</module>
<module>dropbox</module>
- <!--<module>elasticsearch-rest</module>-->
<module>exec</module>
<module>fhir</module>
<module>file</module>