This is an automated email from the ASF dual-hosted git repository.
aldettinger pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/main by this push:
new b4c5122447 Test AWS 2 MQ fix comments (#8479)
b4c5122447 is described below
commit b4c5122447020cc7121be72430d8bcb8ef2c3841
Author: JinyuChen97 <[email protected]>
AuthorDate: Tue Mar 31 10:37:25 2026 +0100
Test AWS 2 MQ fix comments (#8479)
fixes #2401
---
integration-test-groups/aws2/aws2-mq/README.adoc | 45 ++++
integration-test-groups/aws2/aws2-mq/pom.xml | 141 +++++++++++
.../component/aws2/mq/it/Aws2MqResource.java | 279 +++++++++++++++++++++
.../src/main/resources/application.properties | 24 ++
.../quarkus/component/aws2/mq/it/Aws2MqIT.java | 24 ++
.../quarkus/component/aws2/mq/it/Aws2MqTest.java | 178 +++++++++++++
.../component/aws2/mq/it/Aws2MqTestResource.java | 59 +++++
.../aws2/mq/it/GroupedAws2MqTestResource.java | 26 ++
.../src/test/resources/mappings/createBroker.json | 18 ++
.../test/resources/mappings/createBrokerPojo.json | 18 ++
.../src/test/resources/mappings/deleteBroker.json | 16 ++
.../test/resources/mappings/deleteBrokerPojo.json | 16 ++
.../test/resources/mappings/describeBroker.json | 13 +
.../test/resources/mappings/listBrokers-empty.json | 15 ++
.../src/test/resources/mappings/listBrokers.json | 15 ++
.../src/test/resources/mappings/rebootBroker.json | 13 +
.../src/test/resources/mappings/updateBroker.json | 13 +
integration-test-groups/aws2/pom.xml | 1 +
integration-tests/aws2-grouped/pom.xml | 32 +++
19 files changed, 946 insertions(+)
diff --git a/integration-test-groups/aws2/aws2-mq/README.adoc
b/integration-test-groups/aws2/aws2-mq/README.adoc
new file mode 100644
index 0000000000..f61ee35a04
--- /dev/null
+++ b/integration-test-groups/aws2/aws2-mq/README.adoc
@@ -0,0 +1,45 @@
+= AWS MQ tests
+
+By default the tests run in WireMock playback mode using pre-recorded mappings
from `src/test/resources/mappings/`.
+
+NOTE: Amazon MQ is not supported by LocalStack community version, so the
`Aws2TestEnvCustomizer` SPI (used by other AWS modules to start a LocalStack
container) cannot be used here. WireMock is used instead to simulate the MQ API
in the default (non-real AWS) test mode.
+
+== Running against real AWS
+
+Refer to the xref:../README.adoc[AWS 2 integration tests README] for general
instructions on how to set up AWS credentials.
+
+The AWS credentials must have the following IAM permissions:
+
+* `mq:ListBrokers`
+* `mq:CreateBroker`
+* `mq:DescribeBroker`
+* `mq:UpdateBroker`
+* `mq:RebootBroker`
+* `mq:DeleteBroker`
+* `ec2:CreateNetworkInterface`
+* `ec2:CreateNetworkInterfacePermission`
+* `ec2:DeleteNetworkInterface`
+* `ec2:DescribeNetworkInterfaces`
+* `ec2:DescribeSubnets`
+* `ec2:DescribeSecurityGroups`
+* `ec2:DescribeVpcs`
+* `ec2:DescribeInternetGateways`
+* `ec2:DescribeRouteTables`
+* `ec2:DetachNetworkInterface`
+* `ec2:DeleteNetworkInterfacePermission`
+
+=== Running tests directly against real AWS
+
+[source,shell]
+----
+export AWS_ACCESS_KEY=<your-access-key-id>
+export AWS_SECRET_KEY=<your-secret-access-key>
+export AWS_REGION=us-east-1
+export CAMEL_QUARKUS_START_MOCK_BACKEND=false
+# Optional: override the ActiveMQ engine version (default: 5.18)
+export AWS_MQ_BROKER_ENGINE_VERSION=5.18
+# Optional: override the broker admin password (must be at least 12
characters, no commas/colons/equals/spaces)
+export AWS_MQ_BROKER_ADMIN_PASSWORD=<your-password>
+----
+
+NOTE: Amazon MQ broker creation takes several minutes. The tests use
Awaitility to poll broker state every minute (up to 30 minutes) until brokers
reach the `RUNNING` state.
\ No newline at end of file
diff --git a/integration-test-groups/aws2/aws2-mq/pom.xml
b/integration-test-groups/aws2/aws2-mq/pom.xml
new file mode 100644
index 0000000000..18aec27749
--- /dev/null
+++ b/integration-test-groups/aws2/aws2-mq/pom.xml
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-build-parent-it</artifactId>
+ <version>3.35.0-SNAPSHOT</version>
+ <relativePath>../../../poms/build-parent-it/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-integration-test-aws2-mq</artifactId>
+ <name>Camel Quarkus :: Integration Tests :: AWS 2 MQ</name>
+ <description>Integration tests for Camel Quarkus AWS 2 MQ
extension</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-aws2-mq</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy-jackson</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>software.amazon.awssdk</groupId>
+ <artifactId>mq</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <!-- test dependencies -->
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit</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-wiremock-support</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.awaitility</groupId>
+ <artifactId>awaitility</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>native</id>
+ <activation>
+ <property>
+ <name>native</name>
+ </property>
+ </activation>
+ <properties>
+ <quarkus.native.enabled>true</quarkus.native.enabled>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>virtualDependencies</id>
+ <activation>
+ <property>
+ <name>!noVirtualDependencies</name>
+ </property>
+ </activation>
+ <dependencies>
+ <!-- The following dependencies guarantee that this module is
built after them. You can update them by running `mvn process-resources
-Pformat -N` from the source tree root directory -->
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-aws2-mq-deployment</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>skip-testcontainers-tests</id>
+ <activation>
+ <property>
+ <name>skip-testcontainers-tests</name>
+ </property>
+ </activation>
+ <properties>
+ <skipTests>true</skipTests>
+ </properties>
+ </profile>
+ </profiles>
+
+</project>
diff --git
a/integration-test-groups/aws2/aws2-mq/src/main/java/org/apache/camel/quarkus/component/aws2/mq/it/Aws2MqResource.java
b/integration-test-groups/aws2/aws2-mq/src/main/java/org/apache/camel/quarkus/component/aws2/mq/it/Aws2MqResource.java
new file mode 100644
index 0000000000..1352432592
--- /dev/null
+++
b/integration-test-groups/aws2/aws2-mq/src/main/java/org/apache/camel/quarkus/component/aws2/mq/it/Aws2MqResource.java
@@ -0,0 +1,279 @@
+/*
+ * 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.aws2.mq.it;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+import jakarta.ws.rs.DELETE;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.PUT;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.QueryParam;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.Response;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.aws2.mq.MQ2Constants;
+import org.apache.camel.component.aws2.mq.MQ2Operations;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
+import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
+import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
+import software.amazon.awssdk.regions.Region;
+import software.amazon.awssdk.services.mq.MqClient;
+import software.amazon.awssdk.services.mq.MqClientBuilder;
+import software.amazon.awssdk.services.mq.model.BrokerSummary;
+import software.amazon.awssdk.services.mq.model.ConfigurationId;
+import software.amazon.awssdk.services.mq.model.CreateBrokerRequest;
+import software.amazon.awssdk.services.mq.model.CreateBrokerResponse;
+import software.amazon.awssdk.services.mq.model.DeleteBrokerRequest;
+import software.amazon.awssdk.services.mq.model.DeploymentMode;
+import software.amazon.awssdk.services.mq.model.DescribeBrokerRequest;
+import software.amazon.awssdk.services.mq.model.DescribeBrokerResponse;
+import software.amazon.awssdk.services.mq.model.EngineType;
+import software.amazon.awssdk.services.mq.model.ListBrokersResponse;
+import software.amazon.awssdk.services.mq.model.RebootBrokerRequest;
+import software.amazon.awssdk.services.mq.model.UpdateBrokerRequest;
+import software.amazon.awssdk.services.mq.model.User;
+
+import static org.apache.camel.component.aws2.mq.MQ2Operations.*;
+
+@Path("/aws2-mq")
+@ApplicationScoped
+public class Aws2MqResource {
+
+ @Inject
+ ProducerTemplate producerTemplate;
+
+ @ConfigProperty(name = "aws.mq.broker.engine.version")
+ String brokerEngineVersion;
+
+ @ConfigProperty(name = "aws.mq.broker.admin.password")
+ String brokerAdminPassword;
+
+ @ConfigProperty(name = "camel.component.aws2-mq.access-key")
+ String accessKey;
+
+ @ConfigProperty(name = "camel.component.aws2-mq.secret-key")
+ String secretKey;
+
+ @ConfigProperty(name = "camel.component.aws2-mq.region")
+ String awsRegion;
+
+ @ConfigProperty(name = "camel.component.aws2-mq.uri-endpoint-override")
+ Optional<String> uriEndpointOverride;
+
+ @ConfigProperty(name = "camel.component.aws2-mq.override-endpoint")
+ boolean overrideEndpoint;
+
+ @Path("/brokers")
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ public List<String> listBrokers() {
+ return producerTemplate.requestBody(
+ componentUri(listBrokers),
+ null,
+ ListBrokersResponse.class)
+ .brokerSummaries().stream()
+ .map(BrokerSummary::brokerName)
+ .collect(Collectors.toList());
+ }
+
+ @Path("/broker/{brokerName}")
+ @POST
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response createBroker(@PathParam("brokerName") String brokerName)
throws Exception {
+ User adminUser = User.builder()
+ .username("admin")
+ .password(brokerAdminPassword)
+ .build();
+
+ CreateBrokerResponse response = producerTemplate.requestBodyAndHeaders(
+ componentUri(createBroker),
+ null,
+ Map.of(
+ MQ2Constants.BROKER_NAME, brokerName,
+ MQ2Constants.BROKER_ENGINE,
EngineType.ACTIVEMQ.toString(),
+ MQ2Constants.BROKER_ENGINE_VERSION,
brokerEngineVersion,
+ MQ2Constants.BROKER_DEPLOYMENT_MODE,
DeploymentMode.SINGLE_INSTANCE.toString(),
+ MQ2Constants.BROKER_INSTANCE_TYPE, "mq.t3.micro",
+ MQ2Constants.BROKER_USERS, List.of(adminUser),
+ MQ2Constants.BROKER_PUBLICLY_ACCESSIBLE, false),
+ CreateBrokerResponse.class);
+
+ return Response.created(new
URI("https://camel.apache.org/")).entity(response.brokerId()).build();
+ }
+
+ @Path("/broker/{brokerName}/pojo")
+ @POST
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response createBrokerPojo(@PathParam("brokerName") String
brokerName) throws Exception {
+ User adminUser = User.builder()
+ .username("admin")
+ .password(brokerAdminPassword)
+ .build();
+
+ CreateBrokerRequest request = CreateBrokerRequest.builder()
+ .brokerName(brokerName)
+ .engineType(EngineType.ACTIVEMQ)
+ .engineVersion(brokerEngineVersion)
+ .deploymentMode(DeploymentMode.SINGLE_INSTANCE)
+ .hostInstanceType("mq.t3.micro")
+ .users(adminUser)
+ .publiclyAccessible(false)
+ .build();
+
+ CreateBrokerResponse response = producerTemplate.requestBody(
+ componentUri(createBroker) + "&pojoRequest=true",
+ request,
+ CreateBrokerResponse.class);
+
+ return Response.created(new
URI("https://camel.apache.org/")).entity(response.brokerId()).build();
+ }
+
+ @Path("/broker/describe")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String describeBroker(@QueryParam("brokerId") String brokerId) {
+ return producerTemplate.requestBodyAndHeader(
+ componentUri(describeBroker),
+ null,
+ MQ2Constants.BROKER_ID,
+ brokerId,
+ DescribeBrokerResponse.class)
+ .brokerStateAsString();
+ }
+
+ @Path("/broker/configurationId")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String getBrokerConfigurationId(@QueryParam("brokerId") String
brokerId) {
+ MqClientBuilder builder = MqClient.builder()
+ .region(Region.of(awsRegion))
+ .credentialsProvider(StaticCredentialsProvider.create(
+ AwsBasicCredentials.create(accessKey, secretKey)));
+ if (overrideEndpoint && uriEndpointOverride.isPresent()) {
+ builder.endpointOverride(URI.create(uriEndpointOverride.get()));
+ }
+ try (MqClient mqClient = builder.build()) {
+ return mqClient.describeBroker(DescribeBrokerRequest.builder()
+ .brokerId(brokerId)
+ .build())
+ .configurations().current().id();
+ }
+ }
+
+ @Path("/broker/describe/pojo")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String describeBrokerPojo(@QueryParam("brokerId") String brokerId) {
+ DescribeBrokerRequest request = DescribeBrokerRequest.builder()
+ .brokerId(brokerId)
+ .build();
+ return producerTemplate.requestBody(
+ componentUri(describeBroker) + "&pojoRequest=true",
+ request,
+ DescribeBrokerResponse.class)
+ .brokerStateAsString();
+ }
+
+ @Path("/broker")
+ @PUT
+ public Response updateBroker(@QueryParam("brokerId") String brokerId,
+ @QueryParam("configurationId") String configurationId) {
+ ConfigurationId configuration = ConfigurationId.builder()
+ .id(configurationId)
+ .build();
+ producerTemplate.requestBodyAndHeaders(
+ componentUri(updateBroker),
+ null,
+ Map.of(
+ MQ2Constants.BROKER_ID, brokerId,
+ MQ2Constants.CONFIGURATION_ID, configuration),
+ Object.class);
+ return Response.ok().build();
+ }
+
+ @Path("/broker/pojo")
+ @PUT
+ public Response updateBrokerPojo(@QueryParam("brokerId") String brokerId) {
+ UpdateBrokerRequest request = UpdateBrokerRequest.builder()
+ .brokerId(brokerId)
+ .autoMinorVersionUpgrade(true)
+ .build();
+ producerTemplate.requestBody(
+ componentUri(updateBroker) + "&pojoRequest=true",
+ request,
+ Object.class);
+ return Response.ok().build();
+ }
+
+ @Path("/broker/{brokerId}/reboot")
+ @POST
+ public void rebootBroker(@PathParam("brokerId") String brokerId) {
+ producerTemplate.requestBodyAndHeader(
+ componentUri(rebootBroker),
+ null,
+ MQ2Constants.BROKER_ID,
+ brokerId);
+ }
+
+ @Path("/broker/{brokerId}/reboot/pojo")
+ @POST
+ public void rebootBrokerPojo(@PathParam("brokerId") String brokerId) {
+ RebootBrokerRequest request = RebootBrokerRequest.builder()
+ .brokerId(brokerId)
+ .build();
+ producerTemplate.requestBody(
+ componentUri(rebootBroker) + "&pojoRequest=true",
+ request,
+ Object.class);
+ }
+
+ @Path("/broker")
+ @DELETE
+ public void deleteBroker(@QueryParam("brokerId") String brokerId) {
+ producerTemplate.requestBodyAndHeader(
+ componentUri(deleteBroker),
+ null,
+ MQ2Constants.BROKER_ID,
+ brokerId);
+ }
+
+ @Path("/broker/pojo")
+ @DELETE
+ public void deleteBrokerPojo(@QueryParam("brokerId") String brokerId) {
+ DeleteBrokerRequest request = DeleteBrokerRequest.builder()
+ .brokerId(brokerId)
+ .build();
+ producerTemplate.requestBody(
+ componentUri(deleteBroker) + "&pojoRequest=true",
+ request,
+ Object.class);
+ }
+
+ private String componentUri(MQ2Operations operation) {
+ return "aws2-mq:mq?operation=" + operation;
+ }
+}
diff --git
a/integration-test-groups/aws2/aws2-mq/src/main/resources/application.properties
b/integration-test-groups/aws2/aws2-mq/src/main/resources/application.properties
new file mode 100644
index 0000000000..60d3008e47
--- /dev/null
+++
b/integration-test-groups/aws2/aws2-mq/src/main/resources/application.properties
@@ -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.
+## ---------------------------------------------------------------------------
+
+camel.component.aws2-mq.access-key=${AWS_ACCESS_KEY}
+camel.component.aws2-mq.secret-key=${AWS_SECRET_KEY}
+camel.component.aws2-mq.region=${AWS_REGION:us-east-1}
+camel.component.aws2-mq.override-endpoint=false
+
+aws.mq.broker.engine.version=${AWS_MQ_BROKER_ENGINE_VERSION:5.18}
+aws.mq.broker.admin.password=${AWS_MQ_BROKER_ADMIN_PASSWORD:Admin1234Admin!}
diff --git
a/integration-test-groups/aws2/aws2-mq/src/test/java/org/apache/camel/quarkus/component/aws2/mq/it/Aws2MqIT.java
b/integration-test-groups/aws2/aws2-mq/src/test/java/org/apache/camel/quarkus/component/aws2/mq/it/Aws2MqIT.java
new file mode 100644
index 0000000000..fd6121917b
--- /dev/null
+++
b/integration-test-groups/aws2/aws2-mq/src/test/java/org/apache/camel/quarkus/component/aws2/mq/it/Aws2MqIT.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.aws2.mq.it;
+
+import io.quarkus.test.junit.QuarkusIntegrationTest;
+
+@QuarkusIntegrationTest
+class Aws2MqIT extends Aws2MqTest {
+
+}
diff --git
a/integration-test-groups/aws2/aws2-mq/src/test/java/org/apache/camel/quarkus/component/aws2/mq/it/Aws2MqTest.java
b/integration-test-groups/aws2/aws2-mq/src/test/java/org/apache/camel/quarkus/component/aws2/mq/it/Aws2MqTest.java
new file mode 100644
index 0000000000..8ce8e3b808
--- /dev/null
+++
b/integration-test-groups/aws2/aws2-mq/src/test/java/org/apache/camel/quarkus/component/aws2/mq/it/Aws2MqTest.java
@@ -0,0 +1,178 @@
+/*
+ * 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.aws2.mq.it;
+
+import java.util.concurrent.TimeUnit;
+
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import org.awaitility.Awaitility;
+import org.junit.jupiter.api.MethodOrderer;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestMethodOrder;
+
+import static org.hamcrest.Matchers.hasItem;
+
+@QuarkusTest
+@QuarkusTestResource(Aws2MqTestResource.class)
+@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
+class Aws2MqTest {
+
+ static final String BROKER_NAME = "cq-test-broker";
+ static final String BROKER_POJO_NAME = "cq-pojo-test-broker";
+
+ static String brokerId;
+ static String brokerPojoId;
+
+ @Test
+ @Order(1)
+ public void testCreateBrokers() {
+ brokerId = RestAssured.given()
+ .post("/aws2-mq/broker/" + BROKER_NAME)
+ .then()
+ .statusCode(201)
+ .extract().body().asString();
+
+ brokerPojoId = RestAssured.given()
+ .post("/aws2-mq/broker/" + BROKER_POJO_NAME + "/pojo")
+ .then()
+ .statusCode(201)
+ .extract().body().asString();
+
+ // Wait for both brokers to become RUNNING before running further tests
+ Awaitility.await()
+ .atMost(30, TimeUnit.MINUTES)
+ .pollDelay(0, TimeUnit.SECONDS)
+ .pollInterval(1, TimeUnit.MINUTES)
+ .until(() -> "RUNNING".equals(brokerState(brokerId))
+ && "RUNNING".equals(brokerState(brokerPojoId)));
+ }
+
+ @Test
+ @Order(2)
+ public void testListBrokers() {
+ // List all brokers
+ RestAssured.given()
+ .get("/aws2-mq/brokers")
+ .then()
+ .statusCode(200)
+ .body("$", hasItem(BROKER_NAME));
+
+ // List all brokers via pojo
+ RestAssured.given()
+ .get("/aws2-mq/brokers")
+ .then()
+ .statusCode(200)
+ .body("$", hasItem(BROKER_POJO_NAME));
+ }
+
+ @Test
+ @Order(4)
+ public void testUpdateBrokers() {
+ // Fetch current configuration ID
+ String configId = RestAssured.given()
+ .queryParam("brokerId", brokerId)
+ .get("/aws2-mq/broker/configurationId")
+ .then()
+ .statusCode(200)
+ .extract().body().asString();
+
+ // Update via headers with explicit configuration ID
+ RestAssured.given()
+ .queryParam("brokerId", brokerId)
+ .queryParam("configurationId", configId)
+ .put("/aws2-mq/broker")
+ .then()
+ .statusCode(200);
+
+ // Update via pojo
+ RestAssured.given()
+ .queryParam("brokerId", brokerPojoId)
+ .put("/aws2-mq/broker/pojo")
+ .then()
+ .statusCode(200);
+ }
+
+ @Test
+ @Order(5)
+ public void testRebootBrokers() {
+ // Reboot via headers
+ RestAssured.given()
+ .post("/aws2-mq/broker/" + brokerId + "/reboot")
+ .then()
+ .statusCode(204);
+
+ // Reboot via pojo
+ RestAssured.given()
+ .post("/aws2-mq/broker/" + brokerPojoId + "/reboot/pojo")
+ .then()
+ .statusCode(204);
+
+ // Wait for both brokers to become RUNNING again after reboot
+ Awaitility.await()
+ .atMost(15, TimeUnit.MINUTES)
+ .pollDelay(0, TimeUnit.SECONDS)
+ .pollInterval(1, TimeUnit.MINUTES)
+ .until(() -> "RUNNING".equals(brokerState(brokerId))
+ && "RUNNING".equals(brokerState(brokerPojoId)));
+ }
+
+ @Test
+ @Order(6)
+ public void testDeleteBrokers() {
+ RestAssured.given()
+ .queryParam("brokerId", brokerId)
+ .delete("/aws2-mq/broker")
+ .then()
+ .statusCode(204);
+
+ RestAssured.given()
+ .queryParam("brokerId", brokerPojoId)
+ .delete("/aws2-mq/broker/pojo")
+ .then()
+ .statusCode(204);
+ }
+
+ @Test
+ @Order(7)
+ public void cleanUpVerification() {
+ // Wait until both brokers are no longer listed as deletion is
asynchronous in AWS
+ Awaitility.await()
+ .atMost(30, TimeUnit.MINUTES)
+ .pollDelay(0, TimeUnit.SECONDS)
+ .pollInterval(1, TimeUnit.MINUTES)
+ .until(() -> {
+ java.util.List<?> brokers = RestAssured.given()
+ .get("/aws2-mq/brokers")
+ .then()
+ .statusCode(200)
+ .extract().jsonPath().getList("$");
+ return !brokers.contains(BROKER_NAME) &&
!brokers.contains(BROKER_POJO_NAME);
+ });
+ }
+
+ private static String brokerState(String id) {
+ return RestAssured.given()
+ .queryParam("brokerId", id)
+ .get("/aws2-mq/broker/describe")
+ .then()
+ .statusCode(200)
+ .extract().body().asString();
+ }
+}
diff --git
a/integration-test-groups/aws2/aws2-mq/src/test/java/org/apache/camel/quarkus/component/aws2/mq/it/Aws2MqTestResource.java
b/integration-test-groups/aws2/aws2-mq/src/test/java/org/apache/camel/quarkus/component/aws2/mq/it/Aws2MqTestResource.java
new file mode 100644
index 0000000000..d5ab50bae9
--- /dev/null
+++
b/integration-test-groups/aws2/aws2-mq/src/test/java/org/apache/camel/quarkus/component/aws2/mq/it/Aws2MqTestResource.java
@@ -0,0 +1,59 @@
+/*
+ * 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.aws2.mq.it;
+
+import java.util.Map;
+
+import org.apache.camel.quarkus.test.mock.backend.MockBackendUtils;
+import
org.apache.camel.quarkus.test.wiremock.WireMockTestResourceLifecycleManager;
+
+public class Aws2MqTestResource extends WireMockTestResourceLifecycleManager {
+
+ private static final String MQ_ACCESS_KEY = "AWS_ACCESS_KEY";
+ private static final String MQ_SECRET_KEY = "AWS_SECRET_KEY";
+ private static final String MQ_REGION = "AWS_REGION";
+
+ @Override
+ public Map<String, String> start() {
+ Map<String, String> properties = super.start();
+
+ if (isMockingEnabled()) {
+ String wiremockUrl = properties.get("wiremock.url");
+ properties.put("camel.component.aws2-mq.uri-endpoint-override",
wiremockUrl);
+ properties.put("camel.component.aws2-mq.override-endpoint",
"true");
+ properties.put("camel.component.aws2-mq.access-key", "test");
+ properties.put("camel.component.aws2-mq.secret-key", "test");
+ properties.put("camel.component.aws2-mq.region", "us-east-1");
+ } else {
+ properties.put("camel.component.aws2-mq.access-key",
envOrDefault(MQ_ACCESS_KEY, ""));
+ properties.put("camel.component.aws2-mq.secret-key",
envOrDefault(MQ_SECRET_KEY, ""));
+ properties.put("camel.component.aws2-mq.region",
envOrDefault(MQ_REGION, "us-east-1"));
+ }
+
+ return properties;
+ }
+
+ @Override
+ protected String getRecordTargetBaseUrl() {
+ return "https://mq." + envOrDefault(MQ_REGION, "us-east-1") +
".amazonaws.com";
+ }
+
+ @Override
+ protected boolean isMockingEnabled() {
+ return MockBackendUtils.startMockBackend();
+ }
+}
diff --git
a/integration-test-groups/aws2/aws2-mq/src/test/java/org/apache/camel/quarkus/component/aws2/mq/it/GroupedAws2MqTestResource.java
b/integration-test-groups/aws2/aws2-mq/src/test/java/org/apache/camel/quarkus/component/aws2/mq/it/GroupedAws2MqTestResource.java
new file mode 100644
index 0000000000..925876db30
--- /dev/null
+++
b/integration-test-groups/aws2/aws2-mq/src/test/java/org/apache/camel/quarkus/component/aws2/mq/it/GroupedAws2MqTestResource.java
@@ -0,0 +1,26 @@
+/*
+ * 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.aws2.mq.it;
+
+/**
+ * This class is required by the aws2-grouped module. The group-tests.groovy
script copies test sources
+ * from this module into the grouped module and renames all occurrences of
Aws2MqTest to
+ * GroupedAws2MqTest, which also renames Aws2MqTestResource to
GroupedAws2MqTestResource
+ * in the @QuarkusTestResource annotation. This class must therefore exist so
that the grouped module compiles.
+ */
+public class GroupedAws2MqTestResource extends Aws2MqTestResource {
+}
diff --git
a/integration-test-groups/aws2/aws2-mq/src/test/resources/mappings/createBroker.json
b/integration-test-groups/aws2/aws2-mq/src/test/resources/mappings/createBroker.json
new file mode 100644
index 0000000000..b8ba8531f3
--- /dev/null
+++
b/integration-test-groups/aws2/aws2-mq/src/test/resources/mappings/createBroker.json
@@ -0,0 +1,18 @@
+{
+ "request": {
+ "method": "POST",
+ "urlPath": "/v1/brokers",
+ "bodyPatterns": [
+ {
+ "contains": "cq-test-broker"
+ }
+ ]
+ },
+ "response": {
+ "status": 200,
+ "headers": {
+ "Content-Type": "application/json"
+ },
+ "body":
"{\"brokerId\":\"b-abc12345-1111-2222-3333-444444444444\",\"brokerArn\":\"arn:aws:mq:us-east-1:123456789:broker:cq-test-broker:b-abc12345-1111-2222-3333-444444444444\"}"
+ }
+}
diff --git
a/integration-test-groups/aws2/aws2-mq/src/test/resources/mappings/createBrokerPojo.json
b/integration-test-groups/aws2/aws2-mq/src/test/resources/mappings/createBrokerPojo.json
new file mode 100644
index 0000000000..7d9fb57d7d
--- /dev/null
+++
b/integration-test-groups/aws2/aws2-mq/src/test/resources/mappings/createBrokerPojo.json
@@ -0,0 +1,18 @@
+{
+ "request": {
+ "method": "POST",
+ "urlPath": "/v1/brokers",
+ "bodyPatterns": [
+ {
+ "contains": "cq-pojo-test-broker"
+ }
+ ]
+ },
+ "response": {
+ "status": 200,
+ "headers": {
+ "Content-Type": "application/json"
+ },
+ "body":
"{\"brokerId\":\"b-def67890-5555-6666-7777-888888888888\",\"brokerArn\":\"arn:aws:mq:us-east-1:123456789:broker:cq-pojo-test-broker:b-def67890-5555-6666-7777-888888888888\"}"
+ }
+}
diff --git
a/integration-test-groups/aws2/aws2-mq/src/test/resources/mappings/deleteBroker.json
b/integration-test-groups/aws2/aws2-mq/src/test/resources/mappings/deleteBroker.json
new file mode 100644
index 0000000000..0b9aa81630
--- /dev/null
+++
b/integration-test-groups/aws2/aws2-mq/src/test/resources/mappings/deleteBroker.json
@@ -0,0 +1,16 @@
+{
+ "scenarioName": "brokerDeletion",
+ "requiredScenarioState": "Started",
+ "newScenarioState": "FirstDeleted",
+ "request": {
+ "method": "DELETE",
+ "urlPathPattern": "/v1/brokers/.+"
+ },
+ "response": {
+ "status": 200,
+ "headers": {
+ "Content-Type": "application/json"
+ },
+ "body": "{\"brokerId\":\"b-abc12345-1111-2222-3333-444444444444\"}"
+ }
+}
diff --git
a/integration-test-groups/aws2/aws2-mq/src/test/resources/mappings/deleteBrokerPojo.json
b/integration-test-groups/aws2/aws2-mq/src/test/resources/mappings/deleteBrokerPojo.json
new file mode 100644
index 0000000000..c01d5d9a7a
--- /dev/null
+++
b/integration-test-groups/aws2/aws2-mq/src/test/resources/mappings/deleteBrokerPojo.json
@@ -0,0 +1,16 @@
+{
+ "scenarioName": "brokerDeletion",
+ "requiredScenarioState": "FirstDeleted",
+ "newScenarioState": "BothDeleted",
+ "request": {
+ "method": "DELETE",
+ "urlPathPattern": "/v1/brokers/.+"
+ },
+ "response": {
+ "status": 200,
+ "headers": {
+ "Content-Type": "application/json"
+ },
+ "body": "{\"brokerId\":\"b-def67890-5555-6666-7777-888888888888\"}"
+ }
+}
diff --git
a/integration-test-groups/aws2/aws2-mq/src/test/resources/mappings/describeBroker.json
b/integration-test-groups/aws2/aws2-mq/src/test/resources/mappings/describeBroker.json
new file mode 100644
index 0000000000..e1f983931b
--- /dev/null
+++
b/integration-test-groups/aws2/aws2-mq/src/test/resources/mappings/describeBroker.json
@@ -0,0 +1,13 @@
+{
+ "request": {
+ "method": "GET",
+ "urlPathPattern": "/v1/brokers/.+"
+ },
+ "response": {
+ "status": 200,
+ "headers": {
+ "Content-Type": "application/json"
+ },
+ "body":
"{\"brokerId\":\"b-abc12345-1111-2222-3333-444444444444\",\"brokerName\":\"cq-test-broker\",\"brokerState\":\"RUNNING\",\"engineType\":\"ACTIVEMQ\",\"deploymentMode\":\"SINGLE_INSTANCE\",\"hostInstanceType\":\"mq.t3.micro\",\"publiclyAccessible\":false,\"configurations\":{\"current\":{\"id\":\"c-fake-config-1111-2222-3333\",\"revision\":1}}}"
+ }
+}
diff --git
a/integration-test-groups/aws2/aws2-mq/src/test/resources/mappings/listBrokers-empty.json
b/integration-test-groups/aws2/aws2-mq/src/test/resources/mappings/listBrokers-empty.json
new file mode 100644
index 0000000000..2adde50c70
--- /dev/null
+++
b/integration-test-groups/aws2/aws2-mq/src/test/resources/mappings/listBrokers-empty.json
@@ -0,0 +1,15 @@
+{
+ "scenarioName": "brokerDeletion",
+ "requiredScenarioState": "BothDeleted",
+ "request": {
+ "method": "GET",
+ "urlPath": "/v1/brokers"
+ },
+ "response": {
+ "status": 200,
+ "headers": {
+ "Content-Type": "application/json"
+ },
+ "body": "{\"brokerSummaries\":[]}"
+ }
+}
diff --git
a/integration-test-groups/aws2/aws2-mq/src/test/resources/mappings/listBrokers.json
b/integration-test-groups/aws2/aws2-mq/src/test/resources/mappings/listBrokers.json
new file mode 100644
index 0000000000..638aef50ba
--- /dev/null
+++
b/integration-test-groups/aws2/aws2-mq/src/test/resources/mappings/listBrokers.json
@@ -0,0 +1,15 @@
+{
+ "scenarioName": "brokerDeletion",
+ "requiredScenarioState": "Started",
+ "request": {
+ "method": "GET",
+ "urlPath": "/v1/brokers"
+ },
+ "response": {
+ "status": 200,
+ "headers": {
+ "Content-Type": "application/json"
+ },
+ "body":
"{\"brokerSummaries\":[{\"brokerId\":\"b-abc12345-1111-2222-3333-444444444444\",\"brokerName\":\"cq-test-broker\",\"brokerState\":\"RUNNING\",\"engineType\":\"ACTIVEMQ\",\"deploymentMode\":\"SINGLE_INSTANCE\",\"hostInstanceType\":\"mq.t3.micro\"},{\"brokerId\":\"b-def67890-5555-6666-7777-888888888888\",\"brokerName\":\"cq-pojo-test-broker\",\"brokerState\":\"RUNNING\",\"engineType\":\"ACTIVEMQ\",\"deploymentMode\":\"SINGLE_INSTANCE\",\"hostInstanceType\":\"mq.t3.micro\"}]}"
+ }
+}
diff --git
a/integration-test-groups/aws2/aws2-mq/src/test/resources/mappings/rebootBroker.json
b/integration-test-groups/aws2/aws2-mq/src/test/resources/mappings/rebootBroker.json
new file mode 100644
index 0000000000..8f856bdc09
--- /dev/null
+++
b/integration-test-groups/aws2/aws2-mq/src/test/resources/mappings/rebootBroker.json
@@ -0,0 +1,13 @@
+{
+ "request": {
+ "method": "POST",
+ "urlPathPattern": "/v1/brokers/.+/reboot"
+ },
+ "response": {
+ "status": 200,
+ "headers": {
+ "Content-Type": "application/json"
+ },
+ "body": "{}"
+ }
+}
diff --git
a/integration-test-groups/aws2/aws2-mq/src/test/resources/mappings/updateBroker.json
b/integration-test-groups/aws2/aws2-mq/src/test/resources/mappings/updateBroker.json
new file mode 100644
index 0000000000..444cb2fc0d
--- /dev/null
+++
b/integration-test-groups/aws2/aws2-mq/src/test/resources/mappings/updateBroker.json
@@ -0,0 +1,13 @@
+{
+ "request": {
+ "method": "PUT",
+ "urlPathPattern": "/v1/brokers/.+"
+ },
+ "response": {
+ "status": 200,
+ "headers": {
+ "Content-Type": "application/json"
+ },
+ "body":
"{\"brokerId\":\"b-abc12345-1111-2222-3333-444444444444\",\"configuration\":{\"id\":\"c-fake-config-1111-2222-3333\",\"revision\":2}}"
+ }
+}
diff --git a/integration-test-groups/aws2/pom.xml
b/integration-test-groups/aws2/pom.xml
index f62141fc71..c704694b34 100644
--- a/integration-test-groups/aws2/pom.xml
+++ b/integration-test-groups/aws2/pom.xml
@@ -42,6 +42,7 @@
<module>aws2-ddb</module>
<module>aws2-kinesis</module>
<module>aws2-lambda</module>
+ <module>aws2-mq</module>
<module>aws2-s3</module>
<module>aws2-ses</module>
<module>aws2-sqs</module>
diff --git a/integration-tests/aws2-grouped/pom.xml
b/integration-tests/aws2-grouped/pom.xml
index 19f3892968..3962b4416e 100644
--- a/integration-tests/aws2-grouped/pom.xml
+++ b/integration-tests/aws2-grouped/pom.xml
@@ -80,6 +80,10 @@
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-aws2-lambda</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-aws2-mq</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-aws2-s3</artifactId>
@@ -104,6 +108,16 @@
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-integration-tests-support-aws2</artifactId>
</dependency>
+ <dependency>
+ <groupId>software.amazon.awssdk</groupId>
+ <artifactId>mq</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit</artifactId>
@@ -114,6 +128,11 @@
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-integration-wiremock-support</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
@@ -287,6 +306,19 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-aws2-mq-deployment</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-aws2-s3-deployment</artifactId>