This is an automated email from the ASF dual-hosted git repository.
jamesnetherton 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 b9d09dcc77 Fixes #2397. Add AWS 2 ECS integration tests
b9d09dcc77 is described below
commit b9d09dcc77c6272babded50e8ca267309f359242
Author: JinyuChen97 <[email protected]>
AuthorDate: Wed May 20 07:17:47 2026 +0100
Fixes #2397. Add AWS 2 ECS integration tests
Implemented integration tests for AWS 2 ECS extension following existing
patterns:
- Tests 4 ECS operations: createCluster, listClusters, describeCluster,
deleteCluster
- Uses WireMock for mock testing (ECS not supported in LocalStack free tier)
- All tests pass in both JVM and Native modes
- Verified against real AWS ECS service (us-west-1)
- Update group-test-utils script refer to correct test resource without
manually create GroupedxxxTestResource and delete all GroupedxxxTestResource
files
- Rename MSK mapping JSON to avoid overlap by ECS mapping JSON
Test results:
- JVM mode: 5 tests passed
- Native mode: 5 tests passed
- WireMock mock mode: 5 tests passed
- Real AWS verification: all operations successful
On behalf of Jinyu Chen.
Co-authored-by: Claude Sonnet 4.5 <[email protected]>
---
integration-test-groups/aws2/aws2-ecs/README.adoc | 28 ++++
integration-test-groups/aws2/aws2-ecs/pom.xml | 141 +++++++++++++++++++++
.../component/aws2/ecs/it/Aws2EcsResource.java | 118 +++++++++++++++++
.../src/main/resources/application.properties | 21 +++
.../quarkus/component/aws2/ecs/it/Aws2EcsIT.java} | 13 +-
.../quarkus/component/aws2/ecs/it/Aws2EcsTest.java | 80 ++++++++++++
.../component/aws2/ecs/it/Aws2EcsTestResource.java | 59 +++++++++
.../test/resources/mappings/ecs-createCluster.json | 23 ++++
.../test/resources/mappings/ecs-deleteCluster.json | 23 ++++
.../resources/mappings/ecs-describeCluster.json | 23 ++++
.../test/resources/mappings/ecs-listClusters.json | 18 +++
.../aws2/msk/it/GroupedAws2MskTestResource.java | 26 ----
.../{createCluster.json => msk-createCluster.json} | 0
...ClusterPojo.json => msk-createClusterPojo.json} | 0
.../{deleteCluster.json => msk-deleteCluster.json} | 0
...ClusterPojo.json => msk-deleteClusterPojo.json} | 0
...scribeCluster.json => msk-describeCluster.json} | 0
...ters-empty.json => msk-listClusters-empty.json} | 0
.../{listClusters.json => msk-listClusters.json} | 0
...Filter.json => msk-listClustersWithFilter.json} | 0
integration-test-groups/aws2/pom.xml | 1 +
integration-tests/aws2-grouped/pom.xml | 27 ++++
tooling/scripts/group-test-utils.groovy | 16 ++-
23 files changed, 582 insertions(+), 35 deletions(-)
diff --git a/integration-test-groups/aws2/aws2-ecs/README.adoc
b/integration-test-groups/aws2/aws2-ecs/README.adoc
new file mode 100644
index 0000000000..232397eac7
--- /dev/null
+++ b/integration-test-groups/aws2/aws2-ecs/README.adoc
@@ -0,0 +1,28 @@
+= AWS ECS tests
+
+By default the tests run in WireMock playback mode using pre-recorded mappings
from `src/test/resources/mappings/`.
+
+NOTE: Amazon ECS 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 ECS
API in the default (non-real AWS) test mode.
+
+NOTE: WireMock recording mode is not supported for AWS services. When WireMock
acts as an HTTPS reverse proxy (required for endpoint override), it modifies
request headers which breaks AWS SigV4 signature validation.
+
+== 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:
+
+* `ecs:ListClusters`
+* `ecs:DescribeClusters`
+* `ecs:CreateCluster`
+* `ecs:DeleteCluster`
+
+=== 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
+----
diff --git a/integration-test-groups/aws2/aws2-ecs/pom.xml
b/integration-test-groups/aws2/aws2-ecs/pom.xml
new file mode 100644
index 0000000000..cfa7a30477
--- /dev/null
+++ b/integration-test-groups/aws2/aws2-ecs/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.36.0-SNAPSHOT</version>
+ <relativePath>../../../poms/build-parent-it/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-integration-test-aws2-ecs</artifactId>
+ <name>Camel Quarkus :: Integration Tests :: AWS 2 ECS</name>
+ <description>Integration tests for Camel Quarkus AWS 2 ECS
extension</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-aws2-ecs</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy-jackson</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>software.amazon.awssdk</groupId>
+ <artifactId>ecs</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-ecs-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-ecs/src/main/java/org/apache/camel/quarkus/component/aws2/ecs/it/Aws2EcsResource.java
b/integration-test-groups/aws2/aws2-ecs/src/main/java/org/apache/camel/quarkus/component/aws2/ecs/it/Aws2EcsResource.java
new file mode 100644
index 0000000000..8252d30278
--- /dev/null
+++
b/integration-test-groups/aws2/aws2-ecs/src/main/java/org/apache/camel/quarkus/component/aws2/ecs/it/Aws2EcsResource.java
@@ -0,0 +1,118 @@
+/*
+ * 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.ecs.it;
+
+import java.util.Map;
+
+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.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.ecs.ECS2Constants;
+import org.apache.camel.component.aws2.ecs.ECS2Operations;
+import software.amazon.awssdk.services.ecs.model.Cluster;
+import software.amazon.awssdk.services.ecs.model.CreateClusterResponse;
+import software.amazon.awssdk.services.ecs.model.DeleteClusterResponse;
+import software.amazon.awssdk.services.ecs.model.DescribeClustersResponse;
+import software.amazon.awssdk.services.ecs.model.ListClustersResponse;
+
+@Path("/aws2-ecs")
+@ApplicationScoped
+public class Aws2EcsResource {
+
+ @Inject
+ ProducerTemplate producerTemplate;
+
+ @Path("/clusters")
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response listClusters(@QueryParam("maxResults") Integer maxResults)
{
+ Map<String, Object> headers = maxResults != null
+ ? Map.of(ECS2Constants.MAX_RESULTS, maxResults)
+ : Map.of();
+
+ ListClustersResponse response = producerTemplate.requestBodyAndHeaders(
+ componentUri(ECS2Operations.listClusters),
+ null,
+ headers,
+ ListClustersResponse.class);
+
+ return Response.ok(response.clusterArns()).build();
+ }
+
+ @Path("/clusters/{clusterName}")
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ public Response describeCluster(@PathParam("clusterName") String
clusterName) {
+ DescribeClustersResponse response =
producerTemplate.requestBodyAndHeader(
+ componentUri(ECS2Operations.describeCluster),
+ null,
+ ECS2Constants.CLUSTER_NAME,
+ clusterName,
+ DescribeClustersResponse.class);
+
+ if (response.clusters().isEmpty()) {
+ return Response.status(Response.Status.NOT_FOUND).build();
+ }
+
+ Cluster cluster = response.clusters().get(0);
+ Map<String, String> result = Map.of(
+ "clusterName", cluster.clusterName(),
+ "clusterArn", cluster.clusterArn());
+ return Response.ok(result).build();
+ }
+
+ @Path("/clusters")
+ @POST
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response createCluster(@QueryParam("clusterName") String
clusterName) {
+ CreateClusterResponse response = producerTemplate.requestBodyAndHeader(
+ componentUri(ECS2Operations.createCluster),
+ null,
+ ECS2Constants.CLUSTER_NAME,
+ clusterName,
+ CreateClusterResponse.class);
+
+ return Response.ok(response.cluster().clusterArn()).build();
+ }
+
+ @Path("/clusters/{clusterName}")
+ @DELETE
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response deleteCluster(@PathParam("clusterName") String
clusterName) {
+ DeleteClusterResponse response = producerTemplate.requestBodyAndHeader(
+ componentUri(ECS2Operations.deleteCluster),
+ null,
+ ECS2Constants.CLUSTER_NAME,
+ clusterName,
+ DeleteClusterResponse.class);
+
+ return Response.ok(response.cluster().clusterArn()).build();
+ }
+
+ private String componentUri(ECS2Operations operation) {
+ return "aws2-ecs://test?operation=" + operation;
+ }
+}
diff --git
a/integration-test-groups/aws2/aws2-ecs/src/main/resources/application.properties
b/integration-test-groups/aws2/aws2-ecs/src/main/resources/application.properties
new file mode 100644
index 0000000000..676d5b2105
--- /dev/null
+++
b/integration-test-groups/aws2/aws2-ecs/src/main/resources/application.properties
@@ -0,0 +1,21 @@
+## ---------------------------------------------------------------------------
+## 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-ecs.access-key=${AWS_ACCESS_KEY}
+camel.component.aws2-ecs.secret-key=${AWS_SECRET_KEY}
+camel.component.aws2-ecs.region=${AWS_REGION:us-east-1}
+camel.component.aws2-ecs.override-endpoint=false
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-ecs/src/test/java/org/apache/camel/quarkus/component/aws2/ecs/it/Aws2EcsIT.java
similarity index 60%
rename from
integration-test-groups/aws2/aws2-mq/src/test/java/org/apache/camel/quarkus/component/aws2/mq/it/GroupedAws2MqTestResource.java
rename to
integration-test-groups/aws2/aws2-ecs/src/test/java/org/apache/camel/quarkus/component/aws2/ecs/it/Aws2EcsIT.java
index 925876db30..c0a7949533 100644
---
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-ecs/src/test/java/org/apache/camel/quarkus/component/aws2/ecs/it/Aws2EcsIT.java
@@ -14,13 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.quarkus.component.aws2.mq.it;
+package org.apache.camel.quarkus.component.aws2.ecs.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 {
+import io.quarkus.test.junit.QuarkusIntegrationTest;
+
+@QuarkusIntegrationTest
+class Aws2EcsIT extends Aws2EcsTest {
}
diff --git
a/integration-test-groups/aws2/aws2-ecs/src/test/java/org/apache/camel/quarkus/component/aws2/ecs/it/Aws2EcsTest.java
b/integration-test-groups/aws2/aws2-ecs/src/test/java/org/apache/camel/quarkus/component/aws2/ecs/it/Aws2EcsTest.java
new file mode 100644
index 0000000000..b6cc69ba0f
--- /dev/null
+++
b/integration-test-groups/aws2/aws2-ecs/src/test/java/org/apache/camel/quarkus/component/aws2/ecs/it/Aws2EcsTest.java
@@ -0,0 +1,80 @@
+/*
+ * 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.ecs.it;
+
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.Matchers.hasItem;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+
+@QuarkusTest
+@QuarkusTestResource(Aws2EcsTestResource.class)
+class Aws2EcsTest {
+
+ static final String CLUSTER_NAME = "cq-test-cluster";
+
+ @Test
+ public void testEcsOperations() {
+ String clusterArn = null;
+ try {
+ // Create cluster
+ clusterArn = RestAssured.given()
+ .queryParam("clusterName", CLUSTER_NAME)
+ .post("/aws2-ecs/clusters")
+ .then()
+ .statusCode(200)
+ .body(notNullValue())
+ .extract().body().asString();
+
+ // List clusters
+ RestAssured.given()
+ .get("/aws2-ecs/clusters")
+ .then()
+ .statusCode(200)
+ .body("$", hasItem(clusterArn));
+
+ // List clusters with max results
+ RestAssured.given()
+ .queryParam("maxResults", 10)
+ .get("/aws2-ecs/clusters")
+ .then()
+ .statusCode(200)
+ .body("$", hasItem(clusterArn));
+
+ // Describe cluster
+ RestAssured.given()
+ .get("/aws2-ecs/clusters/" + CLUSTER_NAME)
+ .then()
+ .statusCode(200)
+ .body("clusterName", is(CLUSTER_NAME))
+ .body("clusterArn", is(clusterArn));
+ } finally {
+ // Clean up: delete cluster
+ if (clusterArn != null) {
+ RestAssured.given()
+ .delete("/aws2-ecs/clusters/" + CLUSTER_NAME)
+ .then()
+ .statusCode(200)
+ .body(is(clusterArn));
+ }
+ }
+ }
+}
diff --git
a/integration-test-groups/aws2/aws2-ecs/src/test/java/org/apache/camel/quarkus/component/aws2/ecs/it/Aws2EcsTestResource.java
b/integration-test-groups/aws2/aws2-ecs/src/test/java/org/apache/camel/quarkus/component/aws2/ecs/it/Aws2EcsTestResource.java
new file mode 100644
index 0000000000..de24227036
--- /dev/null
+++
b/integration-test-groups/aws2/aws2-ecs/src/test/java/org/apache/camel/quarkus/component/aws2/ecs/it/Aws2EcsTestResource.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.ecs.it;
+
+import java.util.Map;
+
+import org.apache.camel.quarkus.test.mock.backend.MockBackendUtils;
+import
org.apache.camel.quarkus.test.wiremock.WireMockTestResourceLifecycleManager;
+
+public class Aws2EcsTestResource extends WireMockTestResourceLifecycleManager {
+
+ private static final String ECS_ACCESS_KEY = "AWS_ACCESS_KEY";
+ private static final String ECS_SECRET_KEY = "AWS_SECRET_KEY";
+ private static final String ECS_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-ecs.uri-endpoint-override",
wiremockUrl);
+ properties.put("camel.component.aws2-ecs.override-endpoint",
"true");
+ properties.put("camel.component.aws2-ecs.access-key", "test");
+ properties.put("camel.component.aws2-ecs.secret-key", "test");
+ properties.put("camel.component.aws2-ecs.region", "us-east-1");
+ } else {
+ properties.put("camel.component.aws2-ecs.access-key",
envOrDefault(ECS_ACCESS_KEY, ""));
+ properties.put("camel.component.aws2-ecs.secret-key",
envOrDefault(ECS_SECRET_KEY, ""));
+ properties.put("camel.component.aws2-ecs.region",
envOrDefault(ECS_REGION, "us-east-1"));
+ }
+
+ return properties;
+ }
+
+ @Override
+ protected String getRecordTargetBaseUrl() {
+ return "https://ecs." + envOrDefault(ECS_REGION, "us-east-1") +
".amazonaws.com";
+ }
+
+ @Override
+ protected boolean isMockingEnabled() {
+ return MockBackendUtils.startMockBackend();
+ }
+}
diff --git
a/integration-test-groups/aws2/aws2-ecs/src/test/resources/mappings/ecs-createCluster.json
b/integration-test-groups/aws2/aws2-ecs/src/test/resources/mappings/ecs-createCluster.json
new file mode 100644
index 0000000000..9d9eba528d
--- /dev/null
+++
b/integration-test-groups/aws2/aws2-ecs/src/test/resources/mappings/ecs-createCluster.json
@@ -0,0 +1,23 @@
+{
+ "request": {
+ "method": "POST",
+ "urlPath": "/",
+ "headers": {
+ "X-Amz-Target": {
+ "equalTo": "AmazonEC2ContainerServiceV20141113.CreateCluster"
+ }
+ },
+ "bodyPatterns": [
+ {
+ "contains": "cq-test-cluster"
+ }
+ ]
+ },
+ "response": {
+ "status": 200,
+ "headers": {
+ "Content-Type": "application/x-amz-json-1.1"
+ },
+ "body":
"{\"cluster\":{\"clusterArn\":\"arn:aws:ecs:us-east-1:123456789:cluster/cq-test-cluster\",\"clusterName\":\"cq-test-cluster\",\"status\":\"ACTIVE\",\"registeredContainerInstancesCount\":0,\"runningTasksCount\":0,\"pendingTasksCount\":0,\"activeServicesCount\":0}}"
+ }
+}
\ No newline at end of file
diff --git
a/integration-test-groups/aws2/aws2-ecs/src/test/resources/mappings/ecs-deleteCluster.json
b/integration-test-groups/aws2/aws2-ecs/src/test/resources/mappings/ecs-deleteCluster.json
new file mode 100644
index 0000000000..8fe2d39d74
--- /dev/null
+++
b/integration-test-groups/aws2/aws2-ecs/src/test/resources/mappings/ecs-deleteCluster.json
@@ -0,0 +1,23 @@
+{
+ "request": {
+ "method": "POST",
+ "urlPath": "/",
+ "headers": {
+ "X-Amz-Target": {
+ "equalTo": "AmazonEC2ContainerServiceV20141113.DeleteCluster"
+ }
+ },
+ "bodyPatterns": [
+ {
+ "contains": "cq-test-cluster"
+ }
+ ]
+ },
+ "response": {
+ "status": 200,
+ "headers": {
+ "Content-Type": "application/x-amz-json-1.1"
+ },
+ "body":
"{\"cluster\":{\"clusterArn\":\"arn:aws:ecs:us-east-1:123456789:cluster/cq-test-cluster\",\"clusterName\":\"cq-test-cluster\",\"status\":\"INACTIVE\",\"registeredContainerInstancesCount\":0,\"runningTasksCount\":0,\"pendingTasksCount\":0,\"activeServicesCount\":0}}"
+ }
+}
diff --git
a/integration-test-groups/aws2/aws2-ecs/src/test/resources/mappings/ecs-describeCluster.json
b/integration-test-groups/aws2/aws2-ecs/src/test/resources/mappings/ecs-describeCluster.json
new file mode 100644
index 0000000000..3c4ef7e2ba
--- /dev/null
+++
b/integration-test-groups/aws2/aws2-ecs/src/test/resources/mappings/ecs-describeCluster.json
@@ -0,0 +1,23 @@
+{
+ "request": {
+ "method": "POST",
+ "urlPath": "/",
+ "headers": {
+ "X-Amz-Target": {
+ "equalTo": "AmazonEC2ContainerServiceV20141113.DescribeClusters"
+ }
+ },
+ "bodyPatterns": [
+ {
+ "contains": "cq-test-cluster"
+ }
+ ]
+ },
+ "response": {
+ "status": 200,
+ "headers": {
+ "Content-Type": "application/x-amz-json-1.1"
+ },
+ "body":
"{\"clusters\":[{\"clusterArn\":\"arn:aws:ecs:us-east-1:123456789:cluster/cq-test-cluster\",\"clusterName\":\"cq-test-cluster\",\"status\":\"ACTIVE\",\"registeredContainerInstancesCount\":0,\"runningTasksCount\":0,\"pendingTasksCount\":0,\"activeServicesCount\":0}],\"failures\":[]}"
+ }
+}
diff --git
a/integration-test-groups/aws2/aws2-ecs/src/test/resources/mappings/ecs-listClusters.json
b/integration-test-groups/aws2/aws2-ecs/src/test/resources/mappings/ecs-listClusters.json
new file mode 100644
index 0000000000..ac8aae8244
--- /dev/null
+++
b/integration-test-groups/aws2/aws2-ecs/src/test/resources/mappings/ecs-listClusters.json
@@ -0,0 +1,18 @@
+{
+ "request": {
+ "method": "POST",
+ "urlPath": "/",
+ "headers": {
+ "X-Amz-Target": {
+ "equalTo": "AmazonEC2ContainerServiceV20141113.ListClusters"
+ }
+ }
+ },
+ "response": {
+ "status": 200,
+ "headers": {
+ "Content-Type": "application/x-amz-json-1.1"
+ },
+ "body":
"{\"clusterArns\":[\"arn:aws:ecs:us-east-1:123456789:cluster/cq-test-cluster\"]}"
+ }
+}
diff --git
a/integration-test-groups/aws2/aws2-msk/src/test/java/org/apache/camel/quarkus/component/aws2/msk/it/GroupedAws2MskTestResource.java
b/integration-test-groups/aws2/aws2-msk/src/test/java/org/apache/camel/quarkus/component/aws2/msk/it/GroupedAws2MskTestResource.java
deleted file mode 100644
index 72adfbbe3a..0000000000
---
a/integration-test-groups/aws2/aws2-msk/src/test/java/org/apache/camel/quarkus/component/aws2/msk/it/GroupedAws2MskTestResource.java
+++ /dev/null
@@ -1,26 +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.aws2.msk.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
Aws2MskTest to
- * GroupedAws2MskTest, which also renames Aws2MskTestResource to
GroupedAws2MskTestResource
- * in the @QuarkusTestResource annotation. This class must therefore exist so
that the grouped module compiles.
- */
-public class GroupedAws2MskTestResource extends Aws2MskTestResource {
-}
diff --git
a/integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/createCluster.json
b/integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/msk-createCluster.json
similarity index 100%
rename from
integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/createCluster.json
rename to
integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/msk-createCluster.json
diff --git
a/integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/createClusterPojo.json
b/integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/msk-createClusterPojo.json
similarity index 100%
rename from
integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/createClusterPojo.json
rename to
integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/msk-createClusterPojo.json
diff --git
a/integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/deleteCluster.json
b/integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/msk-deleteCluster.json
similarity index 100%
rename from
integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/deleteCluster.json
rename to
integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/msk-deleteCluster.json
diff --git
a/integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/deleteClusterPojo.json
b/integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/msk-deleteClusterPojo.json
similarity index 100%
rename from
integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/deleteClusterPojo.json
rename to
integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/msk-deleteClusterPojo.json
diff --git
a/integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/describeCluster.json
b/integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/msk-describeCluster.json
similarity index 100%
rename from
integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/describeCluster.json
rename to
integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/msk-describeCluster.json
diff --git
a/integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/listClusters-empty.json
b/integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/msk-listClusters-empty.json
similarity index 100%
rename from
integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/listClusters-empty.json
rename to
integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/msk-listClusters-empty.json
diff --git
a/integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/listClusters.json
b/integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/msk-listClusters.json
similarity index 100%
rename from
integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/listClusters.json
rename to
integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/msk-listClusters.json
diff --git
a/integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/listClustersWithFilter.json
b/integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/msk-listClustersWithFilter.json
similarity index 100%
rename from
integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/listClustersWithFilter.json
rename to
integration-test-groups/aws2/aws2-msk/src/test/resources/mappings/msk-listClustersWithFilter.json
diff --git a/integration-test-groups/aws2/pom.xml
b/integration-test-groups/aws2/pom.xml
index 18d7a7cfc1..9750393c78 100644
--- a/integration-test-groups/aws2/pom.xml
+++ b/integration-test-groups/aws2/pom.xml
@@ -40,6 +40,7 @@
<module>aws-secrets-manager</module>
<module>aws2-cw</module>
<module>aws2-ddb</module>
+ <module>aws2-ecs</module>
<module>aws2-kinesis</module>
<module>aws2-kms</module>
<module>aws2-lambda</module>
diff --git a/integration-tests/aws2-grouped/pom.xml
b/integration-tests/aws2-grouped/pom.xml
index 65c110cd5e..b0d1389188 100644
--- a/integration-tests/aws2-grouped/pom.xml
+++ b/integration-tests/aws2-grouped/pom.xml
@@ -68,6 +68,10 @@
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-aws2-ddb</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-aws2-ecs</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-aws2-kinesis</artifactId>
@@ -112,6 +116,16 @@
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-integration-tests-support-aws2</artifactId>
</dependency>
+ <dependency>
+ <groupId>software.amazon.awssdk</groupId>
+ <artifactId>ecs</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>kafka</artifactId>
@@ -281,6 +295,19 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-aws2-ecs-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-kinesis-deployment</artifactId>
diff --git a/tooling/scripts/group-test-utils.groovy
b/tooling/scripts/group-test-utils.groovy
index 420bd2ed84..2c4663d13c 100644
--- a/tooling/scripts/group-test-utils.groovy
+++ b/tooling/scripts/group-test-utils.groovy
@@ -24,7 +24,16 @@ def makeTestClassNamesUnique(File sourceDir, String
classNamePrefix) {
String newClassName = "${classNamePrefix}${className}"
String content = file.text
- content = content.replaceAll(className,
"${classNamePrefix}${className}")
+
+ // Save @QuarkusTestResource annotations
+ def annotations = []
+ content = content.replaceAll(/@QuarkusTestResource\([^)]+\)/)
{ match ->
+ annotations.add(match)
+ "___PLACEHOLDER_${annotations.size() - 1}___"
+ }
+
+ // Global replace
+ content = content.replaceAll(className, newClassName)
if (originalName.endsWith("IT.java")) {
String originalExtendsClassName = className.replace("IT",
"Test")
@@ -32,6 +41,11 @@ def makeTestClassNamesUnique(File sourceDir, String
classNamePrefix) {
content = content.replaceAll(originalExtendsClassName,
extendsClassName)
}
+ // Restore annotations
+ annotations.eachWithIndex { annotation, i ->
+ content = content.replace("___PLACEHOLDER_${i}___",
annotation)
+ }
+
file.write(content)
String path = file.absolutePath.replace(originalName,
"${classNamePrefix}${originalName}")