This is an automated email from the ASF dual-hosted git repository.

christophd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git


The following commit(s) were added to refs/heads/main by this push:
     new 97d425255 chore: Improve AWS integration tests
97d425255 is described below

commit 97d425255e93aac6aaaf8a570b239841c28ba8d5
Author: Christoph Deppisch <[email protected]>
AuthorDate: Thu Aug 6 11:43:15 2026 +0200

    chore: Improve AWS integration tests
    
    - Use Citrus provided AWS service clients
    - Use service options to auto create S3 buckets, SQS queues, Kinesis 
streams and DDB tables
---
 .../test/resources/aws/ddb/amazonDDBClient.groovy  | 62 ----------------------
 .../ddb/aws-ddb-sink-delete-item.citrus.it.yaml    | 10 ++--
 .../aws/ddb/aws-ddb-sink-put-item.citrus.it.yaml   | 10 ++--
 ...led => aws-ddb-sink-update-item.citrus.it.yaml} | 11 ++--
 .../aws/ddb/aws-ddb-source.citrus.it.yaml          | 10 ++--
 .../src/test/resources/aws/ddb/getItem.groovy      |  3 +-
 .../src/test/resources/aws/ddb/putItem.groovy      |  4 +-
 .../src/test/resources/aws/ddb/verifyItems.groovy  |  5 +-
 .../aws/kinesis/amazonKinesisClient.groovy         | 36 -------------
 .../aws/kinesis/aws-kinesis-sink.citrus.it.yaml    |  9 ++--
 .../aws/kinesis/aws-kinesis-source.citrus.it.yaml  | 10 ++--
 .../aws/s3/aws-s3-sink-route.citrus.it.yaml        |  9 ++--
 .../resources/aws/s3/aws-s3-to-http.citrus.it.yaml |  9 ++--
 .../aws/s3/aws-s3-to-log-uri-based.citrus.it.yaml  | 10 ++--
 .../aws/s3/aws-s3-uri-pipe.citrus.it.yaml          | 11 ++--
 .../src/test/resources/aws/s3/getS3Object.groovy   | 15 +-----
 .../test/resources/aws/sns/setupSnsToSqs.groovy    | 24 +--------
 .../test/resources/aws/sqs/amazonSQSClient.groovy  | 36 -------------
 .../aws/sqs/aws-sqs-sink-route.citrus.it.yaml      |  9 ++--
 .../sqs/aws-sqs-to-log-uri-based.citrus.it.yaml    |  9 ++--
 .../aws/sqs/aws-sqs-uri-pipe.citrus.it.yaml        | 11 ++--
 21 files changed, 61 insertions(+), 252 deletions(-)

