This is an automated email from the ASF dual-hosted git repository. ppalaga pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 33603d274e086caa48acacb54d6f9f670c993ff3 Author: Peter Palaga <ppal...@redhat.com> AuthorDate: Mon Mar 16 22:49:01 2020 +0100 Fix #894 Elastichsearch Rest support --- .../elasticsearch-rest/deployment/pom.xml | 75 +++++++++++++++++++ .../deployment/ElasticsearchRestProcessor.java | 31 ++++++++ .../elasticsearch-rest/integration-test/pom.xml | 82 +++++++++++++++++++++ .../rest/it/ElasticsearchRestResource.java | 51 +++++++++++++ .../rest/it/ElasticsearchRestTest.java | 34 +++++++++ extensions-jvm/{ => elasticsearch-rest}/pom.xml | 19 ++--- extensions-jvm/elasticsearch-rest/runtime/pom.xml | 83 ++++++++++++++++++++++ .../main/resources/META-INF/quarkus-extension.yaml | 29 ++++++++ extensions-jvm/pom.xml | 1 + poms/bom-deployment/pom.xml | 5 ++ poms/bom/pom.xml | 10 +++ 11 files changed, 411 insertions(+), 9 deletions(-) diff --git a/extensions-jvm/elasticsearch-rest/deployment/pom.xml b/extensions-jvm/elasticsearch-rest/deployment/pom.xml new file mode 100644 index 0000000..af15d42 --- /dev/null +++ b/extensions-jvm/elasticsearch-rest/deployment/pom.xml @@ -0,0 +1,75 @@ +<?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>1.1.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-elasticsearch-rest-deployment</artifactId> + <name>Camel Quarkus :: Elastichsearch Rest :: Deployment</name> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-bom-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <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-jvm/elasticsearch-rest/deployment/src/main/java/org/apache/camel/quarkus/component/elasticsearch/rest/deployment/ElasticsearchRestProcessor.java b/extensions-jvm/elasticsearch-rest/deployment/src/main/java/org/apache/camel/quarkus/component/elasticsearch/rest/deployment/ElasticsearchRestProcessor.java new file mode 100644 index 0000000..43de652 --- /dev/null +++ b/extensions-jvm/elasticsearch-rest/deployment/src/main/java/org/apache/camel/quarkus/component/elasticsearch/rest/deployment/ElasticsearchRestProcessor.java @@ -0,0 +1,31 @@ +/* + * 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-jvm/elasticsearch-rest/integration-test/pom.xml b/extensions-jvm/elasticsearch-rest/integration-test/pom.xml new file mode 100644 index 0000000..59981dd --- /dev/null +++ b/extensions-jvm/elasticsearch-rest/integration-test/pom.xml @@ -0,0 +1,82 @@ +<?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>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> + + <properties> + <!-- mvnd, a.k.a. Maven Daemon: https://github.com/gnodet/mvnd --> + <!-- The following rule tells mvnd to build the listed deployment modules before this module. --> + <!-- This is important because mvnd builds modules in parallel by default. The deployment modules are not --> + <!-- explicit dependencies of this module in the Maven sense, although they are required by the Quarkus Maven plugin. --> + <!-- Please update rule whenever you change the dependencies of this module by running --> + <!-- mvn process-resources -Pformat from the root directory --> + <mvnd.builder.rule>camel-quarkus-elasticsearch-rest-deployment,camel-quarkus-support-policy-deployment</mvnd.builder.rule> + </properties> + + <dependencies> + <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> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-maven-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>build</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> 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 new file mode 100644 index 0000000..eb55700 --- /dev/null +++ b/extensions-jvm/elasticsearch-rest/integration-test/src/main/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticsearchRestResource.java @@ -0,0 +1,51 @@ +/* + * 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/elasticsearch-rest/integration-test/src/test/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticsearchRestTest.java b/extensions-jvm/elasticsearch-rest/integration-test/src/test/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticsearchRestTest.java new file mode 100644 index 0000000..5d47065 --- /dev/null +++ b/extensions-jvm/elasticsearch-rest/integration-test/src/test/java/org/apache/camel/quarkus/component/elasticsearch/rest/it/ElasticsearchRestTest.java @@ -0,0 +1,34 @@ +/* + * 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.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); + } + +} diff --git a/extensions-jvm/pom.xml b/extensions-jvm/elasticsearch-rest/pom.xml similarity index 64% copy from extensions-jvm/pom.xml copy to extensions-jvm/elasticsearch-rest/pom.xml index 4a18308..98026a0 100644 --- a/extensions-jvm/pom.xml +++ b/extensions-jvm/elasticsearch-rest/pom.xml @@ -17,23 +17,24 @@ 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"> - +<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-parent</artifactId> + <artifactId>camel-quarkus-build-parent</artifactId> <version>1.1.0-SNAPSHOT</version> + <relativePath>../../poms/build-parent/pom.xml</relativePath> </parent> - <artifactId>camel-quarkus-extensions-jvm</artifactId> + <artifactId>camel-quarkus-elasticsearch-rest-parent</artifactId> + <name>Camel Quarkus :: Elastichsearch Rest</name> <packaging>pom</packaging> - <name>Camel Quarkus :: Extensions JVM</name> - <description>Autogenerated extensions not yet tested in the native mode</description> - <modules> - <!-- extensions a..z; do not remove this comment, it is important when sorting via mvn process-resources -Pformat --> + <module>deployment</module> + <module>runtime</module> + <module>integration-test</module> </modules> - </project> diff --git a/extensions-jvm/elasticsearch-rest/runtime/pom.xml b/extensions-jvm/elasticsearch-rest/runtime/pom.xml new file mode 100644 index 0000000..01dfaa4 --- /dev/null +++ b/extensions-jvm/elasticsearch-rest/runtime/pom.xml @@ -0,0 +1,83 @@ +<?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>1.1.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-elasticsearch-rest</artifactId> + <name>Camel Quarkus :: Elastichsearch Rest :: Runtime</name> + <description>The elasticsearch component is used for interfacing with ElasticSearch server using REST API.</description> + + <properties> + <firstVersion>1.0.0-M6</firstVersion> + </properties> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-bom</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <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-bootstrap-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> +</project> diff --git a/extensions-jvm/elasticsearch-rest/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions-jvm/elasticsearch-rest/runtime/src/main/resources/META-INF/quarkus-extension.yaml new file mode 100644 index 0000000..92f87a9 --- /dev/null +++ b/extensions-jvm/elasticsearch-rest/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -0,0 +1,29 @@ +# +# 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. +# + +--- +name: "Elastichsearch 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" + categories: + - "integration" + status: "preview" diff --git a/extensions-jvm/pom.xml b/extensions-jvm/pom.xml index 4a18308..3e755ff 100644 --- a/extensions-jvm/pom.xml +++ b/extensions-jvm/pom.xml @@ -34,6 +34,7 @@ <modules> <!-- extensions a..z; do not remove this comment, it is important when sorting via mvn process-resources -Pformat --> + <module>elasticsearch-rest</module> </modules> </project> diff --git a/poms/bom-deployment/pom.xml b/poms/bom-deployment/pom.xml index ec56c02..3429198 100644 --- a/poms/bom-deployment/pom.xml +++ b/poms/bom-deployment/pom.xml @@ -221,6 +221,11 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-elasticsearch-rest-deployment</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-endpointdsl-deployment</artifactId> <version>${camel-quarkus.version}</version> </dependency> diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml index c1dbe45..294bd0e 100644 --- a/poms/bom/pom.xml +++ b/poms/bom/pom.xml @@ -254,6 +254,11 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-elasticsearch-rest</artifactId> + <version>${camel.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-endpointdsl</artifactId> <version>${camel.version}</version> </dependency> @@ -877,6 +882,11 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-elasticsearch-rest</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-endpointdsl</artifactId> <version>${camel-quarkus.version}</version> </dependency>