diff --git a/.github/workflows/integration-tests.yaml b/.github/workflows/integration-tests.yaml index bea929d26..f1d426281 100644 --- a/.github/workflows/integration-tests.yaml +++ b/.github/workflows/integration-tests.yaml @@ -62,7 +62,8 @@ jobs: ./mvnw clean install -DskipTests -DskipITs - name: Run Tests env: - CITRUS_TESTCONTAINERS_LOCALSTACK_IMAGE_NAME: "mirror.gcr.io/localstack/localstack" + CITRUS_TESTCONTAINERS_REGISTRY_MIRROR: "mirror.gcr.io" + CITRUS_TESTCONTAINERS_REGISTRY_MIRROR_ENABLED: "true" run: | echo "Install JBang via SDKMAN" diff --git a/pom.xml b/pom.xml index f2b09a36b..96598ff10 100644 --- a/pom.xml +++ b/pom.xml @@ -64,7 +64,7 @@ 4.9.0 - 4.5.0 + 4.5.1 7.20.1 diff --git a/tests/camel-kamelets-itest/src/test/java/EndpointAutoConfiguration.java b/tests/camel-kamelets-itest/src/test/java/EndpointAutoConfiguration.java index 390a64149..3f691e54b 100644 --- a/tests/camel-kamelets-itest/src/test/java/EndpointAutoConfiguration.java +++ b/tests/camel-kamelets-itest/src/test/java/EndpointAutoConfiguration.java @@ -15,42 +15,40 @@ * limitations under the License. */ -import java.nio.file.Path; - import org.citrusframework.annotations.CitrusConfiguration; -import org.citrusframework.camel.jbang.CamelJBangSettings; -import org.citrusframework.container.SequenceBeforeSuite; -import org.citrusframework.exceptions.CitrusRuntimeException; +import org.citrusframework.container.SequenceAfterTest; import org.citrusframework.http.server.HttpServer; import org.citrusframework.spi.BindToRegistry; import org.springframework.http.HttpStatus; +import static org.citrusframework.actions.PurgeEndpointAction.Builder.purgeEndpoints; import static org.citrusframework.http.endpoint.builder.HttpEndpoints.http; +import static org.citrusframework.jbang.actions.JBangAction.Builder.jbang; @CitrusConfiguration public class EndpointAutoConfiguration { + private final HttpServer httpServer = http() + .server() + .port(8081) + .defaultStatus(HttpStatus.CREATED) + .timeout(15000L) + .autoStart(true) + .build(); + @BindToRegistry public HttpServer httpServer() { - return http() - .server() - .port(8081) - .defaultStatus(HttpStatus.CREATED) - .timeout(120000L) - .autoStart(true) - .build(); + return httpServer; } @BindToRegistry - public SequenceBeforeSuite setup() { - // TODO: Workaround - remove when Citrus 4.5.1 is released - return SequenceBeforeSuite.Builder.beforeSuite() - .actions(context -> { - Path workDir = CamelJBangSettings.getWorkDir(); - if (!workDir.toFile().exists() && !workDir.toFile().mkdirs()) { - throw new CitrusRuntimeException("Failed to create JBang working directory: %s".formatted(workDir.toAbsolutePath().toString())); - } - }) + public SequenceAfterTest afterTest() { + return SequenceAfterTest.Builder.afterTest() + .actions( + // Workaround to stop all Camel JBang integrations after test - remove when Citrus 4.5.2 is released + jbang().app("camel").command("stop"), + purgeEndpoints().endpoint(httpServer) + ) .build(); } 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 index 3865d7c38..bc1090200 100644 --- a/tests/camel-kamelets-itest/src/test/resources/aws/kinesis/amazonKinesisClient.groovy +++ b/tests/camel-kamelets-itest/src/test/resources/aws/kinesis/amazonKinesisClient.groovy @@ -15,18 +15,11 @@ * limitations under the License. */ - -import org.apache.camel.CamelContext 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 -if (context.getReferenceResolver().isResolvable(CamelContext.class)) { - println "Destroying former KINESIS client instance" - context.getReferenceResolver().resolve(CamelContext.class).getRegistry().unbind("amazonKinesisClient") -} - KinesisClient kinesisClient = KinesisClient .builder() .endpointOverride(URI.create('${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}')) diff --git a/tests/camel-kamelets-itest/src/test/resources/aws/s3/amazonS3Client.groovy b/tests/camel-kamelets-itest/src/test/resources/aws/s3/amazonS3Client.groovy index cca1d583b..4c6470e9c 100644 --- a/tests/camel-kamelets-itest/src/test/resources/aws/s3/amazonS3Client.groovy +++ b/tests/camel-kamelets-itest/src/test/resources/aws/s3/amazonS3Client.groovy @@ -15,19 +15,11 @@ * limitations under the License. */ - - -import org.apache.camel.CamelContext 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 -if (context.getReferenceResolver().isResolvable(CamelContext.class)) { - println "Destroying former S3 client instance" - context.getReferenceResolver().resolve(CamelContext.class).getRegistry().unbind("amazonS3Client") -} - S3Client s3 = S3Client .builder() .endpointOverride(URI.create('${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}')) diff --git a/tests/camel-kamelets-itest/src/test/resources/aws/s3/aws-s3-to-http.it.yaml b/tests/camel-kamelets-itest/src/test/resources/aws/s3/aws-s3-to-http.it.yaml index 4a876d023..ef5f90e7d 100644 --- a/tests/camel-kamelets-itest/src/test/resources/aws/s3/aws-s3-to-http.it.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/aws/s3/aws-s3-to-http.it.yaml @@ -34,11 +34,6 @@ actions: http: url: "${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}" - # Purge Http service - - purge: - endpoints: - - name: "httpServer" - # Create AWS-S3 client - camel: createComponent: 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 index 2668bafea..80676fac7 100644 --- a/tests/camel-kamelets-itest/src/test/resources/aws/sqs/amazonSQSClient.groovy +++ b/tests/camel-kamelets-itest/src/test/resources/aws/sqs/amazonSQSClient.groovy @@ -15,18 +15,11 @@ * limitations under the License. */ - -import org.apache.camel.CamelContext 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 -if (context.getReferenceResolver().isResolvable(CamelContext.class)) { - println "Destroying former SQS client instance" - context.getReferenceResolver().resolve(CamelContext.class).getRegistry().unbind("amazonSQSClient") -} - SqsClient sqsClient = SqsClient .builder() .endpointOverride(URI.create('${CITRUS_TESTCONTAINERS_LOCALSTACK_SERVICE_URL}')) diff --git a/tests/camel-kamelets-itest/src/test/resources/citrus-application.properties b/tests/camel-kamelets-itest/src/test/resources/citrus-application.properties index 659448a07..2e7238045 100644 --- a/tests/camel-kamelets-itest/src/test/resources/citrus-application.properties +++ b/tests/camel-kamelets-itest/src/test/resources/citrus-application.properties @@ -1,3 +1,4 @@ +# Configure endpoints used in tests (e.g. generic Http server) citrus.java.config=EndpointAutoConfiguration citrus.file.encoding=UTF-8 @@ -7,11 +8,22 @@ citrus.type.converter=camel citrus.mail.marshaller.type=JSON citrus.cluster.type=local -citrus.camelk.max.attempts=10 citrus.camel.jbang.max.attempts=10 +# Camel JBang version (should align with version used in pom.xml) citrus.camel.jbang.version=4.9.0 +# Kamelets version (should point to the next snapshot release version) citrus.camel.jbang.kamelets.version=4.10.0-SNAPSHOT +# Tests should use local Kamelets citrus.camel.jbang.kamelets.local.dir=../../../kamelets + +# Enable dump of Camel JBang integration output citrus.camel.jbang.dump.integration.output=true + +# Workaround to stop all Camel JBang integrations after test - remove when Citrus 4.5.2 is released +citrus.camel.jbang.auto.remove.resources=false + +# Use general registry mirror for Docker images (e.g. Testcontainers) +citrus.testcontainers.registry.mirror=mirror.gcr.io +citrus.testcontainers.registry.mirror.enabled=true diff --git a/tests/camel-kamelets-itest/src/test/resources/earthquake/earthquake-to-http.it.yaml b/tests/camel-kamelets-itest/src/test/resources/earthquake/earthquake-to-http.it.yaml index eb1cc9ec3..f9b45d924 100644 --- a/tests/camel-kamelets-itest/src/test/resources/earthquake/earthquake-to-http.it.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/earthquake/earthquake-to-http.it.yaml @@ -17,11 +17,6 @@ name: earthquake-to-http-test actions: - # Purge Http service - - purge: - endpoints: - - name: "httpServer" - # Create Camel JBang integration - camel: jbang: diff --git a/tests/camel-kamelets-itest/src/test/resources/jira/jira-add-comment-sink-pipe.it.yaml b/tests/camel-kamelets-itest/src/test/resources/jira/jira-add-comment-sink-pipe.it.yaml index 108ba32c1..9041dee69 100644 --- a/tests/camel-kamelets-itest/src/test/resources/jira/jira-add-comment-sink-pipe.it.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/jira/jira-add-comment-sink-pipe.it.yaml @@ -46,11 +46,6 @@ variables: - name: "jira.password" value: "secr3t" actions: - # Purge Http service - - purge: - endpoints: - - name: "httpServer" - # Create Camel JBang integration - camel: jbang: diff --git a/tests/camel-kamelets-itest/src/test/resources/jira/jira-add-issue-sink-pipe.it.yaml b/tests/camel-kamelets-itest/src/test/resources/jira/jira-add-issue-sink-pipe.it.yaml index a36b91e27..625442a65 100644 --- a/tests/camel-kamelets-itest/src/test/resources/jira/jira-add-issue-sink-pipe.it.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/jira/jira-add-issue-sink-pipe.it.yaml @@ -42,11 +42,6 @@ variables: - name: "jira.password" value: "secr3t" actions: - # Purge Http service - - purge: - endpoints: - - name: "httpServer" - # Create Camel JBang integration - camel: jbang: diff --git a/tests/camel-kamelets-itest/src/test/resources/jira/jira-source-pipe.it.yaml b/tests/camel-kamelets-itest/src/test/resources/jira/jira-source-pipe.it.yaml index 6d4a9e579..3cc4f4895 100644 --- a/tests/camel-kamelets-itest/src/test/resources/jira/jira-source-pipe.it.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/jira/jira-source-pipe.it.yaml @@ -34,11 +34,6 @@ variables: - name: "jira.jql" value: "assignee=citrus" actions: - # Purge Http service - - purge: - endpoints: - - name: "httpServer" - # Create Camel JBang integration - camel: jbang: diff --git a/tests/camel-kamelets-itest/src/test/resources/kafka/kafka-router-pipe.it.yaml b/tests/camel-kamelets-itest/src/test/resources/kafka/kafka-router-pipe.it.yaml index 4c1333fb0..5d3a79a07 100644 --- a/tests/camel-kamelets-itest/src/test/resources/kafka/kafka-router-pipe.it.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/kafka/kafka-router-pipe.it.yaml @@ -39,11 +39,6 @@ actions: start: redpanda: {} - # Purge Http service - - purge: - endpoints: - - name: "httpServer" - # Create Camel JBang integration - camel: jbang: diff --git a/tests/camel-kamelets-itest/src/test/resources/kafka/kafka-sink-pipe.it.yaml b/tests/camel-kamelets-itest/src/test/resources/kafka/kafka-sink-pipe.it.yaml index 1223054b5..2c9baa4f3 100644 --- a/tests/camel-kamelets-itest/src/test/resources/kafka/kafka-sink-pipe.it.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/kafka/kafka-sink-pipe.it.yaml @@ -37,11 +37,6 @@ actions: start: redpanda: {} - # Purge Http service - - purge: - endpoints: - - name: "httpServer" - # Create Camel JBang integration - camel: jbang: diff --git a/tests/camel-kamelets-itest/src/test/resources/kafka/kafka-source-pipe.it.yaml b/tests/camel-kamelets-itest/src/test/resources/kafka/kafka-source-pipe.it.yaml index 10bb7c2a7..65afcdd6e 100644 --- a/tests/camel-kamelets-itest/src/test/resources/kafka/kafka-source-pipe.it.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/kafka/kafka-source-pipe.it.yaml @@ -39,11 +39,6 @@ actions: start: redpanda: {} - # Purge Http service - - purge: - endpoints: - - name: "httpServer" - # Create Camel JBang integration - camel: jbang: diff --git a/tests/camel-kamelets-itest/src/test/resources/openapi/rest-openapi-sink-add-pet.it.yaml b/tests/camel-kamelets-itest/src/test/resources/openapi/rest-openapi-sink-add-pet.it.yaml index 33ea6aa09..b3363a68d 100644 --- a/tests/camel-kamelets-itest/src/test/resources/openapi/rest-openapi-sink-add-pet.it.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/openapi/rest-openapi-sink-add-pet.it.yaml @@ -26,11 +26,6 @@ variables: - name: "openApiSpec" value: "citrus:readFile(openapi/openapi.json)" actions: - # Purge Http service - - purge: - endpoints: - - name: "httpServer" - # Create Camel JBang integration - camel: jbang: diff --git a/tests/camel-kamelets-itest/src/test/resources/openapi/rest-openapi-sink-delete-pet.it.yaml b/tests/camel-kamelets-itest/src/test/resources/openapi/rest-openapi-sink-delete-pet.it.yaml index da2d7d425..aab3f378c 100644 --- a/tests/camel-kamelets-itest/src/test/resources/openapi/rest-openapi-sink-delete-pet.it.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/openapi/rest-openapi-sink-delete-pet.it.yaml @@ -26,11 +26,6 @@ variables: - name: "openApiSpec" value: "citrus:readFile(openapi/openapi.json)" actions: - # Purge Http service - - purge: - endpoints: - - name: "httpServer" - # Create Camel JBang integration - camel: jbang: diff --git a/tests/camel-kamelets-itest/src/test/resources/slack/slack-sink-pipe.it.yaml b/tests/camel-kamelets-itest/src/test/resources/slack/slack-sink-pipe.it.yaml index cbf6eddcf..1b1c259bc 100644 --- a/tests/camel-kamelets-itest/src/test/resources/slack/slack-sink-pipe.it.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/slack/slack-sink-pipe.it.yaml @@ -32,11 +32,6 @@ variables: - name: "timer.source.period" value: "10000" actions: - # Purge Http service - - purge: - endpoints: - - name: "httpServer" - # Create Camel JBang integration - camel: jbang: diff --git a/tests/camel-kamelets-itest/src/test/resources/slack/slack-source-pipe.it.yaml b/tests/camel-kamelets-itest/src/test/resources/slack/slack-source-pipe.it.yaml index 0749806ca..e1b42d007 100644 --- a/tests/camel-kamelets-itest/src/test/resources/slack/slack-source-pipe.it.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/slack/slack-source-pipe.it.yaml @@ -30,11 +30,6 @@ variables: - name: "slack.message" value: "Camel rocks!" actions: - # Purge Http service - - purge: - endpoints: - - name: "httpServer" - # Create Camel JBang integration - camel: jbang: diff --git a/tests/camel-kamelets-itest/src/test/resources/timer/timer-to-http-pipe.it.yaml b/tests/camel-kamelets-itest/src/test/resources/timer/timer-to-http-pipe.it.yaml index aae896c1c..41816072d 100644 --- a/tests/camel-kamelets-itest/src/test/resources/timer/timer-to-http-pipe.it.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/timer/timer-to-http-pipe.it.yaml @@ -22,11 +22,6 @@ variables: - name: "timer.message" value: "Camel rocks!" actions: - # Purge Http service - - purge: - endpoints: - - name: "httpServer" - # Create Camel JBang integration - camel: jbang: diff --git a/tests/camel-kamelets-itest/src/test/resources/timer/timer-to-http.it.yaml b/tests/camel-kamelets-itest/src/test/resources/timer/timer-to-http.it.yaml index 9d723ba81..4f4753e3f 100644 --- a/tests/camel-kamelets-itest/src/test/resources/timer/timer-to-http.it.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/timer/timer-to-http.it.yaml @@ -22,11 +22,6 @@ variables: - name: "timer.message" value: "Camel rocks!" actions: - # Purge Http service - - purge: - endpoints: - - name: "httpServer" - # Create Camel JBang integration - camel: jbang: diff --git a/tests/camel-kamelets-itest/src/test/resources/transformation/data-type-action-pipe.it.yaml b/tests/camel-kamelets-itest/src/test/resources/transformation/data-type-action-pipe.it.yaml index 4ef771d1c..f7d67927c 100644 --- a/tests/camel-kamelets-itest/src/test/resources/transformation/data-type-action-pipe.it.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/transformation/data-type-action-pipe.it.yaml @@ -22,11 +22,6 @@ variables: - name: "uuid" value: "citrus:randomUUID()" actions: - # Purge Http service - - purge: - endpoints: - - name: "httpServer" - # Create Camel JBang integration - camel: jbang: diff --git a/tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.it.yaml b/tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.it.yaml index a61762645..707058938 100644 --- a/tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.it.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/transformation/extract-field-action-pipe.it.yaml @@ -24,11 +24,6 @@ variables: - name: "field.value" value: "Camel rocks!" actions: - # Purge Http service - - purge: - endpoints: - - name: "httpServer" - # Create Camel JBang integration - camel: jbang: diff --git a/tests/camel-kamelets-itest/src/test/resources/transformation/insert-field-action-pipe.it.yaml b/tests/camel-kamelets-itest/src/test/resources/transformation/insert-field-action-pipe.it.yaml index 7a83d95d4..9fb0c6779 100644 --- a/tests/camel-kamelets-itest/src/test/resources/transformation/insert-field-action-pipe.it.yaml +++ b/tests/camel-kamelets-itest/src/test/resources/transformation/insert-field-action-pipe.it.yaml @@ -26,11 +26,6 @@ variables: - name: "field.name" value: "subject" actions: - # Purge Http service - - purge: - endpoints: - - name: "httpServer" - # Create Camel JBang integration - camel: jbang: