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 d043ee213934da0d94911a7c37b507f866b90ffa Author: James Netherton <[email protected]> AuthorDate: Tue Mar 3 17:28:22 2020 +0000 Combine messaging tests into one module --- .github/workflows/pr-build.yaml | 4 +- .../component/paho/deployment/PahoProcessor.java | 10 +- integration-tests/jms/pom.xml | 147 ----------------- .../quarkus/component/jms/it/JmsResource.java | 58 ------- .../quarkus/component/jms/it/JmsTestResource.java | 71 --------- integration-tests/{paho => messaging}/pom.xml | 45 +++--- .../component/messaging/it/JmsResource.java | 105 ++++++++++++ .../messaging/it/ActiveMQTestResource.java | 75 +++++++++ .../quarkus/component/messaging}/it/JmsIT.java | 2 +- .../quarkus/component/messaging}/it/JmsTest.java | 19 +-- .../quarkus/component/paho/it/PahoResource.java | 64 -------- .../component/paho/it/ActiveMQTestResource.java | 84 ---------- .../camel/quarkus/component/paho/it/PahoIT.java | 24 --- .../camel/quarkus/component/paho/it/PahoTest.java | 46 ------ integration-tests/pom.xml | 10 +- integration-tests/sjms/.gitignore | 1 - integration-tests/sjms/pom.xml | 176 --------------------- .../quarkus/component/sjms/CamelSjmsResource.java | 76 --------- .../quarkus/component/sjms/CamelSjmsRoute.java | 28 ---- .../sjms/src/main/resources/application.properties | 24 --- .../quarkus/component/sjms/it/CamelSjmsIT.java | 23 --- .../quarkus/component/sjms/it/CamelSjmsTest.java | 60 ------- .../component/sjms/it/CamelSjmsTestResource.java | 83 ---------- .../sjms/src/test/resources/broker.xml | 44 ------ 24 files changed, 223 insertions(+), 1056 deletions(-) diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml index c90ba11..44f29e2 100644 --- a/.github/workflows/pr-build.yaml +++ b/.github/workflows/pr-build.yaml @@ -211,10 +211,8 @@ jobs: -Dnative \ -Ddocker \ -DskipTests \ - -pl :camel-quarkus-integration-test-sjms \ -pl :camel-quarkus-integration-test-kafka \ - -pl :camel-quarkus-integration-test-paho \ - -pl :camel-quarkus-integration-test-jms + -pl :camel-quarkus-integration-test-messaging dataformats: runs-on: ubuntu-latest needs: build diff --git a/extensions/paho/deployment/src/main/java/org/apache/camel/quarkus/component/paho/deployment/PahoProcessor.java b/extensions/paho/deployment/src/main/java/org/apache/camel/quarkus/component/paho/deployment/PahoProcessor.java index 2e03afe..8d7f7b1 100644 --- a/extensions/paho/deployment/src/main/java/org/apache/camel/quarkus/component/paho/deployment/PahoProcessor.java +++ b/extensions/paho/deployment/src/main/java/org/apache/camel/quarkus/component/paho/deployment/PahoProcessor.java @@ -27,6 +27,8 @@ import io.quarkus.deployment.builditem.FeatureBuildItem; import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem; import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBundleBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; +import org.apache.camel.component.paho.PahoConfiguration; +import org.apache.camel.quarkus.core.deployment.UnbannedReflectiveBuildItem; import org.eclipse.paho.client.mqttv3.internal.SSLNetworkModuleFactory; import org.eclipse.paho.client.mqttv3.internal.TCPNetworkModuleFactory; import org.eclipse.paho.client.mqttv3.logging.JSR47Logger; @@ -39,7 +41,8 @@ class PahoProcessor { private static final List<Class<?>> PAHO_REFLECTIVE_CLASSES = Arrays.asList( JSR47Logger.class, TCPNetworkModuleFactory.class, - SSLNetworkModuleFactory.class); + SSLNetworkModuleFactory.class, + PahoConfiguration.class); @Inject BuildProducer<NativeImageResourceBuildItem> resource; @@ -61,6 +64,11 @@ class PahoProcessor { } @BuildStep + UnbannedReflectiveBuildItem whitelistConfigurationClasses() { + return new UnbannedReflectiveBuildItem(PahoConfiguration.class.getName()); + } + + @BuildStep void registerBundleResource() { resource.produce(new NativeImageResourceBuildItem("META-INF/services/" + NetworkModuleFactory.class.getName())); resourceBundle.produce(new NativeImageResourceBundleBuildItem("org.eclipse.paho.client.mqttv3.internal.nls.logcat")); diff --git a/integration-tests/jms/pom.xml b/integration-tests/jms/pom.xml deleted file mode 100644 index f2ee8db..0000000 --- a/integration-tests/jms/pom.xml +++ /dev/null @@ -1,147 +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-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 deleted file mode 100644 index f400b45..0000000 --- a/integration-tests/jms/src/main/java/org/apache/camel/quarkus/component/jms/it/JmsResource.java +++ /dev/null @@ -1,58 +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.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/JmsTestResource.java b/integration-tests/jms/src/test/java/org/apache/camel/quarkus/component/jms/it/JmsTestResource.java deleted file mode 100644 index 119af05..0000000 --- a/integration-tests/jms/src/test/java/org/apache/camel/quarkus/component/jms/it/JmsTestResource.java +++ /dev/null @@ -1,71 +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.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/paho/pom.xml b/integration-tests/messaging/pom.xml similarity index 82% rename from integration-tests/paho/pom.xml rename to integration-tests/messaging/pom.xml index 5d0e46f..be9b6f0 100644 --- a/integration-tests/paho/pom.xml +++ b/integration-tests/messaging/pom.xml @@ -25,9 +25,9 @@ <version>1.1.0-SNAPSHOT</version> </parent> - <artifactId>camel-quarkus-integration-test-paho</artifactId> - <name>Camel Quarkus :: Integration Tests :: Paho</name> - <description>Integration tests for Camel Quarkus Paho extension</description> + <artifactId>camel-quarkus-integration-test-messaging</artifactId> + <name>Camel Quarkus :: Integration Tests :: Messaging</name> + <description>Integration tests for Camel Quarkus Messaging extension</description> <properties> <!-- mvnd, a.k.a. Maven Daemon: https://github.com/gnodet/mvnd --> @@ -36,18 +36,34 @@ <!-- 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-paho-deployment,camel-quarkus-support-policy-deployment</mvnd.builder.rule> + <mvnd.builder.rule>camel-quarkus-jms-deployment,camel-quarkus-paho-deployment,camel-quarkus-sjms-deployment,camel-quarkus-sjms2-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>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-paho</artifactId> </dependency> <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-sjms</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-sjms2</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> @@ -60,28 +76,9 @@ <artifactId>rest-assured</artifactId> <scope>test</scope> </dependency> - - <!-- test dependencies - camel-quarkus --> <dependency> <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-integration-test-support</artifactId> - <scope>test</scope> - </dependency> - - <!-- test dependencies - activemq --> - <dependency> - <groupId>org.apache.activemq</groupId> - <artifactId>activemq-kahadb-store</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.activemq</groupId> - <artifactId>activemq-mqtt</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.activemq</groupId> - <artifactId>activemq-broker</artifactId> + <artifactId>camel-quarkus-integration-testcontainers-support</artifactId> <scope>test</scope> </dependency> </dependencies> diff --git a/integration-tests/messaging/src/main/java/org/apache/camel/quarkus/component/messaging/it/JmsResource.java b/integration-tests/messaging/src/main/java/org/apache/camel/quarkus/component/messaging/it/JmsResource.java new file mode 100644 index 0000000..5d22df8 --- /dev/null +++ b/integration-tests/messaging/src/main/java/org/apache/camel/quarkus/component/messaging/it/JmsResource.java @@ -0,0 +1,105 @@ +/* + * 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.messaging.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("/messaging") +public class JmsResource { + + @Inject + ProducerTemplate producerTemplate; + + @Inject + ConsumerTemplate consumerTemplate; + + // ***************************** + // + // camel-jms + // + // ***************************** + + @Path("/jms/{queueName}") + @GET + @Produces(MediaType.TEXT_PLAIN) + public String consumeJmsMessage(@PathParam("queueName") String queueName) { + return consumerTemplate.receiveBody("jms:queue:" + queueName, 5000, String.class); + } + + @Path("/jms/{queueName}") + @POST + @Consumes(MediaType.TEXT_PLAIN) + public Response produceJmsMessage(@PathParam("queueName") String queueName, String message) throws Exception { + producerTemplate.sendBody("jms:queue:" + queueName, message); + return Response.created(new URI("https://camel.apache.org/")).build(); + } + + // ***************************** + // + // camel-paho + // + // ***************************** + + @Path("/paho/{queueName}") + @GET + @Produces(MediaType.TEXT_PLAIN) + public String consumePahoMessage(@PathParam("queueName") String queueName) { + return consumerTemplate.receiveBody("paho:" + queueName, 5000, String.class); + } + + @Path("/paho/{queueName}") + @POST + @Consumes(MediaType.TEXT_PLAIN) + public Response producePahoMessage(@PathParam("queueName") String queueName, String message) throws Exception { + producerTemplate.sendBody("paho:" + queueName + "?retained=true", message); + return Response.created(new URI("https://camel.apache.org/")).build(); + } + + // ***************************** + // + // camel-sjms + // + // ***************************** + + @Path("/sjms/{queueName}") + @GET + @Produces(MediaType.TEXT_PLAIN) + public String consumeSjmsMessage(@PathParam("queueName") String queueName) { + return consumerTemplate.receiveBody("sjms:queue:" + queueName, 5000, String.class); + } + + @Path("/sjms/{queueName}") + @POST + @Consumes(MediaType.TEXT_PLAIN) + public Response produceSjmsMessage(@PathParam("queueName") String queueName, String message) throws Exception { + producerTemplate.sendBody("sjms2:queue:" + queueName, message); + return Response.created(new URI("https://camel.apache.org/")).build(); + } +} diff --git a/integration-tests/messaging/src/test/java/org/apache/camel/quarkus/component/messaging/it/ActiveMQTestResource.java b/integration-tests/messaging/src/test/java/org/apache/camel/quarkus/component/messaging/it/ActiveMQTestResource.java new file mode 100644 index 0000000..f8b2587 --- /dev/null +++ b/integration-tests/messaging/src/test/java/org/apache/camel/quarkus/component/messaging/it/ActiveMQTestResource.java @@ -0,0 +1,75 @@ +/* + * 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.messaging.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.wait.strategy.Wait; +import org.testcontainers.utility.TestcontainersConfiguration; + +public class ActiveMQTestResource implements QuarkusTestResourceLifecycleManager { + + private static final Logger LOGGER = LoggerFactory.getLogger(ActiveMQTestResource.class); + private static final String ACTIVEMQ_IMAGE = "vromero/activemq-artemis:2.11.0-alpine"; + private static final String ACTIVEMQ_USERNAME = "artemis"; + private static final String ACTIVEMQ_PASSWORD = "simetraehcapa"; + private static final int ACTIVEMQ_PORT = 61616; + + private GenericContainer container; + + @Override + public Map<String, String> start() { + LOGGER.info(TestcontainersConfiguration.getInstance().toString()); + + try { + container = new GenericContainer(ACTIVEMQ_IMAGE) + .withExposedPorts(ACTIVEMQ_PORT) + .waitingFor(Wait.forListeningPort()); + + container.start(); + + String brokerUrl = String.format("tcp://127.0.0.1:%d", container.getMappedPort(ACTIVEMQ_PORT)); + + return CollectionHelper.mapOf( + "quarkus.artemis.url", brokerUrl, + "quarkus.artemis.username", ACTIVEMQ_USERNAME, + "quarkus.artemis.password", ACTIVEMQ_PASSWORD, + "camel.component.paho.brokerUrl", brokerUrl, + "camel.component.paho.configuration.username", ACTIVEMQ_USERNAME, + "camel.component.paho.configuration.password", ACTIVEMQ_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/jms/src/test/java/org/apache/camel/quarkus/component/jms/it/JmsIT.java b/integration-tests/messaging/src/test/java/org/apache/camel/quarkus/component/messaging/it/JmsIT.java similarity index 94% rename from integration-tests/jms/src/test/java/org/apache/camel/quarkus/component/jms/it/JmsIT.java rename to integration-tests/messaging/src/test/java/org/apache/camel/quarkus/component/messaging/it/JmsIT.java index a3e9357..606dc33 100644 --- a/integration-tests/jms/src/test/java/org/apache/camel/quarkus/component/jms/it/JmsIT.java +++ b/integration-tests/messaging/src/test/java/org/apache/camel/quarkus/component/messaging/it/JmsIT.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.quarkus.component.jms.it; +package org.apache.camel.quarkus.component.messaging.it; import io.quarkus.test.junit.NativeImageTest; diff --git a/integration-tests/jms/src/test/java/org/apache/camel/quarkus/component/jms/it/JmsTest.java b/integration-tests/messaging/src/test/java/org/apache/camel/quarkus/component/messaging/it/JmsTest.java similarity index 70% rename from integration-tests/jms/src/test/java/org/apache/camel/quarkus/component/jms/it/JmsTest.java rename to integration-tests/messaging/src/test/java/org/apache/camel/quarkus/component/messaging/it/JmsTest.java index 7579ffa..030a264 100644 --- a/integration-tests/jms/src/test/java/org/apache/camel/quarkus/component/jms/it/JmsTest.java +++ b/integration-tests/messaging/src/test/java/org/apache/camel/quarkus/component/messaging/it/JmsTest.java @@ -14,35 +14,36 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.quarkus.component.jms.it; +package org.apache.camel.quarkus.component.messaging.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 org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; import static org.hamcrest.core.Is.is; @QuarkusTest -@QuarkusTestResource(JmsTestResource.class) +@QuarkusTestResource(ActiveMQTestResource.class) class JmsTest { - @Test - public void testJmsComponent() { - String message = "Hello Camel Quarkus JMS"; + @ParameterizedTest + @ValueSource(strings = { "jms", "paho", "sjms" }) + public void testJmsComponent(String component) { + String message = "Hello Camel Quarkus " + component; RestAssured.given() .contentType(ContentType.TEXT) .body(message) - .post("/jms/post/{queueName}", "jms-test-queue") + .post("/messaging/" + component + "/{queueName}", component + "-test-queue") .then() .statusCode(201); RestAssured.given() .contentType(ContentType.TEXT) - .body(message) - .get("/jms/get/{queueName}", "jms-test-queue") + .get("/messaging/" + component + "/{queueName}", component + "-test-queue") .then() .statusCode(200) .body(is(message)); diff --git a/integration-tests/paho/src/main/java/org/apache/camel/quarkus/component/paho/it/PahoResource.java b/integration-tests/paho/src/main/java/org/apache/camel/quarkus/component/paho/it/PahoResource.java deleted file mode 100644 index d383ddb..0000000 --- a/integration-tests/paho/src/main/java/org/apache/camel/quarkus/component/paho/it/PahoResource.java +++ /dev/null @@ -1,64 +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.paho.it; - -import javax.enterprise.context.ApplicationScoped; -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.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -import org.apache.camel.ConsumerTemplate; -import org.apache.camel.ProducerTemplate; -import org.jboss.logging.Logger; - -@Path("/paho") -@ApplicationScoped -public class PahoResource { - - private static final Logger LOG = Logger.getLogger(PahoResource.class); - - @Inject - ProducerTemplate producerTemplate; - - @Inject - ConsumerTemplate consumerTemplate; - - @Path("/queue") - @GET - @Produces(MediaType.TEXT_PLAIN) - public String get() { - final String message = consumerTemplate.receiveBody("paho:test/queue", String.class); - return message; - } - - @Path("/queue") - @POST - @Consumes(MediaType.TEXT_PLAIN) - @Produces(MediaType.TEXT_PLAIN) - public Response publish(String message) { - LOG.infof("Sending to paho: %s", message); - producerTemplate.requestBody("paho:test/queue?retained=true", message, String.class); - LOG.infof("Sent to paho: %s", message); - - return Response.ok().build(); - } -} diff --git a/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/ActiveMQTestResource.java b/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/ActiveMQTestResource.java deleted file mode 100644 index fab23f9..0000000 --- a/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/ActiveMQTestResource.java +++ /dev/null @@ -1,84 +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.paho.it; - -import java.io.File; -import java.io.IOException; -import java.net.URI; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.Collections; -import java.util.Comparator; -import java.util.Map; - -import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; -import org.apache.activemq.broker.BrokerService; -import org.apache.activemq.broker.TransportConnector; -import org.apache.camel.quarkus.test.AvailablePortFinder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ActiveMQTestResource implements QuarkusTestResourceLifecycleManager { - private static final Logger LOGGER = LoggerFactory.getLogger(ActiveMQTestResource.class); - private BrokerService broker; - - @Override - public Map<String, String> start() { - try { - final int port = AvailablePortFinder.getNextAvailable(); - final String transportUri = String.format("mqtt://127.0.0.1:%d", port); - final String brokerUri = String.format("tcp://127.0.0.1:%d", port); - final File dataDirectory = Files.createTempDirectory("paho-data-").toFile(); - - TransportConnector mqtt = new TransportConnector(); - mqtt.setUri(new URI(transportUri)); - - broker = new BrokerService(); - broker.addConnector(mqtt); - broker.setDataDirectoryFile(dataDirectory); - broker.start(); - - return Collections.singletonMap("camel.component.paho.brokerUrl", brokerUri); - } catch (Exception e) { - LOGGER.error("Starting the ActiveMQ broker with exception.", e); - throw new RuntimeException("Starting the ActiveMQ broker with exception.", e); - } - } - - @Override - public void stop() { - try { - if (broker != null) { - broker.stop(); - } - } catch (Exception e) { - LOGGER.error("Stopping the ActiveMQ broker with exception.", e); - } - - try { - if (broker != null) { - Files.walk(broker.getDataDirectoryFile().toPath()) - .sorted(Comparator.reverseOrder()) - .map(Path::toFile) - .forEach(File::delete); - } - } catch (IOException e) { - LOGGER.error("Error cleaning up ActiveMQ data directory", e); - } - } -} diff --git a/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/PahoIT.java b/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/PahoIT.java deleted file mode 100644 index 87597c4..0000000 --- a/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/PahoIT.java +++ /dev/null @@ -1,24 +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.paho.it; - -import io.quarkus.test.junit.NativeImageTest; - -@NativeImageTest -class PahoIT extends PahoTest { - -} diff --git a/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/PahoTest.java b/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/PahoTest.java deleted file mode 100644 index 4888f8c..0000000 --- a/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/PahoTest.java +++ /dev/null @@ -1,46 +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.paho.it; - -import java.util.UUID; - -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.Assertions; -import org.junit.jupiter.api.Test; - -@QuarkusTest -@QuarkusTestResource(ActiveMQTestResource.class) -class PahoTest { - - @Test - public void test() { - final String msg = UUID.randomUUID().toString().replace("-", ""); - - // publish the message to the queue - RestAssured.given() - .contentType(ContentType.TEXT).body(msg).post("/paho/queue") // - .then().statusCode(200); - - // receive the message from the queue - String body = RestAssured.get("/paho/queue").asString(); - Assertions.assertEquals(msg, body); - } - -} diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 7cbc124..fa99a18 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -34,7 +34,6 @@ <properties> <activemq-version>5.15.10</activemq-version> - <artemis.version>2.10.0</artemis.version> <ftpserver.version>1.1.1</ftpserver.version> <sshd.version>2.3.0</sshd.version> <testcontainers.version>1.12.5</testcontainers.version> @@ -144,11 +143,6 @@ </exclusion> </exclusions> </dependency> - <dependency> - <groupId>org.apache.activemq</groupId> - <artifactId>artemis-server</artifactId> - <version>${artemis.version}</version> - </dependency> </dependencies> </dependencyManagement> @@ -193,16 +187,15 @@ <module>infinispan</module> <module>jdbc</module> <module>jira</module> - <module>jms</module> <module>jsonpath</module> <module>kafka</module> <module>mail</module> + <module>messaging</module> <module>microprofile</module> <module>mongodb</module> <module>netty</module> <module>olingo4</module> <module>opentracing</module> - <module>paho</module> <module>pdf</module> <module>platform-http</module> <module>platform-http-engine</module> @@ -211,7 +204,6 @@ <module>scheduler</module> <module>seda</module> <module>servlet</module> - <module>sjms</module> <module>slack</module> <module>sql</module> <module>stream</module> diff --git a/integration-tests/sjms/.gitignore b/integration-tests/sjms/.gitignore deleted file mode 100644 index adbb97d..0000000 --- a/integration-tests/sjms/.gitignore +++ /dev/null @@ -1 +0,0 @@ -data/ \ No newline at end of file diff --git a/integration-tests/sjms/pom.xml b/integration-tests/sjms/pom.xml deleted file mode 100644 index e42e7b4..0000000 --- a/integration-tests/sjms/pom.xml +++ /dev/null @@ -1,176 +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-integration-tests</artifactId> - <version>1.1.0-SNAPSHOT</version> - </parent> - - <artifactId>camel-quarkus-integration-test-sjms</artifactId> - <name>Camel Quarkus :: Integration Tests :: SJMS</name> - <description>Integration tests for Camel Quarkus SJMS 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-log-deployment,camel-quarkus-sjms-deployment,camel-quarkus-sjms2-deployment,camel-quarkus-support-policy-deployment</mvnd.builder.rule> - </properties> - - <dependencies> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-sjms</artifactId> - </dependency> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-sjms2</artifactId> - </dependency> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-log</artifactId> - </dependency> - <dependency> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-resteasy</artifactId> - </dependency> - <dependency> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-resteasy-jsonb</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.assertj</groupId> - <artifactId>assertj-core</artifactId> - <scope>test</scope> - </dependency> - - <!-- test dependencies - camel-quarkus --> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-integration-test-support</artifactId> - <scope>test</scope> - </dependency> - - <!-- test dependencies - activemq --> - <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> - <plugin> - <groupId>com.mycila</groupId> - <artifactId>license-maven-plugin</artifactId> - <configuration> - <excludes> - <exclude>data/**/*</exclude> - </excludes> - </configuration> - </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/sjms/src/main/java/org/apache/camel/quarkus/component/sjms/CamelSjmsResource.java b/integration-tests/sjms/src/main/java/org/apache/camel/quarkus/component/sjms/CamelSjmsResource.java deleted file mode 100644 index 3a9e867..0000000 --- a/integration-tests/sjms/src/main/java/org/apache/camel/quarkus/component/sjms/CamelSjmsResource.java +++ /dev/null @@ -1,76 +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.sjms; - -import javax.enterprise.context.ApplicationScoped; -import javax.inject.Inject; -import javax.jms.ConnectionFactory; -import javax.jms.JMSConsumer; -import javax.jms.JMSContext; -import javax.jms.JMSException; -import javax.jms.JMSProducer; -import javax.jms.Message; -import javax.jms.Queue; -import javax.jms.Session; -import javax.json.Json; -import javax.json.JsonObject; -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; - -@Path("/test") -@ApplicationScoped -public class CamelSjmsResource { - @Inject - ConnectionFactory connectionFactory; - - @Path("/jms/{queueName}") - @POST - @Produces(MediaType.APPLICATION_JSON) - public JsonObject post(@PathParam("queueName") String queueName, String message) { - try (JMSContext context = connectionFactory.createContext(Session.AUTO_ACKNOWLEDGE)) { - final JMSProducer producer = context.createProducer(); - final Queue queue = context.createQueue(queueName); - - producer.send(queue, message); - } - - return Json.createObjectBuilder().build(); - } - - @Path("/jms/{queueName}") - @GET - @Produces(MediaType.APPLICATION_JSON) - public JsonObject get(@PathParam("queueName") String queueName) { - try (JMSContext context = connectionFactory.createContext(Session.AUTO_ACKNOWLEDGE); - JMSConsumer consumer = context.createConsumer(context.createQueue(queueName))) { - - Message msg = consumer.receive(10000L); - String body = msg != null ? msg.getBody(String.class) : ""; - - return Json.createObjectBuilder() - .add("queueName", queueName) - .add("body", body) - .build(); - } catch (JMSException e) { - throw new RuntimeException("Could not receive message", e); - } - } -} diff --git a/integration-tests/sjms/src/main/java/org/apache/camel/quarkus/component/sjms/CamelSjmsRoute.java b/integration-tests/sjms/src/main/java/org/apache/camel/quarkus/component/sjms/CamelSjmsRoute.java deleted file mode 100644 index 5eab43a..0000000 --- a/integration-tests/sjms/src/main/java/org/apache/camel/quarkus/component/sjms/CamelSjmsRoute.java +++ /dev/null @@ -1,28 +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.sjms; - -import org.apache.camel.builder.RouteBuilder; - -public class CamelSjmsRoute extends RouteBuilder { - @Override - public void configure() throws Exception { - from("sjms:queue:inbound") - .to("log:jms") - .to("sjms2:queue:outbound"); - } -} diff --git a/integration-tests/sjms/src/main/resources/application.properties b/integration-tests/sjms/src/main/resources/application.properties deleted file mode 100644 index be0a82f..0000000 --- a/integration-tests/sjms/src/main/resources/application.properties +++ /dev/null @@ -1,24 +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. -## --------------------------------------------------------------------------- - -# -# Quarkus -# -quarkus.log.file.enable = false -quarkus.log.category."org.apache.camel.quarkus.core.deployment".level = INFO -quarkus.log.category."org.apache.camel.quarkus.component.sjms".level = DEBUG -quarkus.log.category."org.apache.activemq.artemis".level = WARN diff --git a/integration-tests/sjms/src/test/java/org/apache/camel/quarkus/component/sjms/it/CamelSjmsIT.java b/integration-tests/sjms/src/test/java/org/apache/camel/quarkus/component/sjms/it/CamelSjmsIT.java deleted file mode 100644 index 2c61311..0000000 --- a/integration-tests/sjms/src/test/java/org/apache/camel/quarkus/component/sjms/it/CamelSjmsIT.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.sjms.it; - -import io.quarkus.test.junit.NativeImageTest; - -@NativeImageTest -public class CamelSjmsIT extends CamelSjmsTest { -} diff --git a/integration-tests/sjms/src/test/java/org/apache/camel/quarkus/component/sjms/it/CamelSjmsTest.java b/integration-tests/sjms/src/test/java/org/apache/camel/quarkus/component/sjms/it/CamelSjmsTest.java deleted file mode 100644 index 62b184c..0000000 --- a/integration-tests/sjms/src/test/java/org/apache/camel/quarkus/component/sjms/it/CamelSjmsTest.java +++ /dev/null @@ -1,60 +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.sjms.it; - -import java.util.UUID; - -import javax.inject.Inject; - -import io.quarkus.test.common.QuarkusTestResource; -import io.quarkus.test.junit.QuarkusTest; -import io.restassured.RestAssured; -import io.restassured.path.json.JsonPath; -import org.apache.camel.quarkus.core.CamelMain; -import org.junit.jupiter.api.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -@QuarkusTest -@QuarkusTestResource(CamelSjmsTestResource.class) -public class CamelSjmsTest { - @Inject - CamelMain main; - - @Test - void testQueueBridge() { - String body = UUID.randomUUID().toString(); - - RestAssured.given() - .contentType("text/plain") - .body(body) - .post("/test/jms/inbound") - .then() - .statusCode(200); - - JsonPath result = RestAssured.given() - .get("/test/jms/outbound") - .then() - .statusCode(200) - .extract() - .body() - .jsonPath(); - - assertThat(result.getString("queueName")).isEqualTo("outbound"); - assertThat(result.getString("body")).isEqualTo(body); - } -} diff --git a/integration-tests/sjms/src/test/java/org/apache/camel/quarkus/component/sjms/it/CamelSjmsTestResource.java b/integration-tests/sjms/src/test/java/org/apache/camel/quarkus/component/sjms/it/CamelSjmsTestResource.java deleted file mode 100644 index 2440862..0000000 --- a/integration-tests/sjms/src/test/java/org/apache/camel/quarkus/component/sjms/it/CamelSjmsTestResource.java +++ /dev/null @@ -1,83 +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.sjms.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.core.CamelMain; -import org.apache.camel.quarkus.test.AvailablePortFinder; -import org.apache.commons.io.FileUtils; - -public class CamelSjmsTestResource implements QuarkusTestResourceLifecycleManager { - private CamelMain main; - private EmbeddedActiveMQ embedded; - - @Override - public void inject(Object testInstance) { - if (testInstance instanceof CamelSjmsTest) { - this.main = ((CamelSjmsTest) testInstance).main; - } - } - - @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 { - if (main != null) { - main.stop(); - } - } 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/sjms/src/test/resources/broker.xml b/integration-tests/sjms/src/test/resources/broker.xml deleted file mode 100644 index 2a6f911..0000000 --- a/integration-tests/sjms/src/test/resources/broker.xml +++ /dev/null @@ -1,44 +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. - ---> -<configuration xmlns="urn:activemq" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd"> - <core xmlns="urn:activemq:core"> - <paging-directory>./target/artemis/paging</paging-directory> - <bindings-directory>./target/artemis/bindings</bindings-directory> - <journal-directory>./target/artemis/journal</journal-directory> - <large-messages-directory>./target/artemis/large-messages</large-messages-directory> - - <connectors> - <connector name="activemq">tcp://localhost:61616</connector> - </connectors> - <acceptors> - <acceptor name="activemq">tcp://localhost:61616</acceptor> - </acceptors> - - <security-enabled>false</security-enabled> - - <queues> - <queue name="foo"> - <address>test-jms</address> - </queue> - </queues> - </core> -</configuration> \ No newline at end of file
