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-jbang-examples.git
The following commit(s) were added to refs/heads/main by this push:
new 2adf9d0 chore: Update integration tests for Citrus 5.0.0
2adf9d0 is described below
commit 2adf9d01be0a013f1a2d5dad5511013724f6e586
Author: Christoph Deppisch <[email protected]>
AuthorDate: Wed Aug 5 15:17:28 2026 +0200
chore: Update integration tests for Citrus 5.0.0
- Migrate tests from camel:createComponent to groovy:script actions
- Resolve AWS clients from the Citrus context instead of creating them in
Groovy scripts
- Remove hardcoded dependency versions in favor of ${camel.version}
placeholders
- Use explicit fixed port for Camel Infra Kafka service
- Use Citrus Kafka send/receive
Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
.../test/first-iteration.citrus.it.yaml | 11 +++---
.../test/aws-s3-cdc-log.citrus.it.yaml | 20 ++++-------
...azonS3Client.groovy => setupEventBridge.groovy} | 41 +++-------------------
cloud/aws-sqs/test/amazonSQSClient.groovy | 36 -------------------
cloud/aws-sqs/test/http-to-aws-sqs.citrus.it.yaml | 14 +++-----
5 files changed, 21 insertions(+), 101 deletions(-)
diff --git
a/ai/smart-log-analyzer/first-iteration/test/first-iteration.citrus.it.yaml
b/ai/smart-log-analyzer/first-iteration/test/first-iteration.citrus.it.yaml
index c1fbeae..07e50c9 100644
--- a/ai/smart-log-analyzer/first-iteration/test/first-iteration.citrus.it.yaml
+++ b/ai/smart-log-analyzer/first-iteration/test/first-iteration.citrus.it.yaml
@@ -1,4 +1,3 @@
-# deps: org.apache.camel:camel-test-infra-kafka:4.17.0
name: first-iteration-test
description: Integration test for the first-iteration log analyzer prototype
variables:
@@ -11,6 +10,8 @@ actions:
infra:
run:
service: kafka
+ fixedPort: true
+ port: 9092
- camel:
jbang:
run:
@@ -22,15 +23,15 @@ actions:
systemProperties:
file: "../application.properties"
- send:
- endpoint: |
- camel:kafka:${kafka.topic}?brokers=${kafka.broker}
+ endpoint: >-
+ kafka:${kafka.topic}?server=${kafka.broker}
message:
body:
resource:
file: "payload-info.json"
- send:
- endpoint: |
- camel:kafka:${kafka.topic}?brokers=${kafka.broker}
+ endpoint: >-
+ kafka:${kafka.topic}?server=${kafka.broker}
message:
body:
resource:
diff --git a/cloud/aws-s3-event-based/test/aws-s3-cdc-log.citrus.it.yaml
b/cloud/aws-s3-event-based/test/aws-s3-cdc-log.citrus.it.yaml
index 059e640..2298cfa 100644
--- a/cloud/aws-s3-event-based/test/aws-s3-cdc-log.citrus.it.yaml
+++ b/cloud/aws-s3-event-based/test/aws-s3-cdc-log.citrus.it.yaml
@@ -1,8 +1,5 @@
-# deps: org.apache.camel:camel-endpointdsl:4.18.0
-# deps: org.apache.camel:camel-aws2-s3:4.18.0
-# deps: org.apache.camel:camel-aws2-sqs:4.18.0
-# deps: org.apache.camel:camel-aws2-eventbridge:4.18.0
-# deps: software.amazon.awssdk:sdk-core:2.41.28
+# deps: org.apache.camel:camel-aws2-sqs:${camel.version}
+# deps: org.apache.camel:camel-aws2-eventbridge:${camel.version}
name: aws-s3-cdc-log-test
description: Sample test in YAML
variables:
@@ -22,12 +19,9 @@ actions:
- "S3"
- "SQS"
- "EVENT_BRIDGE"
- - camel:
- startContext: { }
- - camel:
- createComponent:
- name: amazonS3Client
- file: amazonS3Client.groovy
+ - groovy:
+ script:
+ file: setupEventBridge.groovy
- camel:
jbang:
run:
@@ -37,8 +31,8 @@ actions:
systemProperties:
file: "application.test.properties"
- send:
- endpoint: |
- camel:aws2-s3:${aws.bucketNameOrArn}?amazonS3Client=#amazonS3Client
+ endpoint: >-
+ camel:aws2-s3:${aws.bucketNameOrArn}?amazonS3Client=#s3Client
message:
body:
data: "${aws.s3.message}"
diff --git a/cloud/aws-s3-event-based/test/amazonS3Client.groovy
b/cloud/aws-s3-event-based/test/setupEventBridge.groovy
similarity index 65%
rename from cloud/aws-s3-event-based/test/amazonS3Client.groovy
rename to cloud/aws-s3-event-based/test/setupEventBridge.groovy
index 0f9b6ee..af94c52 100644
--- a/cloud/aws-s3-event-based/test/amazonS3Client.groovy
+++ b/cloud/aws-s3-event-based/test/setupEventBridge.groovy
@@ -29,42 +29,11 @@ import software.amazon.awssdk.services.sqs.SqsClient
import software.amazon.awssdk.services.sqs.model.CreateQueueResponse
import software.amazon.awssdk.services.sqs.model.QueueAttributeName
-// Creates an AWS S3 client that is used in the test to push data to the
bucket.
-// Also creates and prepares the bucket as well as the SQS queue and
EVENT_BRIDGE notifications.
+// Creates and prepares the S3 bucket as well as the SQS queue and
EVENT_BRIDGE notifications.
-S3Client s3 = S3Client
- .builder()
-
.endpointOverride(URI.create('${CITRUS_TESTCONTAINERS_LOCALSTACK_S3_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()
-
-SqsClient sqsClient = SqsClient
- .builder()
-
.endpointOverride(URI.create('${CITRUS_TESTCONTAINERS_LOCALSTACK_SQS_URL}'))
- .credentialsProvider(StaticCredentialsProvider.create(
- AwsBasicCredentials.create(
- '${CITRUS_TESTCONTAINERS_LOCALSTACK_ACCESS_KEY}',
- '${CITRUS_TESTCONTAINERS_LOCALSTACK_SECRET_KEY}')
- ))
- .region(Region.of('${CITRUS_TESTCONTAINERS_LOCALSTACK_REGION}'))
- .build()
-
-EventBridgeClient eventBridgeClient = EventBridgeClient
- .builder()
-
.endpointOverride(URI.create('${CITRUS_TESTCONTAINERS_LOCALSTACK_EVENTBRIDGE_URL}'))
- .credentialsProvider(StaticCredentialsProvider.create(
- AwsBasicCredentials.create(
- '${CITRUS_TESTCONTAINERS_LOCALSTACK_ACCESS_KEY}',
- '${CITRUS_TESTCONTAINERS_LOCALSTACK_SECRET_KEY}')
- ))
- .region(Region.of('${CITRUS_TESTCONTAINERS_LOCALSTACK_REGION}'))
- .build()
+S3Client s3 = context.getReferenceResolver().resolve("s3Client",
S3Client.class)
+SqsClient sqsClient = context.getReferenceResolver().resolve("sqsClient",
SqsClient.class)
+EventBridgeClient eventBridgeClient =
context.getReferenceResolver().resolve("eventbridgeClient",
EventBridgeClient.class)
// Create bucket
s3.createBucket(b -> b.bucket('${aws.bucketNameOrArn}'))
@@ -112,5 +81,3 @@ sqsClient.setQueueAttributes(b ->
b.queueUrl(queueUrl).attributes(Collections.si
// Add a target for EventBridge Rule which will be the SQS Queue just created
eventBridgeClient.putTargets(b ->
b.rule('s3-events-cdc').targets(Target.builder().id("sqs-sub").arn(queueArn).build()))
-
-return s3
diff --git a/cloud/aws-sqs/test/amazonSQSClient.groovy
b/cloud/aws-sqs/test/amazonSQSClient.groovy
deleted file mode 100644
index 80676fa..0000000
--- a/cloud/aws-sqs/test/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/cloud/aws-sqs/test/http-to-aws-sqs.citrus.it.yaml
b/cloud/aws-sqs/test/http-to-aws-sqs.citrus.it.yaml
index 90728dc..7d09cfb 100644
--- a/cloud/aws-sqs/test/http-to-aws-sqs.citrus.it.yaml
+++ b/cloud/aws-sqs/test/http-to-aws-sqs.citrus.it.yaml
@@ -1,5 +1,3 @@
-# deps: org.apache.camel:camel-aws2-sqs:4.18.0
-# deps: software.amazon.awssdk:sdk-core:2.41.28
name: http-to-aws-sqs
description: Sample test in YAML
variables:
@@ -13,12 +11,8 @@ actions:
localstack:
services:
- "SQS"
- - camel:
- startContext: { }
- - camel:
- createComponent:
- name: amazonSQSClient
- file: amazonSQSClient.groovy
+ options:
+ queues: "${aws.sqs.queueName}"
- camel:
jbang:
run:
@@ -41,8 +35,8 @@ actions:
response:
status: 200
- receive:
- endpoint: |
- camel:aws2-sqs:${aws.sqs.queueName}?amazonSQSClient=#amazonSQSClient
+ endpoint: >-
+ camel:aws2-sqs:${aws.sqs.queueName}?amazonSQSClient=#sqsClient
message:
body:
data: "${news.message}"