diff --git 
a/tests/camel-kamelets-itest/src/test/resources/aws/ddb/amazonDDBClient.groovy 
b/tests/camel-kamelets-itest/src/test/resources/aws/ddb/amazonDDBClient.groovy
deleted file mode 100644
index 35b0e9015..000000000
--- 
a/tests/camel-kamelets-itest/src/test/resources/aws/ddb/amazonDDBClient.groovy
+++ /dev/null
@@ -1,62 +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.
- */
-
-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.dynamodb.DynamoDbClient
-import software.amazon.awssdk.services.dynamodb.model.AttributeDefinition
-import software.amazon.awssdk.services.dynamodb.model.KeySchemaElement
-import software.amazon.awssdk.services.dynamodb.model.KeyType
-import software.amazon.awssdk.services.dynamodb.model.ProvisionedThroughput
-import software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType
-import software.amazon.awssdk.services.dynamodb.model.StreamSpecification
-import software.amazon.awssdk.services.dynamodb.model.StreamViewType
-
-DynamoDbClient amazonDDBClient = DynamoDbClient
-        .builder()
-        
.endpointOverride(URI.create('${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}'))
-        .credentialsProvider(StaticCredentialsProvider.create(
-                AwsBasicCredentials.create(
-                        '${CITRUS_TESTCONTAINERS_LOCALSTACK_ACCESS_KEY}',
-                        '${CITRUS_TESTCONTAINERS_LOCALSTACK_SECRET_KEY}')
-        ))
-        .region(Region.of('${CITRUS_TESTCONTAINERS_LOCALSTACK_REGION}'))
-        .build()
-
-amazonDDBClient.createTable(b -> {
-        b.tableName('${aws.ddb.tableName}')
-        b.keySchema(
-                
KeySchemaElement.builder().attributeName("id").keyType(KeyType.HASH).build(),
-        )
-        b.attributeDefinitions(
-                
AttributeDefinition.builder().attributeName("id").attributeType(ScalarAttributeType.N).build(),
-        )
-
-        if (${aws.ddb.streams}) {
-            b.streamSpecification(StreamSpecification.builder()
-                .streamEnabled(true)
-                .streamViewType(StreamViewType.NEW_AND_OLD_IMAGES).build())
-        }
-
-        b.provisionedThroughput(
-                ProvisionedThroughput.builder()
-                        .readCapacityUnits(1L)
-                        .writeCapacityUnits(1L).build())
-})
-
-context.getReferenceResolver().bind("amazonDDBClient", amazonDDBClient)
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/aws/ddb/aws-ddb-sink-delete-item.citrus.it.yaml
 
b/tests/camel-kamelets-itest/src/test/resources/aws/ddb/aws-ddb-sink-delete-item.citrus.it.yaml
index 04d69eae1..a0c397a91 100644
--- 
a/tests/camel-kamelets-itest/src/test/resources/aws/ddb/aws-ddb-sink-delete-item.citrus.it.yaml
+++ 
b/tests/camel-kamelets-itest/src/test/resources/aws/ddb/aws-ddb-sink-delete-item.citrus.it.yaml
@@ -19,6 +19,8 @@ name: aws-ddb-sink-delete-item-test
 variables:
   - name: "maxRetryAttempts"
     value: "20"
+  - name: "aws.ddb.client.name"
+    value: "ddbDeleteItemClient"
   - name: "aws.ddb.streams"
     value: "false"
   - name: "aws.ddb.tableName"
@@ -32,15 +34,13 @@ actions:
         localstack:
           services:
             - "DYNAMODB"
+          options:
+            tables: '${aws.ddb.tableName}'
+            dynamodbClientName: 'ddbDeleteItemClient'
   - waitFor:
       http:
         url: "${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}"
 
-  # Create AWS-DDB client
-  - groovy:
-      script:
-        file: "aws/ddb/amazonDDBClient.groovy"
-
   # Verify empty AWS-DDB
   - createVariables:
       variables:
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/aws/ddb/aws-ddb-sink-put-item.citrus.it.yaml
 
b/tests/camel-kamelets-itest/src/test/resources/aws/ddb/aws-ddb-sink-put-item.citrus.it.yaml
index 2bea9d1fc..cebf9abc4 100644
--- 
a/tests/camel-kamelets-itest/src/test/resources/aws/ddb/aws-ddb-sink-put-item.citrus.it.yaml
+++ 
b/tests/camel-kamelets-itest/src/test/resources/aws/ddb/aws-ddb-sink-put-item.citrus.it.yaml
@@ -19,6 +19,8 @@ name: aws-ddb-sink-put-item-test
 variables:
   - name: "maxRetryAttempts"
     value: "20"
+  - name: "aws.ddb.client.name"
+    value: "ddbPutItemClient"
   - name: "aws.ddb.streams"
     value: "false"
   - name: "aws.ddb.tableName"
@@ -32,15 +34,13 @@ actions:
         localstack:
           services:
             - "DYNAMODB"
+          options:
+            tables: '${aws.ddb.tableName}'
+            dynamodbClientName: 'ddbPutItemClient'
   - waitFor:
       http:
         url: "${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}"
 
