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
commit 265c19b8ea2cecde6c2af11db631a272a433250f Author: James Netherton <[email protected]> AuthorDate: Tue Mar 3 11:35:56 2020 +0000 Add JMS extension Fixes #767 --- .github/workflows/pr-build.yaml | 3 +- .../pages/list-of-camel-quarkus-extensions.adoc | 5 +- extensions/jms/deployment/pom.xml | 79 +++++++++++ .../component/jms/deployment/JmsProcessor.java | 31 +++++ extensions/jms/pom.xml | 50 +++++++ extensions/jms/runtime/pom.xml | 86 ++++++++++++ .../main/resources/META-INF/quarkus-extension.yaml | 28 ++++ extensions/pom.xml | 1 + extensions/readme.adoc | 5 +- integration-tests/jms/pom.xml | 147 +++++++++++++++++++++ .../quarkus/component/jms/it/JmsResource.java | 58 ++++++++ .../camel/quarkus/component/jms/it/JmsIT.java | 24 ++++ .../camel/quarkus/component/jms/it/JmsTest.java | 50 +++++++ .../quarkus/component/jms/it/JmsTestResource.java | 71 ++++++++++ integration-tests/pom.xml | 1 + pom.xml | 3 +- poms/bom-deployment/pom.xml | 5 + poms/bom/pom.xml | 41 ++++++ 18 files changed, 684 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml index ef5bd3c..c90ba11 100644 --- a/.github/workflows/pr-build.yaml +++ b/.github/workflows/pr-build.yaml @@ -213,7 +213,8 @@ jobs: -DskipTests \ -pl :camel-quarkus-integration-test-sjms \ -pl :camel-quarkus-integration-test-kafka \ - -pl :camel-quarkus-integration-test-paho + -pl :camel-quarkus-integration-test-paho \ + -pl :camel-quarkus-integration-test-jms dataformats: runs-on: ubuntu-latest needs: build 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 c5ed97f..35ad698 100644 --- a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc +++ b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc @@ -18,7 +18,7 @@ In case you are missing some Camel feature in the list: == Camel Components // components: START -Number of Camel components: 70 in 60 JAR artifacts (0 deprecated) +Number of Camel components: 71 in 61 JAR artifacts (0 deprecated) [width="100%",cols="4,1,5",options="header"] |=== @@ -132,6 +132,9 @@ Number of Camel components: 70 in 60 JAR artifacts (0 deprecated) | link:https://camel.apache.org/components/latest/jira-component.html[Jira] (camel-quarkus-jira) + `jira:type` | 1.1.0 | The jira component interacts with the JIRA issue tracker. +| link:https://camel.apache.org/components/latest/jms-component.html[JMS] (camel-quarkus-jms) + +`jms:destinationType:destinationName` | 1.2.0 | The jms component allows messages to be sent to (or consumed from) a JMS Queue or Topic. + | link:https://camel.apache.org/components/latest/kafka-component.html[Kafka] (camel-quarkus-kafka) + `kafka:topic` | 1.0.0-M1 | The kafka component allows messages to be sent to (or consumed from) Apache Kafka brokers. diff --git a/extensions/jms/deployment/pom.xml b/extensions/jms/deployment/pom.xml new file mode 100644 index 0000000..6df4ba7 --- /dev/null +++ b/extensions/jms/deployment/pom.xml @@ -0,0 +1,79 @@ +<?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-jms-parent</artifactId> + <version>1.1.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-jms-deployment</artifactId> + <name>Camel Quarkus :: JMS :: 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-support-spring-deployment</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-jms</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/jms/deployment/src/main/java/org/apache/camel/quarkus/component/jms/deployment/JmsProcessor.java b/extensions/jms/deployment/src/main/java/org/apache/camel/quarkus/component/jms/deployment/JmsProcessor.java new file mode 100644 index 0000000..cc27d8d --- /dev/null +++ b/extensions/jms/deployment/src/main/java/org/apache/camel/quarkus/component/jms/deployment/JmsProcessor.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.jms.deployment; + +import io.quarkus.deployment.annotations.BuildStep; +import io.quarkus.deployment.builditem.FeatureBuildItem; + +class JmsProcessor { + + private static final String FEATURE = "camel-jms"; + + @BuildStep + FeatureBuildItem feature() { + return new FeatureBuildItem(FEATURE); + } + +} diff --git a/extensions/jms/pom.xml b/extensions/jms/pom.xml new file mode 100644 index 0000000..8fbdba5 --- /dev/null +++ b/extensions/jms/pom.xml @@ -0,0 +1,50 @@ +<?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</artifactId> + <version>1.1.0-SNAPSHOT</version> + <relativePath>../../poms/build-parent/pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-jms-parent</artifactId> + <name>Camel Quarkus :: JMS</name> + <packaging>pom</packaging> + + <modules> + <module>deployment</module> + <module>runtime</module> + </modules> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-bom-deployment</artifactId> + <version>${quarkus.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> +</project> diff --git a/extensions/jms/runtime/pom.xml b/extensions/jms/runtime/pom.xml new file mode 100644 index 0000000..ebcf66a --- /dev/null +++ b/extensions/jms/runtime/pom.xml @@ -0,0 +1,86 @@ +<?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-jms-parent</artifactId> + <version>1.1.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-jms</artifactId> + <name>Camel Quarkus :: JMS :: Runtime</name> + + <properties> + <firstVersion>1.2.0</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.quarkus</groupId> + <artifactId>camel-quarkus-support-spring</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-jms</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/jms/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/jms/runtime/src/main/resources/META-INF/quarkus-extension.yaml new file mode 100644 index 0000000..1b97d2b --- /dev/null +++ b/extensions/jms/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -0,0 +1,28 @@ +# +# 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: "Camel Quarkus JMS" +description: "Camel Quarkus JMS Support" +metadata: + keywords: + - "camel" + - "messaging" + - "jms" + guide: "https://quarkus.io/guides/camel" + categories: + - "integration" \ No newline at end of file diff --git a/extensions/pom.xml b/extensions/pom.xml index 91efa43..5afa046 100644 --- a/extensions/pom.xml +++ b/extensions/pom.xml @@ -83,6 +83,7 @@ <module>jackson</module> <module>jdbc</module> <module>jira</module> + <module>jms</module> <module>johnzon</module> <module>jsonpath</module> <module>kafka</module> diff --git a/extensions/readme.adoc b/extensions/readme.adoc index 48a983b..2f295a1 100644 --- a/extensions/readme.adoc +++ b/extensions/readme.adoc @@ -5,7 +5,7 @@ Apache Camel Quarkus supports the following Camel artifacts as Quarkus Extension == Camel Components // components: START -Number of Camel components: 70 in 60 JAR artifacts (0 deprecated) +Number of Camel components: 71 in 61 JAR artifacts (0 deprecated) [width="100%",cols="4,1,5",options="header"] |=== @@ -119,6 +119,9 @@ Number of Camel components: 70 in 60 JAR artifacts (0 deprecated) | link:https://camel.apache.org/components/latest/jira-component.html[Jira] (camel-quarkus-jira) + `jira:type` | 1.1.0 | The jira component interacts with the JIRA issue tracker. +| link:https://camel.apache.org/components/latest/jms-component.html[JMS] (camel-quarkus-jms) + +`jms:destinationType:destinationName` | 1.2.0 | The jms component allows messages to be sent to (or consumed from) a JMS Queue or Topic. + | link:https://camel.apache.org/components/latest/kafka-component.html[Kafka] (camel-quarkus-kafka) + `kafka:topic` | 1.0.0-M1 | The kafka component allows messages to be sent to (or consumed from) Apache Kafka brokers. diff --git a/integration-tests/jms/pom.xml b/integration-tests/jms/pom.xml new file mode 100644 index 0000000..f2ee8db --- /dev/null +++ b/integration-tests/jms/pom.xml @@ -0,0 +1,147 @@ +<?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-integration-tests</artifactId> + <version>1.1.0-SNAPSHOT</version> + </parent> + + <artifactId>camel-quarkus-integration-test-jms</artifactId> + <name>Camel Quarkus :: Integration Tests :: JMS</name> + <description>Integration tests for Camel Quarkus JMS 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-jms-deployment,camel-quarkus-support-policy-deployment</mvnd.builder.rule> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-jms</artifactId> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-resteasy</artifactId> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-artemis-jms</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.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-integration-test-support</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.activemq</groupId> + <artifactId>artemis-server</artifactId> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>org.jboss.logmanager</groupId> + <artifactId>jboss-logmanager</artifactId> + </exclusion> + <exclusion> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.jboss.logging</groupId> + <artifactId>commons-logging-jboss-logging</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> + + <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> + <configuration> + <systemProperties> + <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path> + </systemProperties> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> + +</project> diff --git a/integration-tests/jms/src/main/java/org/apache/camel/quarkus/component/jms/it/JmsResource.java b/integration-tests/jms/src/main/java/org/apache/camel/quarkus/component/jms/it/JmsResource.java new file mode 100644 index 0000000..f400b45 --- /dev/null +++ b/integration-tests/jms/src/main/java/org/apache/camel/quarkus/component/jms/it/JmsResource.java @@ -0,0 +1,58 @@ +/* + * 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.jms.it; + +import java.net.URI; + +import javax.inject.Inject; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +import org.apache.camel.ConsumerTemplate; +import org.apache.camel.ProducerTemplate; + +@Path("/jms") +public class JmsResource { + + @Inject + ProducerTemplate producerTemplate; + + @Inject + ConsumerTemplate consumerTemplate; + + @Path("/get/{queueName}") + @GET + @Produces(MediaType.TEXT_PLAIN) + public String consumeMessage(@PathParam("queueName") String queueName) { + return consumerTemplate.receiveBodyNoWait("jms:queue:" + queueName, String.class); + } + + @Path("/post/{queueName}") + @POST + @Consumes(MediaType.TEXT_PLAIN) + @Produces(MediaType.TEXT_PLAIN) + public Response produceMessage(@PathParam("queueName") String queueName, String message) throws Exception { + producerTemplate.sendBody("jms:queue:" + queueName, message); + return Response.created(new URI("https://camel.apache.org/")).build(); + } +} diff --git a/integration-tests/jms/src/test/java/org/apache/camel/quarkus/component/jms/it/JmsIT.java b/integration-tests/jms/src/test/java/org/apache/camel/quarkus/component/jms/it/JmsIT.java new file mode 100644 index 0000000..a3e9357 --- /dev/null +++ b/integration-tests/jms/src/test/java/org/apache/camel/quarkus/component/jms/it/JmsIT.java @@ -0,0 +1,24 @@ +/* + * 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.jms.it; + +import io.quarkus.test.junit.NativeImageTest; + +@NativeImageTest +class JmsIT extends JmsTest { + +} diff --git a/integration-tests/jms/src/test/java/org/apache/camel/quarkus/component/jms/it/JmsTest.java b/integration-tests/jms/src/test/java/org/apache/camel/quarkus/component/jms/it/JmsTest.java new file mode 100644 index 0000000..7579ffa --- /dev/null +++ b/integration-tests/jms/src/test/java/org/apache/camel/quarkus/component/jms/it/JmsTest.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.quarkus.component.jms.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.core.Is.is; + +@QuarkusTest +@QuarkusTestResource(JmsTestResource.class) +class JmsTest { + + @Test + public void testJmsComponent() { + String message = "Hello Camel Quarkus JMS"; + + RestAssured.given() + .contentType(ContentType.TEXT) + .body(message) + .post("/jms/post/{queueName}", "jms-test-queue") + .then() + .statusCode(201); + + RestAssured.given() + .contentType(ContentType.TEXT) + .body(message) + .get("/jms/get/{queueName}", "jms-test-queue") + .then() + .statusCode(200) + .body(is(message)); + } +} diff --git a/integration-tests/jms/src/test/java/org/apache/camel/quarkus/component/jms/it/JmsTestResource.java b/integration-tests/jms/src/test/java/org/apache/camel/quarkus/component/jms/it/JmsTestResource.java new file mode 100644 index 0000000..119af05 --- /dev/null +++ b/integration-tests/jms/src/test/java/org/apache/camel/quarkus/component/jms/it/JmsTestResource.java @@ -0,0 +1,71 @@ +/* + * 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.jms.it; + +import java.io.File; +import java.nio.file.Paths; +import java.util.Collections; +import java.util.Map; + +import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; +import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl; +import org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ; +import org.apache.camel.quarkus.test.AvailablePortFinder; +import org.apache.commons.io.FileUtils; + +public class JmsTestResource implements QuarkusTestResourceLifecycleManager { + private EmbeddedActiveMQ embedded; + + @Override + public Map<String, String> start() { + try { + final File dataDirectory = Paths.get("./target/artemis").toFile(); + FileUtils.deleteDirectory(dataDirectory); + + final int port = AvailablePortFinder.getNextAvailable(); + final String url = String.format("tcp://127.0.0.1:%d", port); + + ConfigurationImpl cfg = new ConfigurationImpl(); + cfg.addAcceptorConfiguration("activemq", url); + cfg.setSecurityEnabled(false); + cfg.setBrokerInstance(dataDirectory); + + embedded = new EmbeddedActiveMQ(); + embedded.setConfiguration(cfg); + embedded.start(); + + return Collections.singletonMap("quarkus.artemis.url", url); + } catch (Exception e) { + throw new RuntimeException("Could not start embedded ActiveMQ server", e); + } + } + + @Override + public void stop() { + try { + } catch (Exception e) { + // ignored + } + try { + if (embedded != null) { + embedded.stop(); + } + } catch (Exception e) { + throw new RuntimeException("Could not stop embedded ActiveMQ server", e); + } + } +} diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 211d877..7cbc124 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -193,6 +193,7 @@ <module>infinispan</module> <module>jdbc</module> <module>jira</module> + <module>jms</module> <module>jsonpath</module> <module>kafka</module> <module>mail</module> diff --git a/pom.xml b/pom.xml index 440fd81..9936cfb 100644 --- a/pom.xml +++ b/pom.xml @@ -53,7 +53,8 @@ <xalan.version>2.7.2</xalan.version> <xerces.version>2.12.0</xerces.version> <kotlin.version>1.3.61</kotlin.version> - <spring.version>5.2.1.RELEASE</spring.version> + <!-- Keep spring.version aligned with the version used by Camel --> + <spring.version>5.2.3.RELEASE</spring.version> <retrofit.version>2.5.0</retrofit.version> <consul-client.version>1.3.3</consul-client.version> <stax2.version>4.2</stax2.version> diff --git a/poms/bom-deployment/pom.xml b/poms/bom-deployment/pom.xml index 92b1d98..b9a432d 100644 --- a/poms/bom-deployment/pom.xml +++ b/poms/bom-deployment/pom.xml @@ -281,6 +281,11 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-jms-deployment</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-johnzon-deployment</artifactId> <version>${camel-quarkus.version}</version> </dependency> diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml index 6a05473..f74b193 100644 --- a/poms/bom/pom.xml +++ b/poms/bom/pom.xml @@ -372,6 +372,17 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-jms</artifactId> + <version>${camel.version}</version> + <exclusions> + <exclusion> + <groupId>org.apache.camel</groupId> + <artifactId>camel-spring</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-johnzon</artifactId> <version>${camel.version}</version> </dependency> @@ -875,6 +886,11 @@ </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-jms</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-johnzon</artifactId> <version>${camel-quarkus.version}</version> </dependency> @@ -1228,6 +1244,21 @@ </dependency> <dependency> <groupId>org.springframework</groupId> + <artifactId>spring-aop</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-beans</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>${spring.version}</version> <exclusions> @@ -1238,6 +1269,16 @@ </exclusions> </dependency> <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-messaging</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-tx</artifactId> + <version>${spring.version}</version> + </dependency> + <dependency> <groupId>org.yaml</groupId> <artifactId>snakeyaml</artifactId> <version>${snakeyaml.version}</version>
