From c17672cc4d4a1df78c980182849cd28840a9b817 Mon Sep 17 00:00:00 2001 From: Sanjana Date: Sat, 7 Mar 2026 15:31:12 +0530 Subject: [PATCH 1/2] Add integration tests for AWS2 Translate component This commit adds integration tests for the AWS2 Translate component, using WireMock to mock the AWS service as it is not supported by LocalStack Community Edition. It also improves core AWS test support to handle mock backends more robustly when LocalStack is skipped. - Added integration tests for aws2-translate - Introduced WireMock to mock TranslateText operation - Improved Aws2TestResource to bypass LocalStack for unsupported services - Exported credentials in Aws2TestEnvContext for mock backends - Registered AWS SDK Translate execution interceptors for runtime reflection --- .../deployment/Aws2TranslateProcessor.java | 6 +- .../aws2/aws2-translate/pom.xml | 141 ++++++++++++++++++ .../translate/it/Aws2TranslateResource.java | 58 +++++++ .../src/main/resources/application.properties | 23 +++ .../aws2/translate/it/Aws2TranslateIT.java | 24 +++ .../aws2/translate/it/Aws2TranslateTest.java | 71 +++++++++ .../it/Aws2TranslateTestEnvCustomizer.java | 40 +++++ .../it/TranslateMockTestResource.java | 45 ++++++ ...us.test.support.aws2.Aws2TestEnvCustomizer | 1 + .../test/resources/mappings/translate.json | 22 +++ integration-test-groups/aws2/pom.xml | 1 + .../test/support/aws2/Aws2TestEnvContext.java | 22 +-- .../test/support/aws2/Aws2TestResource.java | 33 ++-- .../quarkus/test/support/aws2/Service.java | 3 +- .../WireMockTestResourceLifecycleManager.java | 7 +- integration-tests/aws2-grouped/pom.xml | 23 +++ 16 files changed, 492 insertions(+), 28 deletions(-) create mode 100644 integration-test-groups/aws2/aws2-translate/pom.xml create mode 100644 integration-test-groups/aws2/aws2-translate/src/main/java/org/apache/camel/quarkus/component/aws2/translate/it/Aws2TranslateResource.java create mode 100644 integration-test-groups/aws2/aws2-translate/src/main/resources/application.properties create mode 100644 integration-test-groups/aws2/aws2-translate/src/test/java/org/apache/camel/quarkus/component/aws2/translate/it/Aws2TranslateIT.java create mode 100644 integration-test-groups/aws2/aws2-translate/src/test/java/org/apache/camel/quarkus/component/aws2/translate/it/Aws2TranslateTest.java create mode 100644 integration-test-groups/aws2/aws2-translate/src/test/java/org/apache/camel/quarkus/component/aws2/translate/it/Aws2TranslateTestEnvCustomizer.java create mode 100644 integration-test-groups/aws2/aws2-translate/src/test/java/org/apache/camel/quarkus/component/aws2/translate/it/TranslateMockTestResource.java create mode 100644 integration-test-groups/aws2/aws2-translate/src/test/resources/META-INF/services/org.apache.camel.quarkus.test.support.aws2.Aws2TestEnvCustomizer create mode 100644 integration-test-groups/aws2/aws2-translate/src/test/resources/mappings/translate.json diff --git a/extensions/aws2-translate/deployment/src/main/java/org/apache/camel/quarkus/component/aws2/translate/deployment/Aws2TranslateProcessor.java b/extensions/aws2-translate/deployment/src/main/java/org/apache/camel/quarkus/component/aws2/translate/deployment/Aws2TranslateProcessor.java index 82d965923976..10f35789588d 100644 --- a/extensions/aws2-translate/deployment/src/main/java/org/apache/camel/quarkus/component/aws2/translate/deployment/Aws2TranslateProcessor.java +++ b/extensions/aws2-translate/deployment/src/main/java/org/apache/camel/quarkus/component/aws2/translate/deployment/Aws2TranslateProcessor.java @@ -17,6 +17,7 @@ package org.apache.camel.quarkus.component.aws2.translate.deployment; import java.util.List; +import java.util.stream.Collectors; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; @@ -34,7 +35,8 @@ class Aws2TranslateProcessor { public static final String AWS_SDK_APPLICATION_ARCHIVE_MARKERS = "software/amazon/awssdk"; private static final List INTERCEPTOR_PATHS = List.of( - "software/amazon/awssdk/global/handlers/execution.interceptors"); + "software/amazon/awssdk/global/handlers/execution.interceptors", + "software/amazon/awssdk/services/translate/execution.interceptors"); private static final DotName EXECUTION_INTERCEPTOR_NAME = DotName.createSimple(ExecutionInterceptor.class.getName()); @@ -53,7 +55,7 @@ void process(CombinedIndexBuildItem combinedIndexBuildItem, List knownInterceptorImpls = combinedIndexBuildItem.getIndex() .getAllKnownImplementations(EXECUTION_INTERCEPTOR_NAME) .stream() - .map(c -> c.name().toString()).toList(); + .map(c -> c.name().toString()).collect(Collectors.toList()); reflectiveClasses.produce( ReflectiveClassBuildItem.builder(knownInterceptorImpls.toArray(new String[knownInterceptorImpls.size()])) diff --git a/integration-test-groups/aws2/aws2-translate/pom.xml b/integration-test-groups/aws2/aws2-translate/pom.xml new file mode 100644 index 000000000000..24161950bbdf --- /dev/null +++ b/integration-test-groups/aws2/aws2-translate/pom.xml @@ -0,0 +1,141 @@ + + + + 4.0.0 + + org.apache.camel.quarkus + camel-quarkus-build-parent-it + 3.33.0-SNAPSHOT + ../../../poms/build-parent-it/pom.xml + + + camel-quarkus-integration-test-aws2-translate + Camel Quarkus :: Integration Tests :: AWS2 Translate + The camel integration tests + + + + org.apache.camel.quarkus + camel-quarkus-aws2-translate + + + io.quarkus + quarkus-resteasy + + + io.quarkus + quarkus-resteasy-jackson + + + + + io.quarkus + quarkus-junit + test + + + io.rest-assured + rest-assured + test + + + org.apache.camel.quarkus + camel-quarkus-integration-tests-support-aws2 + + + org.apache.camel.quarkus + camel-quarkus-integration-tests-support-aws2 + test-jar + test + + + org.apache.camel.quarkus + camel-quarkus-integration-wiremock-support + ${project.version} + test + + + + + + native + + + native + + + + true + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + + integration-test + verify + + + + + + + + + virtualDependencies + + + !noVirtualDependencies + + + + + + org.apache.camel.quarkus + camel-quarkus-aws2-translate-deployment + ${project.version} + pom + test + + + * + * + + + + + + + skip-testcontainers-tests + + + skip-testcontainers-tests + + + + true + + + + + diff --git a/integration-test-groups/aws2/aws2-translate/src/main/java/org/apache/camel/quarkus/component/aws2/translate/it/Aws2TranslateResource.java b/integration-test-groups/aws2/aws2-translate/src/main/java/org/apache/camel/quarkus/component/aws2/translate/it/Aws2TranslateResource.java new file mode 100644 index 000000000000..b63071ddbf64 --- /dev/null +++ b/integration-test-groups/aws2/aws2-translate/src/main/java/org/apache/camel/quarkus/component/aws2/translate/it/Aws2TranslateResource.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.quarkus.component.aws2.translate.it; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.MediaType; +import org.apache.camel.ProducerTemplate; +import org.apache.camel.component.aws2.translate.Translate2Constants; +import org.apache.camel.quarkus.test.support.aws2.BaseAws2Resource; + +@Path("/aws2-translate") +@ApplicationScoped +public class Aws2TranslateResource extends BaseAws2Resource { + + @Inject + ProducerTemplate producerTemplate; + + public Aws2TranslateResource() { + super("translate"); + } + + @Path("/translate") + @POST + @Consumes(MediaType.TEXT_PLAIN) + @Produces(MediaType.TEXT_PLAIN) + public String translate( + String text, + @QueryParam("sourceLanguage") String sourceLanguage, + @QueryParam("targetLanguage") String targetLanguage) throws Exception { + return producerTemplate.requestBodyAndHeaders( + "aws2-translate://test?operation=translateText", + text, + java.util.Map.of( + Translate2Constants.SOURCE_LANGUAGE, sourceLanguage, + Translate2Constants.TARGET_LANGUAGE, targetLanguage), + String.class); + } +} diff --git a/integration-test-groups/aws2/aws2-translate/src/main/resources/application.properties b/integration-test-groups/aws2/aws2-translate/src/main/resources/application.properties new file mode 100644 index 000000000000..305f509e2cef --- /dev/null +++ b/integration-test-groups/aws2/aws2-translate/src/main/resources/application.properties @@ -0,0 +1,23 @@ +## --------------------------------------------------------------------------- +## 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 :: AWS2 options +# +camel.component.aws2-translate.access-key=${AWS_ACCESS_KEY} +camel.component.aws2-translate.secret-key=${AWS_SECRET_KEY} +camel.component.aws2-translate.useDefaultCredentialsProvider=${AWS_USE_DEFAULT_CREDENTIALS_PROVIDER} +camel.component.aws2-translate.region=${AWS_REGION:us-east-1} diff --git a/integration-test-groups/aws2/aws2-translate/src/test/java/org/apache/camel/quarkus/component/aws2/translate/it/Aws2TranslateIT.java b/integration-test-groups/aws2/aws2-translate/src/test/java/org/apache/camel/quarkus/component/aws2/translate/it/Aws2TranslateIT.java new file mode 100644 index 000000000000..93c08c911059 --- /dev/null +++ b/integration-test-groups/aws2/aws2-translate/src/test/java/org/apache/camel/quarkus/component/aws2/translate/it/Aws2TranslateIT.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.translate.it; + +import io.quarkus.test.junit.QuarkusIntegrationTest; + +@QuarkusIntegrationTest +class Aws2TranslateIT extends Aws2TranslateTest { + +} diff --git a/integration-test-groups/aws2/aws2-translate/src/test/java/org/apache/camel/quarkus/component/aws2/translate/it/Aws2TranslateTest.java b/integration-test-groups/aws2/aws2-translate/src/test/java/org/apache/camel/quarkus/component/aws2/translate/it/Aws2TranslateTest.java new file mode 100644 index 000000000000..c6cc4acc9a5e --- /dev/null +++ b/integration-test-groups/aws2/aws2-translate/src/test/java/org/apache/camel/quarkus/component/aws2/translate/it/Aws2TranslateTest.java @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.quarkus.component.aws2.translate.it; + +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.junit.QuarkusTest; +import io.restassured.RestAssured; +import org.apache.camel.quarkus.test.support.aws2.Aws2TestResource; +import org.apache.camel.quarkus.test.support.aws2.BaseAWs2TestSupport; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.core.Is.is; + +@QuarkusTest +@QuarkusTestResource(Aws2TestResource.class) +@QuarkusTestResource(TranslateMockTestResource.class) +class Aws2TranslateTest extends BaseAWs2TestSupport { + + public Aws2TranslateTest() { + super("/aws2-translate"); + } + + @Test + public void translate() { + RestAssured.given() + .queryParam("sourceLanguage", "en") + .queryParam("targetLanguage", "fr") + .body("Hello") + .post("/aws2-translate/translate") + .then() + .statusCode(200) + .body(is("Bonjour")); + } + + @Override + @org.junit.jupiter.api.Disabled("LocalStack not supported for Translate, skipping credential tests") + public void successfulDefaultCredentialsProviderTest() { + super.successfulDefaultCredentialsProviderTest(); + } + + @Override + @org.junit.jupiter.api.Disabled("LocalStack not supported for Translate, skipping credential tests") + public void failingDefaultCredentialsProviderTest() { + super.failingDefaultCredentialsProviderTest(); + } + + @Override + public void testMethodForDefaultCredentialsProvider() { + RestAssured.given() + .queryParam("sourceLanguage", "en") + .queryParam("targetLanguage", "fr") + .body("Hello") + .post("/aws2-translate/translate") + .then() + .statusCode(200); + } +} diff --git a/integration-test-groups/aws2/aws2-translate/src/test/java/org/apache/camel/quarkus/component/aws2/translate/it/Aws2TranslateTestEnvCustomizer.java b/integration-test-groups/aws2/aws2-translate/src/test/java/org/apache/camel/quarkus/component/aws2/translate/it/Aws2TranslateTestEnvCustomizer.java new file mode 100644 index 000000000000..576ee775f0d7 --- /dev/null +++ b/integration-test-groups/aws2/aws2-translate/src/test/java/org/apache/camel/quarkus/component/aws2/translate/it/Aws2TranslateTestEnvCustomizer.java @@ -0,0 +1,40 @@ +/* + * 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.translate.it; + +import org.apache.camel.quarkus.test.support.aws2.Aws2TestEnvContext; +import org.apache.camel.quarkus.test.support.aws2.Aws2TestEnvCustomizer; +import org.apache.camel.quarkus.test.support.aws2.Service; + +public class Aws2TranslateTestEnvCustomizer implements Aws2TestEnvCustomizer { + + @Override + public Service[] localstackServices() { + return new Service[] {}; + } + + @Override + public Service[] exportCredentialsForLocalstackServices() { + return new Service[] { Service.TRANSLATE }; + } + + @Override + public void customize(Aws2TestEnvContext envContext) { + // No specific customization needed for Translate service beyond enabling it + } + +} diff --git a/integration-test-groups/aws2/aws2-translate/src/test/java/org/apache/camel/quarkus/component/aws2/translate/it/TranslateMockTestResource.java b/integration-test-groups/aws2/aws2-translate/src/test/java/org/apache/camel/quarkus/component/aws2/translate/it/TranslateMockTestResource.java new file mode 100644 index 000000000000..2f69b788901f --- /dev/null +++ b/integration-test-groups/aws2/aws2-translate/src/test/java/org/apache/camel/quarkus/component/aws2/translate/it/TranslateMockTestResource.java @@ -0,0 +1,45 @@ +/* + * 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.translate.it; + +import java.util.Map; + +import org.apache.camel.quarkus.test.wiremock.WireMockTestResourceLifecycleManager; + +public class TranslateMockTestResource extends WireMockTestResourceLifecycleManager { + + @Override + public Map start() { + Map properties = super.start(); + String wiremockUrl = properties.get("wiremock.url"); + if (wiremockUrl != null) { + properties.put("camel.component.aws2-translate.override-endpoint", "true"); + properties.put("camel.component.aws2-translate.uri-endpoint-override", wiremockUrl); + } + return properties; + } + + @Override + protected String getRecordTargetBaseUrl() { + return "https://translate.us-east-1.amazonaws.com"; + } + + @Override + protected boolean isMockingEnabled() { + return org.apache.camel.quarkus.test.mock.backend.MockBackendUtils.startMockBackend(false); + } +} diff --git a/integration-test-groups/aws2/aws2-translate/src/test/resources/META-INF/services/org.apache.camel.quarkus.test.support.aws2.Aws2TestEnvCustomizer b/integration-test-groups/aws2/aws2-translate/src/test/resources/META-INF/services/org.apache.camel.quarkus.test.support.aws2.Aws2TestEnvCustomizer new file mode 100644 index 000000000000..3b38c8862c38 --- /dev/null +++ b/integration-test-groups/aws2/aws2-translate/src/test/resources/META-INF/services/org.apache.camel.quarkus.test.support.aws2.Aws2TestEnvCustomizer @@ -0,0 +1 @@ +org.apache.camel.quarkus.component.aws2.translate.it.Aws2TranslateTestEnvCustomizer diff --git a/integration-test-groups/aws2/aws2-translate/src/test/resources/mappings/translate.json b/integration-test-groups/aws2/aws2-translate/src/test/resources/mappings/translate.json new file mode 100644 index 000000000000..e1168f5ee96d --- /dev/null +++ b/integration-test-groups/aws2/aws2-translate/src/test/resources/mappings/translate.json @@ -0,0 +1,22 @@ +{ + "request": { + "method": "POST", + "url": "/", + "headers": { + "X-Amz-Target": { + "equalTo": "AWSShineFrontendService_20170701.TranslateText" + } + } + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/x-amzn-json-1.1" + }, + "jsonBody": { + "TranslatedText": "Bonjour", + "SourceLanguageCode": "en", + "TargetLanguageCode": "fr" + } + } +} diff --git a/integration-test-groups/aws2/pom.xml b/integration-test-groups/aws2/pom.xml index 007afd1eaf37..12f99fe0a21a 100644 --- a/integration-test-groups/aws2/pom.xml +++ b/integration-test-groups/aws2/pom.xml @@ -46,6 +46,7 @@ aws2-ses aws2-sqs aws2-sqs-sns + aws2-translate diff --git a/integration-tests-support/aws2/src/test/java/org/apache/camel/quarkus/test/support/aws2/Aws2TestEnvContext.java b/integration-tests-support/aws2/src/test/java/org/apache/camel/quarkus/test/support/aws2/Aws2TestEnvContext.java index 7a5ffc71d4b8..e88ceb415b68 100644 --- a/integration-tests-support/aws2/src/test/java/org/apache/camel/quarkus/test/support/aws2/Aws2TestEnvContext.java +++ b/integration-tests-support/aws2/src/test/java/org/apache/camel/quarkus/test/support/aws2/Aws2TestEnvContext.java @@ -67,22 +67,22 @@ public Aws2TestEnvContext(String accessKey, String secretKey, String region, boo this.credentialsProvider = useDefaultCredentialsProvider ? CredentialsProvider.defaultProvider : CredentialsProvider.staticProvider; - localstack.ifPresent(ls -> { - for (Service service : exportCredentialsServices) { - String s = camelServiceComponentName(service); - if (s != null) { - if (credentialsProvider == CredentialsProvider.staticProvider) { - properties.put(s + ".access-key", accessKey); - properties.put(s + ".secret-key", secretKey); - } - properties.put(s + ".region", region); + for (Service service : exportCredentialsServices) { + String s = camelServiceComponentName(service); + if (s != null) { + if (credentialsProvider == CredentialsProvider.staticProvider) { + properties.put(s + ".access-key", accessKey); + properties.put(s + ".secret-key", secretKey); + } + properties.put(s + ".region", region); + localstack.ifPresent(ls -> { properties.put(s + ".override-endpoint", "true"); properties.put(s + ".uri-endpoint-override", ls.getEndpoint().toString()); - } + }); } - }); + } } /** diff --git a/integration-tests-support/aws2/src/test/java/org/apache/camel/quarkus/test/support/aws2/Aws2TestResource.java b/integration-tests-support/aws2/src/test/java/org/apache/camel/quarkus/test/support/aws2/Aws2TestResource.java index 389c493c664f..ee4063ab5de4 100644 --- a/integration-tests-support/aws2/src/test/java/org/apache/camel/quarkus/test/support/aws2/Aws2TestResource.java +++ b/integration-tests-support/aws2/src/test/java/org/apache/camel/quarkus/test/support/aws2/Aws2TestResource.java @@ -81,19 +81,26 @@ public Map start() { .distinct() .toArray(Service[]::new); - DockerImageName imageName = DockerImageName - .parse(ConfigProvider.getConfig().getValue("localstack.container.image", String.class)) - .asCompatibleSubstituteFor("localstack/localstack"); - LocalStackContainer localstack = new LocalStackContainer(imageName) - .withServices(services); - localstack.withEnv("LS_LOG", localstackLogLevel); - localstack.withEnv("AWS_ACCESS_KEY_ID", "testAccessKeyId"); //has to be longer then `test`, to work on FIPS systems - localstack.withEnv("AWS_SECRET_ACCESS_KEY", "testSecretKeyId"); - localstack.withLogConsumer(new Slf4jLogConsumer(LOG)); - localstack.start(); - - envContext = new Aws2TestEnvContext(localstack.getAccessKey(), localstack.getSecretKey(), localstack.getRegion(), - useDefaultCredentialsProvider, Optional.of(localstack), exportCredentialsServices); + if (services.length > 0) { + DockerImageName imageName = DockerImageName + .parse(ConfigProvider.getConfig().getValue("localstack.container.image", String.class)) + .asCompatibleSubstituteFor("localstack/localstack"); + LocalStackContainer localstack = new LocalStackContainer(imageName) + .withServices(services); + localstack.withEnv("LS_LOG", localstackLogLevel); + localstack.withEnv("AWS_ACCESS_KEY_ID", "testAccessKeyId"); //has to be longer then `test`, to work on FIPS systems + localstack.withEnv("AWS_SECRET_ACCESS_KEY", "testSecretKeyId"); + localstack.withLogConsumer(new Slf4jLogConsumer(LOG)); + localstack.start(); + + envContext = new Aws2TestEnvContext(localstack.getAccessKey(), localstack.getSecretKey(), + localstack.getRegion(), + useDefaultCredentialsProvider, Optional.of(localstack), exportCredentialsServices); + } else { + LOG.info("No LocalStack services requested, skipping container startup"); + envContext = new Aws2TestEnvContext("testAccessKeyId", "testSecretKeyId", "us-east-1", + useDefaultCredentialsProvider, Optional.empty(), exportCredentialsServices); + } } else { if (!startMockBackend && !realCredentialsProvided && !useDefaultCredentialsProvider) { diff --git a/integration-tests-support/aws2/src/test/java/org/apache/camel/quarkus/test/support/aws2/Service.java b/integration-tests-support/aws2/src/test/java/org/apache/camel/quarkus/test/support/aws2/Service.java index 422b68429536..37579d4d8a08 100644 --- a/integration-tests-support/aws2/src/test/java/org/apache/camel/quarkus/test/support/aws2/Service.java +++ b/integration-tests-support/aws2/src/test/java/org/apache/camel/quarkus/test/support/aws2/Service.java @@ -38,7 +38,8 @@ public enum Service { CLOUDWATCHLOGS("logs"), STS("sts"), IAM("iam"), - KMS("kms"); + KMS("kms"), + TRANSLATE("translate"); private final String serviceName; diff --git a/integration-tests-support/wiremock/src/main/java/org/apache/camel/quarkus/test/wiremock/WireMockTestResourceLifecycleManager.java b/integration-tests-support/wiremock/src/main/java/org/apache/camel/quarkus/test/wiremock/WireMockTestResourceLifecycleManager.java index 6402c92953d2..eaec289a842a 100644 --- a/integration-tests-support/wiremock/src/main/java/org/apache/camel/quarkus/test/wiremock/WireMockTestResourceLifecycleManager.java +++ b/integration-tests-support/wiremock/src/main/java/org/apache/camel/quarkus/test/wiremock/WireMockTestResourceLifecycleManager.java @@ -236,7 +236,12 @@ private WireMockServer createServer() { // Read mapping resources from the classpath in playback mode configuration.fileSource(new CamelQuarkusFileSource()); } - return new WireMockServer(configuration); + WireMockServer server = new WireMockServer(configuration); + onServerStart(server); + return server; + } + + protected void onServerStart(WireMockServer server) { } /** diff --git a/integration-tests/aws2-grouped/pom.xml b/integration-tests/aws2-grouped/pom.xml index c5105ce38f59..2508724500ac 100644 --- a/integration-tests/aws2-grouped/pom.xml +++ b/integration-tests/aws2-grouped/pom.xml @@ -96,6 +96,10 @@ org.apache.camel.quarkus camel-quarkus-aws2-sqs + + org.apache.camel.quarkus + camel-quarkus-aws2-translate + org.apache.camel.quarkus camel-quarkus-direct @@ -114,6 +118,12 @@ rest-assured test + + org.apache.camel.quarkus + camel-quarkus-integration-wiremock-support + ${project.version} + test + org.awaitility awaitility @@ -339,6 +349,19 @@ + + org.apache.camel.quarkus + camel-quarkus-aws2-translate-deployment + ${project.version} + pom + test + + + * + * + + + org.apache.camel.quarkus camel-quarkus-direct-deployment From 14ea3fbfcfb066f0ed24ecf4034925a952c0693e Mon Sep 17 00:00:00 2001 From: Sanjana Date: Sat, 7 Mar 2026 22:29:07 +0530 Subject: [PATCH 2/2] chore: trigger CI re-run due to network failure