-  # Create AWS-DDB client
-  - groovy:
-      script:
-        file: "aws/ddb/amazonDDBClient.groovy"
-
   # Verify empty AWS-DDB
   - createVariables:
       variables:
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/aws/ddb/aws-ddb-sink-update-item.citrus.it.yaml.disabled
 
b/tests/camel-kamelets-itest/src/test/resources/aws/ddb/aws-ddb-sink-update-item.citrus.it.yaml
similarity index 95%
rename from 
tests/camel-kamelets-itest/src/test/resources/aws/ddb/aws-ddb-sink-update-item.citrus.it.yaml.disabled
rename to 
tests/camel-kamelets-itest/src/test/resources/aws/ddb/aws-ddb-sink-update-item.citrus.it.yaml
index b60964776..da050b280 100644
--- 
a/tests/camel-kamelets-itest/src/test/resources/aws/ddb/aws-ddb-sink-update-item.citrus.it.yaml.disabled
+++ 
b/tests/camel-kamelets-itest/src/test/resources/aws/ddb/aws-ddb-sink-update-item.citrus.it.yaml
@@ -16,9 +16,12 @@
 # ---------------------------------------------------------------------------
 
 name: aws-ddb-sink-update-item-test
+status: DISABLED
 variables:
   - name: "maxRetryAttempts"
     value: "20"
+  - name: "aws.ddb.client.name"
+    value: "ddbUpdateItemClient"
   - name: "aws.ddb.streams"
     value: "false"
   - name: "aws.ddb.tableName"
@@ -32,15 +35,13 @@ actions:
         localstack:
           services:
             - "DYNAMODB"
+          options:
+            tables: '${aws.ddb.tableName}'
+            dynamodbClientName: 'ddbUpdateItemClient'
   - waitFor:
       http:
         url: "${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}"
 
-  # Create AWS-DDB client
-  - groovy:
-      script:
-        file: "aws/ddb/amazonDDBClient.groovy"
-
   # Verify empty AWS-DDB
   - createVariables:
       variables:
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/aws/ddb/aws-ddb-source.citrus.it.yaml
 
b/tests/camel-kamelets-itest/src/test/resources/aws/ddb/aws-ddb-source.citrus.it.yaml
index df7749f50..29433de7d 100644
--- 
a/tests/camel-kamelets-itest/src/test/resources/aws/ddb/aws-ddb-source.citrus.it.yaml
+++ 
b/tests/camel-kamelets-itest/src/test/resources/aws/ddb/aws-ddb-source.citrus.it.yaml
@@ -19,6 +19,8 @@ name: aws-ddb-source-test
 variables:
   - name: "maxRetryAttempts"
     value: "20"
+  - name: "aws.ddb.client.name"
+    value: "ddbSourceItemClient"
   - name: "aws.ddb.streams"
     value: "true"
   - name: "aws.ddb.tableName"
@@ -36,15 +38,13 @@ actions:
         localstack:
           services:
             - "DYNAMODB"
+          options:
+            tables: '${aws.ddb.tableName}'
+            dynamodbClientName: 'ddbSourceItemClient'
   - waitFor:
       http:
         url: "${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}"
 
-  # Create AWS-DDB client
-  - groovy:
-      script:
-        file: "aws/ddb/amazonDDBClient.groovy"
-
   # Create Camel JBang integration
   - camel:
       cli:
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/aws/ddb/getItem.groovy 
b/tests/camel-kamelets-itest/src/test/resources/aws/ddb/getItem.groovy
index e436dfa58..e0c3a75e0 100644
--- a/tests/camel-kamelets-itest/src/test/resources/aws/ddb/getItem.groovy
+++ b/tests/camel-kamelets-itest/src/test/resources/aws/ddb/getItem.groovy
@@ -16,9 +16,10 @@
  */
 
 import org.citrusframework.exceptions.CitrusRuntimeException
+import software.amazon.awssdk.services.dynamodb.DynamoDbClient
 import software.amazon.awssdk.services.dynamodb.model.AttributeValue
 
-var amazonDDBClient = context.getReferenceResolver().resolve("amazonDDBClient")
+var amazonDDBClient = 
context.getReferenceResolver().resolve('${aws.ddb.client.name}', 
DynamoDbClient.class)
 
 try {
     def item = amazonDDBClient.getItem(b -> b.tableName('${aws.ddb.tableName}')
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/aws/ddb/putItem.groovy 
b/tests/camel-kamelets-itest/src/test/resources/aws/ddb/putItem.groovy
index 907e203ef..987542ffa 100644
--- a/tests/camel-kamelets-itest/src/test/resources/aws/ddb/putItem.groovy
+++ b/tests/camel-kamelets-itest/src/test/resources/aws/ddb/putItem.groovy
@@ -15,10 +15,12 @@
  * limitations under the License.
  */
 
+
+import software.amazon.awssdk.services.dynamodb.DynamoDbClient
 import software.amazon.awssdk.services.dynamodb.model.AttributeValue
 import software.amazon.awssdk.services.dynamodb.model.ReturnValue
 
-var amazonDDBClient = context.getReferenceResolver().resolve("amazonDDBClient")
+var amazonDDBClient = 
context.getReferenceResolver().resolve('${aws.ddb.client.name}', 
DynamoDbClient.class)
 
 Map<String, AttributeValue> item = new HashMap<>()
 item.put("id", AttributeValue.builder().n('${aws.ddb.item.id}').build())
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/aws/ddb/verifyItems.groovy 
b/tests/camel-kamelets-itest/src/test/resources/aws/ddb/verifyItems.groovy
index 7df226593..f86696b04 100644
--- a/tests/camel-kamelets-itest/src/test/resources/aws/ddb/verifyItems.groovy
+++ b/tests/camel-kamelets-itest/src/test/resources/aws/ddb/verifyItems.groovy
@@ -16,13 +16,14 @@
  */
 
 import org.citrusframework.exceptions.CitrusRuntimeException
+import software.amazon.awssdk.services.dynamodb.DynamoDbClient
 
-var amazonDDBClient = context.getReferenceResolver().resolve("amazonDDBClient")
+var amazonDDBClient = 
context.getReferenceResolver().resolve('${aws.ddb.client.name}', 
DynamoDbClient.class)
 
 try {
     def items = amazonDDBClient.scan(b -> 
b.tableName('${aws.ddb.tableName}'))?.items()
     def sorted = items.collect { new TreeMap(it) }
-    assert '${aws.ddb.items}' == sorted.toString()
+    assert sorted.toString() == '${aws.ddb.items}'
 } catch (AssertionError e) {
     throw new CitrusRuntimeException("AWS DDB item verification failed", e)
 }
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/aws/kinesis/amazonKinesisClient.groovy
 
b/tests/camel-kamelets-itest/src/test/resources/aws/kinesis/amazonKinesisClient.groovy
deleted file mode 100644
index bc1090200..000000000
--- 
a/tests/camel-kamelets-itest/src/test/resources/aws/kinesis/amazonKinesisClient.groovy
+++ /dev/null
@@ -1,36 +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.
- */
-
-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.kinesis.KinesisClient
-
-KinesisClient kinesisClient = KinesisClient
-        .builder()
-        
.endpointOverride(URI.create('${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}'))
-        .credentialsProvider(StaticCredentialsProvider.create(
-                AwsBasicCredentials.create(
-                        '${CITRUS_TESTCONTAINERS_LOCALSTACK_ACCESS_KEY}',
-                        '${CITRUS_TESTCONTAINERS_LOCALSTACK_SECRET_KEY}')
-        ))
-        .region(Region.of('${CITRUS_TESTCONTAINERS_LOCALSTACK_REGION}'))
-        .build()
-
-kinesisClient.createStream(s -> 
s.streamName('${aws.kinesis.streamName}').shardCount(1))
-
-return kinesisClient
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/aws/kinesis/aws-kinesis-sink.citrus.it.yaml
 
b/tests/camel-kamelets-itest/src/test/resources/aws/kinesis/aws-kinesis-sink.citrus.it.yaml
index 0b90a11ae..a3824ca4e 100644
--- 
a/tests/camel-kamelets-itest/src/test/resources/aws/kinesis/aws-kinesis-sink.citrus.it.yaml
+++ 
b/tests/camel-kamelets-itest/src/test/resources/aws/kinesis/aws-kinesis-sink.citrus.it.yaml
@@ -37,16 +37,13 @@ actions:
         localstack:
           services:
             - "KINESIS"
+          options:
+            streams: '${aws.kinesis.streamName}'
+            kinesisClientName: "kinesisSinkClient"
   - waitFor:
       http:
         url: "${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}"
 
-  # Create AWS-KINESIS client
-  - camel:
-      createComponent:
-        name: amazonKinesisClient
-        file: "aws/kinesis/amazonKinesisClient.groovy"
-
   # Create Camel JBang integration
   - camel:
       cli:
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/aws/kinesis/aws-kinesis-source.citrus.it.yaml
 
b/tests/camel-kamelets-itest/src/test/resources/aws/kinesis/aws-kinesis-source.citrus.it.yaml
index 45272cd39..f0e95d3eb 100644
--- 
a/tests/camel-kamelets-itest/src/test/resources/aws/kinesis/aws-kinesis-source.citrus.it.yaml
+++ 
b/tests/camel-kamelets-itest/src/test/resources/aws/kinesis/aws-kinesis-source.citrus.it.yaml
@@ -30,16 +30,12 @@ actions:
         localstack:
           services:
             - "KINESIS"
+          options:
+            streams: '${aws.kinesis.streamName}'
   - waitFor:
       http:
         url: "${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}"
 
-  # Create AWS-KINESIS client
-  - camel:
-      createComponent:
-        name: amazonKinesisClient
-        file: "aws/kinesis/amazonKinesisClient.groovy"
-
   # Create Camel JBang integration
   - camel:
       cli:
@@ -51,7 +47,7 @@ actions:
 
   # Publish event
   - send:
-      endpoint: 
camel:aws2-kinesis://${aws.kinesis.streamName}?amazonKinesisClient=#amazonKinesisClient
+      endpoint: 
camel:aws2-kinesis://${aws.kinesis.streamName}?amazonKinesisClient=#kinesisClient
       message:
         headers:
           - name: CamelAwsKinesisPartitionKey
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/aws/s3/aws-s3-sink-route.citrus.it.yaml
 
b/tests/camel-kamelets-itest/src/test/resources/aws/s3/aws-s3-sink-route.citrus.it.yaml
index 82ff43b96..c7d519930 100644
--- 
a/tests/camel-kamelets-itest/src/test/resources/aws/s3/aws-s3-sink-route.citrus.it.yaml
+++ 
b/tests/camel-kamelets-itest/src/test/resources/aws/s3/aws-s3-sink-route.citrus.it.yaml
@@ -30,16 +30,13 @@ actions:
         localstack:
           services:
             - "S3"
+          options:
+            buckets: '${aws.s3.bucketNameOrArn}'
+            s3ClientName: "s3SinkClient"
   - waitFor:
       http:
         url: "${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}"
 
-  # Create AWS-S3 client
-  - camel:
-      createComponent:
-        name: amazonS3Client
-        file: "aws/s3/amazonS3Client.groovy"
-
   # Create Camel JBang integration
   - camel:
       cli:
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/aws/s3/aws-s3-to-http.citrus.it.yaml
 
b/tests/camel-kamelets-itest/src/test/resources/aws/s3/aws-s3-to-http.citrus.it.yaml
index 47c7c8c57..5fa50dfd4 100644
--- 
a/tests/camel-kamelets-itest/src/test/resources/aws/s3/aws-s3-to-http.citrus.it.yaml
+++ 
b/tests/camel-kamelets-itest/src/test/resources/aws/s3/aws-s3-to-http.citrus.it.yaml
@@ -30,16 +30,13 @@ actions:
         localstack:
           services:
             - "S3"
+          options:
+            buckets: '${aws.s3.bucketNameOrArn}'
+            s3ClientName: "amazonS3Client"
   - waitFor:
       http:
         url: "${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}"
 
-  # Create AWS-S3 client
-  - camel:
-      createComponent:
-        name: amazonS3Client
-        file: "aws/s3/amazonS3Client.groovy"
-
   # Create Camel JBang integration
   - camel:
       cli:
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/aws/s3/aws-s3-to-log-uri-based.citrus.it.yaml
 
b/tests/camel-kamelets-itest/src/test/resources/aws/s3/aws-s3-to-log-uri-based.citrus.it.yaml
index fac3a4a95..b8f97ab39 100644
--- 
a/tests/camel-kamelets-itest/src/test/resources/aws/s3/aws-s3-to-log-uri-based.citrus.it.yaml
+++ 
b/tests/camel-kamelets-itest/src/test/resources/aws/s3/aws-s3-to-log-uri-based.citrus.it.yaml
@@ -30,16 +30,12 @@ actions:
         localstack:
           services:
             - "S3"
+          options:
+            buckets: '${aws.s3.bucketNameOrArn}'
   - waitFor:
       http:
         url: "${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}"
 
-  # Create AWS-S3 client
-  - camel:
-      createComponent:
-        name: amazonS3Client
-        file: "aws/s3/amazonS3Client.groovy"
-
   # Create Camel JBang integration
   - camel:
       cli:
@@ -65,7 +61,7 @@ actions:
 
   # Publish event
   - send:
-      endpoint: 
camel:aws2-s3://${aws.s3.bucketNameOrArn}?amazonS3Client=#amazonS3Client
+      endpoint: 
camel:aws2-s3://${aws.s3.bucketNameOrArn}?amazonS3Client=#s3Client
       message:
         headers:
           - name: CamelAwsS3Key
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/aws/s3/aws-s3-uri-pipe.citrus.it.yaml
 
b/tests/camel-kamelets-itest/src/test/resources/aws/s3/aws-s3-uri-pipe.citrus.it.yaml
index a740a19e5..84a5dbb32 100644
--- 
a/tests/camel-kamelets-itest/src/test/resources/aws/s3/aws-s3-uri-pipe.citrus.it.yaml
+++ 
b/tests/camel-kamelets-itest/src/test/resources/aws/s3/aws-s3-uri-pipe.citrus.it.yaml
@@ -30,16 +30,13 @@ actions:
         localstack:
           services:
             - "S3"
+          options:
+            buckets: '${aws.s3.bucketNameOrArn}'
+            s3ClientName: "s3PipeClient"
   - waitFor:
       http:
         url: "${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}"
 
-  # Create AWS-S3 client
-  - camel:
-      createComponent:
-        name: amazonS3Client
-        file: "aws/s3/amazonS3Client.groovy"
-
   # Create Camel JBang integration
   - camel:
       cli:
@@ -65,7 +62,7 @@ actions:
 
   # Publish event
   - send:
-      endpoint: 
camel:aws2-s3://${aws.s3.bucketNameOrArn}?amazonS3Client=#amazonS3Client
+      endpoint: 
camel:aws2-s3://${aws.s3.bucketNameOrArn}?amazonS3Client=#s3PipeClient
       message:
         headers:
           - name: CamelAwsS3Key
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/aws/s3/getS3Object.groovy 
b/tests/camel-kamelets-itest/src/test/resources/aws/s3/getS3Object.groovy
index 5b6a482ec..3bd8e96a1 100644
--- a/tests/camel-kamelets-itest/src/test/resources/aws/s3/getS3Object.groovy
+++ b/tests/camel-kamelets-itest/src/test/resources/aws/s3/getS3Object.groovy
@@ -15,23 +15,10 @@
  * limitations under the License.
  */
 
-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.s3.S3Client
 import software.amazon.awssdk.services.s3.model.GetObjectRequest
 
-S3Client s3 = S3Client
-        .builder()
-        
.endpointOverride(URI.create('${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}'))
-        .credentialsProvider(StaticCredentialsProvider.create(
-                AwsBasicCredentials.create(
-                        '${CITRUS_TESTCONTAINERS_LOCALSTACK_ACCESS_KEY}',
-                        '${CITRUS_TESTCONTAINERS_LOCALSTACK_SECRET_KEY}')
-        ))
-        .forcePathStyle(true)
-        .region(Region.of('${CITRUS_TESTCONTAINERS_LOCALSTACK_REGION}'))
-        .build()
+S3Client s3 = context.getReferenceResolver().resolve("s3SinkClient", 
S3Client.class)
 
 def response = s3.getObjectAsBytes(GetObjectRequest.builder()
         .bucket('${aws.s3.bucketNameOrArn}')
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/aws/sns/setupSnsToSqs.groovy 
b/tests/camel-kamelets-itest/src/test/resources/aws/sns/setupSnsToSqs.groovy
index 3e953f125..a4e6a46eb 100644
--- a/tests/camel-kamelets-itest/src/test/resources/aws/sns/setupSnsToSqs.groovy
+++ b/tests/camel-kamelets-itest/src/test/resources/aws/sns/setupSnsToSqs.groovy
@@ -15,32 +15,12 @@
  * limitations under the License.
  */
 
-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.sns.SnsClient
 import software.amazon.awssdk.services.sqs.SqsClient
 import software.amazon.awssdk.services.sqs.model.QueueAttributeName
 
-def credentials = StaticCredentialsProvider.create(
-        AwsBasicCredentials.create(
-                '${CITRUS_TESTCONTAINERS_LOCALSTACK_ACCESS_KEY}',
-                '${CITRUS_TESTCONTAINERS_LOCALSTACK_SECRET_KEY}'))
-
-def region = Region.of('${CITRUS_TESTCONTAINERS_LOCALSTACK_REGION}')
-def endpoint = URI.create('${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}')
-
-SnsClient snsClient = SnsClient.builder()
-        .endpointOverride(endpoint)
-        .credentialsProvider(credentials)
-        .region(region)
-        .build()
-
-SqsClient sqsClient = SqsClient.builder()
-        .endpointOverride(endpoint)
-        .credentialsProvider(credentials)
-        .region(region)
-        .build()
+SnsClient snsClient = context.getReferenceResolver().resolve("snsClient", 
SnsClient.class)
+SqsClient sqsClient = context.getReferenceResolver().resolve("sqsClient", 
SqsClient.class)
 
 def topicArn = snsClient.createTopic(b -> 
b.name('${aws.sns.topicName}')).topicArn()
 
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/aws/sqs/amazonSQSClient.groovy 
b/tests/camel-kamelets-itest/src/test/resources/aws/sqs/amazonSQSClient.groovy
deleted file mode 100644
index 80676fac7..000000000
--- 
a/tests/camel-kamelets-itest/src/test/resources/aws/sqs/amazonSQSClient.groovy
+++ /dev/null
@@ -1,36 +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.
- */
-
-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.sqs.SqsClient
-
-SqsClient sqsClient = SqsClient
-        .builder()
-        
.endpointOverride(URI.create('${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}'))
-        .credentialsProvider(StaticCredentialsProvider.create(
-                AwsBasicCredentials.create(
-                        '${CITRUS_TESTCONTAINERS_LOCALSTACK_ACCESS_KEY}',
-                        '${CITRUS_TESTCONTAINERS_LOCALSTACK_SECRET_KEY}')
-        ))
-        .region(Region.of('${CITRUS_TESTCONTAINERS_LOCALSTACK_REGION}'))
-        .build()
-
-sqsClient.createQueue(s -> s.queueName('${aws.sqs.queueName}'))
-
-return sqsClient
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/aws/sqs/aws-sqs-sink-route.citrus.it.yaml
 
b/tests/camel-kamelets-itest/src/test/resources/aws/sqs/aws-sqs-sink-route.citrus.it.yaml
index 9be676c95..824aa77e9 100644
--- 
a/tests/camel-kamelets-itest/src/test/resources/aws/sqs/aws-sqs-sink-route.citrus.it.yaml
+++ 
b/tests/camel-kamelets-itest/src/test/resources/aws/sqs/aws-sqs-sink-route.citrus.it.yaml
@@ -28,16 +28,13 @@ actions:
         localstack:
           services:
             - "SQS"
+          options:
+            queues: '${aws.sqs.queueName}'
+            sqsClientName: "sqsSinkClient"
   - waitFor:
       http:
         url: "${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}"
 
-  # Create AWS-SQS client
-  - camel:
-      createComponent:
-        name: amazonSQSClient
-        file: "aws/sqs/amazonSQSClient.groovy"
-
   # Create Camel JBang integration
   - camel:
       cli:
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/aws/sqs/aws-sqs-to-log-uri-based.citrus.it.yaml
 
b/tests/camel-kamelets-itest/src/test/resources/aws/sqs/aws-sqs-to-log-uri-based.citrus.it.yaml
index 2b30bd631..325c23b7b 100644
--- 
a/tests/camel-kamelets-itest/src/test/resources/aws/sqs/aws-sqs-to-log-uri-based.citrus.it.yaml
+++ 
b/tests/camel-kamelets-itest/src/test/resources/aws/sqs/aws-sqs-to-log-uri-based.citrus.it.yaml
@@ -28,16 +28,13 @@ actions:
         localstack:
           services:
             - "SQS"
+          options:
+            queues: '${aws.sqs.queueName}'
+            sqsClientName: "amazonSQSClient"
   - waitFor:
       http:
         url: "${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}"
 
-  # Create AWS-SQS client
-  - camel:
-      createComponent:
-        name: amazonSQSClient
-        file: "aws/sqs/amazonSQSClient.groovy"
-
   # Create Camel JBang integration
   - camel:
       cli:
diff --git 
a/tests/camel-kamelets-itest/src/test/resources/aws/sqs/aws-sqs-uri-pipe.citrus.it.yaml
 
b/tests/camel-kamelets-itest/src/test/resources/aws/sqs/aws-sqs-uri-pipe.citrus.it.yaml
index 7721f0cb5..72f1a6ea4 100644
--- 
a/tests/camel-kamelets-itest/src/test/resources/aws/sqs/aws-sqs-uri-pipe.citrus.it.yaml
+++ 
b/tests/camel-kamelets-itest/src/test/resources/aws/sqs/aws-sqs-uri-pipe.citrus.it.yaml
@@ -28,16 +28,13 @@ actions:
         localstack:
           services:
             - "SQS"
+          options:
+            queues: '${aws.sqs.queueName}'
+            sqsClientName: "amazonPipeClient"
   - waitFor:
       http:
         url: "${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}"
 
-  # Create AWS-SQS client
-  - camel:
-      createComponent:
-        name: amazonSQSClient
-        file: "aws/sqs/amazonSQSClient.groovy"
-
   # Create Camel JBang integration
   - camel:
       cli:
@@ -61,7 +58,7 @@ actions:
 
   # Publish event
   - send:
-      endpoint: 
camel:aws2-sqs://${aws.sqs.queueName}?amazonSQSClient=#amazonSQSClient
+      endpoint: 
camel:aws2-sqs://${aws.sqs.queueName}?amazonSQSClient=#amazonPipeClient
       message:
         body:
           data: "${aws.sqs.message}"

Reply via email to