From 95b9d90a7b6bf1c0cd53775628dc73dae2148697 Mon Sep 17 00:00:00 2001 From: Christoph Deppisch Date: Mon, 2 Dec 2024 21:02:45 +0100 Subject: [PATCH] Auto create AWS clients for LocalStack Testcontainers - Support a set of clients that get created automatically to access the services on the LocalStack Testcontainers instance --- connectors/citrus-testcontainers/pom.xml | 22 +++++++ .../testcontainers/aws2/ClientFactory.java | 60 +++++++++++++++++++ .../aws2/LocalStackContainer.java | 33 ++++++++++ .../aws2/LocalStackSettings.java | 13 ++++ .../aws2/StartLocalStackAction.java | 35 +++++++++++ .../client/DefaultClientFactoryFinder.java | 36 +++++++++++ .../aws2/client/DynamoDbClientFactory.java | 45 ++++++++++++++ .../aws2/client/S3ClientFactory.java | 46 ++++++++++++++ .../aws2/client/SnsClientFactory.java | 45 ++++++++++++++ .../aws2/client/SqsClientFactory.java | 45 ++++++++++++++ .../testcontainers/xml/Start.java | 14 +++++ .../testcontainers/yaml/Start.java | 13 ++++ pom.xml | 20 ++++++- .../citrus-testcase-4.5.0-SNAPSHOT.xsd | 1 + .../schema/xml/testcase/citrus-testcase.xsd | 1 + 15 files changed, 428 insertions(+), 1 deletion(-) create mode 100644 connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/ClientFactory.java create mode 100644 connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/client/DefaultClientFactoryFinder.java create mode 100644 connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/client/DynamoDbClientFactory.java create mode 100644 connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/client/S3ClientFactory.java create mode 100644 connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/client/SnsClientFactory.java create mode 100644 connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/client/SqsClientFactory.java diff --git a/connectors/citrus-testcontainers/pom.xml b/connectors/citrus-testcontainers/pom.xml index 0ac5961d3e..83990718af 100644 --- a/connectors/citrus-testcontainers/pom.xml +++ b/connectors/citrus-testcontainers/pom.xml @@ -56,6 +56,28 @@ commons-dbcp2 + + + software.amazon.awssdk + s3 + provided + + + software.amazon.awssdk + sqs + provided + + + software.amazon.awssdk + sns + provided + + + software.amazon.awssdk + dynamodb + provided + + io.quarkus diff --git a/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/ClientFactory.java b/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/ClientFactory.java new file mode 100644 index 0000000000..59fba7fe4c --- /dev/null +++ b/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/ClientFactory.java @@ -0,0 +1,60 @@ +/* + * Copyright the original author or authors. + * + * Licensed 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.citrusframework.testcontainers.aws2; + +import java.util.Optional; + +import org.citrusframework.spi.ReferenceResolver; +import org.citrusframework.testcontainers.aws2.client.DefaultClientFactoryFinder; + +@FunctionalInterface +public interface ClientFactory { + + /** + * Create client for given LocalStackContainer. + * @param container + * @return + */ + T createClient(LocalStackContainer container); + + /** + * Checks if created client is suitable for given service. + * @param service + * @return + */ + default boolean supports(LocalStackContainer.Service service) { + return service != null; + } + + static Optional> lookup(ReferenceResolver referenceResolver, LocalStackContainer.Service service) { + Optional> clientFactoryBean = referenceResolver.resolveAll(ClientFactory.class).values() + .stream() + .filter(factory -> factory.supports(service)) + .findFirst() + .map(factory -> (ClientFactory) factory); + + if (clientFactoryBean.isPresent()) { + return clientFactoryBean; + } + + return lookup(service); + } + + static Optional> lookup(LocalStackContainer.Service service) { + return new DefaultClientFactoryFinder().find(service); + } +} diff --git a/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/LocalStackContainer.java b/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/LocalStackContainer.java index d1d411fca7..e987eff1cf 100644 --- a/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/LocalStackContainer.java +++ b/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/LocalStackContainer.java @@ -21,7 +21,10 @@ import java.net.URISyntaxException; import java.net.UnknownHostException; import java.util.Arrays; +import java.util.HashMap; import java.util.HashSet; +import java.util.Map; +import java.util.Optional; import java.util.Properties; import java.util.Set; import java.util.stream.Collectors; @@ -45,6 +48,8 @@ public class LocalStackContainer extends GenericContainer { private static final String DOCKER_IMAGE_TAG = LocalStackSettings.getVersion(); private final Set services = new HashSet<>(); + private final Map clients = new HashMap<>(); + private String secretKey = "secretkey"; private String accessKey = "accesskey"; private String region = Region.US_EAST_1.id(); @@ -183,6 +188,34 @@ public Service[] getServices() { return services.toArray(Service[]::new); } + public void addClient(Service service, Object client) { + this.clients.put(service, client); + } + + public T getClient(Service service) { + if (!services.contains(service)) { + throw new CitrusRuntimeException("Unable to create client for disabled service: %s".formatted(service)); + } + + Object client = clients.get(service); + if (client != null) { + return (T) client; + } + + // lazy load client for this container + Optional> clientFactory = ClientFactory.lookup(service); + if (clientFactory.isPresent()) { + client = clientFactory.get().createClient(this); + clients.put(service, client); + } + + if (client != null) { + return (T) client; + } + + throw new CitrusRuntimeException("Missing client for service %s".formatted(service)); + } + public enum Service { CLOUD_WATCH("cloudwatch"), DYNAMODB("dynamodb"), diff --git a/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/LocalStackSettings.java b/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/LocalStackSettings.java index 17c3e28a12..c174d09063 100644 --- a/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/LocalStackSettings.java +++ b/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/LocalStackSettings.java @@ -49,6 +49,10 @@ public class LocalStackSettings { private static final String CONTAINER_NAME_ENV = LOCALSTACK_ENV_PREFIX + "CONTAINER_NAME"; public static final String CONTAINER_NAME_DEFAULT = "aws2Container"; + private static final String AUTO_CREATE_CLIENTS_PROPERTY = LOCALSTACK_PROPERTY_PREFIX + "auto.create.clients"; + private static final String AUTO_CREATE_CLIENTS_ENV = LOCALSTACK_ENV_PREFIX + "AUTO_CREATE_CLIENTS"; + public static final String AUTO_CREATE_CLIENTS_DEFAULT = "true"; + private static final String STARTUP_TIMEOUT_PROPERTY = LOCALSTACK_PROPERTY_PREFIX + "startup.timeout"; private static final String STARTUP_TIMEOUT_ENV = LOCALSTACK_ENV_PREFIX + "STARTUP_TIMEOUT"; @@ -100,6 +104,15 @@ public static String getContainerName() { System.getenv(CONTAINER_NAME_ENV) != null ? System.getenv(CONTAINER_NAME_ENV) : CONTAINER_NAME_DEFAULT); } + /** + * Auto create clients for enabled services and add them as beans to the Citrus registry. + * @return the enabled/disabled flag. + */ + public static boolean isAutoCreateClients() { + return Boolean.parseBoolean(System.getProperty(AUTO_CREATE_CLIENTS_PROPERTY, + System.getenv(AUTO_CREATE_CLIENTS_ENV) != null ? System.getenv(AUTO_CREATE_CLIENTS_ENV) : AUTO_CREATE_CLIENTS_DEFAULT)); + } + /** * Time in seconds to wait for the container to startup and accept connections. * @return diff --git a/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/StartLocalStackAction.java b/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/StartLocalStackAction.java index fce9a94183..36c744bb51 100644 --- a/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/StartLocalStackAction.java +++ b/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/StartLocalStackAction.java @@ -18,22 +18,50 @@ import java.util.Arrays; import java.util.HashSet; +import java.util.Optional; import java.util.Set; import org.citrusframework.context.TestContext; import org.citrusframework.testcontainers.TestContainersSettings; import org.citrusframework.testcontainers.actions.StartTestcontainersAction; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testcontainers.containers.wait.strategy.Wait; public class StartLocalStackAction extends StartTestcontainersAction { + /** Logger */ + private static final Logger logger = LoggerFactory.getLogger(StartLocalStackAction.class); + + private final boolean autoCreateClients; + public StartLocalStackAction(Builder builder) { super(builder); + this.autoCreateClients = builder.autoCreateClients; } @Override protected void exposeConnectionSettings(LocalStackContainer container, TestContext context) { LocalStackSettings.exposeConnectionSettings(container, serviceName, context); + + if (autoCreateClients) { + for (LocalStackContainer.Service service : container.getServices()) { + String clientName = "%sClient".formatted(service.getServiceName()); + if (context.getReferenceResolver().isResolvable(clientName)) { + // client bean with same name already exists - do not overwrite + continue; + } + + Optional> clientFactory = ClientFactory.lookup(context.getReferenceResolver(), service); + if (clientFactory.isPresent()) { + Object client = clientFactory.get().createClient(container); + container.addClient(service, client); + context.getReferenceResolver().bind(clientName, client); + } else { + logger.warn("Missing client factory for service '%s' - no client created for this service".formatted(service)); + } + } + } } /** @@ -45,6 +73,8 @@ public static class Builder extends AbstractBuilder services = new HashSet<>(); + private boolean autoCreateClients = LocalStackSettings.isAutoCreateClients(); + public Builder() { withStartupTimeout(LocalStackSettings.getStartupTimeout()); } @@ -69,6 +99,11 @@ public Builder withServices(Set services) { return this; } + public Builder autoCreateClients(boolean enabled) { + this.autoCreateClients = enabled; + return this; + } + @Override protected void prepareBuild() { if (containerName == null) { diff --git a/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/client/DefaultClientFactoryFinder.java b/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/client/DefaultClientFactoryFinder.java new file mode 100644 index 0000000000..17216218e8 --- /dev/null +++ b/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/client/DefaultClientFactoryFinder.java @@ -0,0 +1,36 @@ +/* + * Copyright the original author or authors. + * + * Licensed 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.citrusframework.testcontainers.aws2.client; + +import java.util.Optional; + +import org.citrusframework.testcontainers.aws2.ClientFactory; +import org.citrusframework.testcontainers.aws2.LocalStackContainer; + +public class DefaultClientFactoryFinder { + + public Optional> find(LocalStackContainer.Service service) { + return switch (service) { + case S3 -> Optional.of(new S3ClientFactory()); + case SQS -> Optional.of(new SqsClientFactory()); + case SNS -> Optional.of(new SnsClientFactory()); + case DYNAMODB -> Optional.of(new DynamoDbClientFactory()); + default -> Optional.empty(); + }; + } + +} diff --git a/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/client/DynamoDbClientFactory.java b/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/client/DynamoDbClientFactory.java new file mode 100644 index 0000000000..a89bed24d3 --- /dev/null +++ b/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/client/DynamoDbClientFactory.java @@ -0,0 +1,45 @@ +/* + * Copyright the original author or authors. + * + * Licensed 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.citrusframework.testcontainers.aws2.client; + +import org.citrusframework.testcontainers.aws2.ClientFactory; +import org.citrusframework.testcontainers.aws2.LocalStackContainer; +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; + +public class DynamoDbClientFactory implements ClientFactory { + + @Override + public DynamoDbClient createClient(LocalStackContainer container) { + return DynamoDbClient.builder() + .endpointOverride(container.getServiceEndpoint()) + .credentialsProvider( + StaticCredentialsProvider.create( + AwsBasicCredentials.create(container.getAccessKey(), container.getSecretKey()) + ) + ) + .region(Region.of(container.getRegion())) + .build(); + } + + @Override + public boolean supports(LocalStackContainer.Service service) { + return LocalStackContainer.Service.DYNAMODB == service; + } +} diff --git a/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/client/S3ClientFactory.java b/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/client/S3ClientFactory.java new file mode 100644 index 0000000000..7c46d270f9 --- /dev/null +++ b/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/client/S3ClientFactory.java @@ -0,0 +1,46 @@ +/* + * Copyright the original author or authors. + * + * Licensed 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.citrusframework.testcontainers.aws2.client; + +import org.citrusframework.testcontainers.aws2.ClientFactory; +import org.citrusframework.testcontainers.aws2.LocalStackContainer; +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; + +public class S3ClientFactory implements ClientFactory { + + @Override + public S3Client createClient(LocalStackContainer container) { + return S3Client.builder() + .endpointOverride(container.getServiceEndpoint()) + .credentialsProvider( + StaticCredentialsProvider.create( + AwsBasicCredentials.create(container.getAccessKey(), container.getSecretKey()) + ) + ) + .forcePathStyle(true) + .region(Region.of(container.getRegion())) + .build(); + } + + @Override + public boolean supports(LocalStackContainer.Service service) { + return LocalStackContainer.Service.S3 == service; + } +} diff --git a/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/client/SnsClientFactory.java b/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/client/SnsClientFactory.java new file mode 100644 index 0000000000..008fcb490a --- /dev/null +++ b/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/client/SnsClientFactory.java @@ -0,0 +1,45 @@ +/* + * Copyright the original author or authors. + * + * Licensed 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.citrusframework.testcontainers.aws2.client; + +import org.citrusframework.testcontainers.aws2.ClientFactory; +import org.citrusframework.testcontainers.aws2.LocalStackContainer; +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; + +public class SnsClientFactory implements ClientFactory { + + @Override + public SnsClient createClient(LocalStackContainer container) { + return SnsClient.builder() + .endpointOverride(container.getServiceEndpoint()) + .credentialsProvider( + StaticCredentialsProvider.create( + AwsBasicCredentials.create(container.getAccessKey(), container.getSecretKey()) + ) + ) + .region(Region.of(container.getRegion())) + .build(); + } + + @Override + public boolean supports(LocalStackContainer.Service service) { + return LocalStackContainer.Service.SNS == service; + } +} diff --git a/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/client/SqsClientFactory.java b/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/client/SqsClientFactory.java new file mode 100644 index 0000000000..73bb0d3636 --- /dev/null +++ b/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/aws2/client/SqsClientFactory.java @@ -0,0 +1,45 @@ +/* + * Copyright the original author or authors. + * + * Licensed 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.citrusframework.testcontainers.aws2.client; + +import org.citrusframework.testcontainers.aws2.ClientFactory; +import org.citrusframework.testcontainers.aws2.LocalStackContainer; +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; + +public class SqsClientFactory implements ClientFactory { + + @Override + public SqsClient createClient(LocalStackContainer container) { + return SqsClient.builder() + .endpointOverride(container.getServiceEndpoint()) + .credentialsProvider( + StaticCredentialsProvider.create( + AwsBasicCredentials.create(container.getAccessKey(), container.getSecretKey()) + ) + ) + .region(Region.of(container.getRegion())) + .build(); + } + + @Override + public boolean supports(LocalStackContainer.Service service) { + return LocalStackContainer.Service.SQS == service; + } +} diff --git a/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/xml/Start.java b/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/xml/Start.java index 737b459fff..49c46043bf 100644 --- a/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/xml/Start.java +++ b/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/xml/Start.java @@ -35,6 +35,7 @@ import org.citrusframework.testcontainers.actions.AbstractTestcontainersAction; import org.citrusframework.testcontainers.actions.StartTestcontainersAction; import org.citrusframework.testcontainers.aws2.LocalStackContainer; +import org.citrusframework.testcontainers.aws2.LocalStackSettings; import org.citrusframework.testcontainers.aws2.StartLocalStackAction; import org.citrusframework.testcontainers.kafka.StartKafkaAction; import org.citrusframework.testcontainers.mongodb.StartMongoDBAction; @@ -61,6 +62,8 @@ public void setLocalStack(LocalStack container) { builder.version(container.getVersion()); } + builder.autoCreateClients(container.isAutoCreateClients()); + configureStartActionBuilder(builder, container); if (container.getServices() != null) { @@ -438,6 +441,9 @@ public static class LocalStack extends Container { @XmlAttribute protected String version; + @XmlAttribute(name = "auto-create-clients") + protected boolean autoCreateClients = LocalStackSettings.isAutoCreateClients(); + @XmlAttribute(name = "services") protected String serviceList; @@ -469,6 +475,14 @@ public void setServices(Services services) { this.services = services; } + public boolean isAutoCreateClients() { + return autoCreateClients; + } + + public void setAutoCreateClients(boolean autoCreateClients) { + this.autoCreateClients = autoCreateClients; + } + @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "services" diff --git a/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/yaml/Start.java b/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/yaml/Start.java index 8426c99249..6b33dcaea4 100644 --- a/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/yaml/Start.java +++ b/connectors/citrus-testcontainers/src/main/java/org/citrusframework/testcontainers/yaml/Start.java @@ -27,6 +27,7 @@ import org.citrusframework.testcontainers.actions.AbstractTestcontainersAction; import org.citrusframework.testcontainers.actions.StartTestcontainersAction; import org.citrusframework.testcontainers.aws2.LocalStackContainer; +import org.citrusframework.testcontainers.aws2.LocalStackSettings; import org.citrusframework.testcontainers.aws2.StartLocalStackAction; import org.citrusframework.testcontainers.kafka.StartKafkaAction; import org.citrusframework.testcontainers.mongodb.StartMongoDBAction; @@ -50,6 +51,8 @@ public void setLocalstack(LocalStack container) { builder.version(container.getVersion()); } + builder.autoCreateClients(container.isAutoCreateClients()); + configureStartActionBuilder(builder, container); if (container.getServices() != null) { @@ -309,10 +312,20 @@ public void setVolumeMounts(List volumeMounts) { public static class LocalStack extends Container { + protected boolean autoCreateClients = LocalStackSettings.isAutoCreateClients(); + protected String version; protected List services; + public boolean isAutoCreateClients() { + return autoCreateClients; + } + + public void setAutoCreateClients(boolean autoCreateClients) { + this.autoCreateClients = autoCreateClients; + } + public String getVersion() { return version; } diff --git a/pom.xml b/pom.xml index 990f6faa07..97e17d30f9 100644 --- a/pom.xml +++ b/pom.xml @@ -622,7 +622,25 @@ software.amazon.awssdk s3 ${aws-java-sdk2.version} - test + provided + + + software.amazon.awssdk + sqs + ${aws-java-sdk2.version} + provided + + + software.amazon.awssdk + sns + ${aws-java-sdk2.version} + provided + + + software.amazon.awssdk + dynamodb + ${aws-java-sdk2.version} + provided diff --git a/runtime/citrus-xml/src/main/resources/org/citrusframework/schema/xml/testcase/citrus-testcase-4.5.0-SNAPSHOT.xsd b/runtime/citrus-xml/src/main/resources/org/citrusframework/schema/xml/testcase/citrus-testcase-4.5.0-SNAPSHOT.xsd index a27f4fb2b0..b0e9497e21 100644 --- a/runtime/citrus-xml/src/main/resources/org/citrusframework/schema/xml/testcase/citrus-testcase-4.5.0-SNAPSHOT.xsd +++ b/runtime/citrus-xml/src/main/resources/org/citrusframework/schema/xml/testcase/citrus-testcase-4.5.0-SNAPSHOT.xsd @@ -1981,6 +1981,7 @@ + diff --git a/runtime/citrus-xml/src/main/resources/org/citrusframework/schema/xml/testcase/citrus-testcase.xsd b/runtime/citrus-xml/src/main/resources/org/citrusframework/schema/xml/testcase/citrus-testcase.xsd index a27f4fb2b0..b0e9497e21 100644 --- a/runtime/citrus-xml/src/main/resources/org/citrusframework/schema/xml/testcase/citrus-testcase.xsd +++ b/runtime/citrus-xml/src/main/resources/org/citrusframework/schema/xml/testcase/citrus-testcase.xsd @@ -1981,6 +1981,7 @@ +