This is an automated email from the ASF dual-hosted git repository. github-bot pushed a commit to branch camel-main in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit d7456791874c3709cdd568628ab26275e1196b03 Author: JiriOndrusek <ondrusek.j...@gmail.com> AuthorDate: Fri Jul 21 13:46:36 2023 +0200 Fixed aws2-kinesis --- .../component/aws2/kinesis/it/Aws2KinesisResource.java | 6 +++++- .../component/aws2/kinesis/it/Aws2KinesisRoutes.java | 9 +++++++++ .../aws2/kinesis/it/Aws2KinesisTestEnvCustomizer.java | 15 +++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/integration-test-groups/aws2/aws2-kinesis/src/main/java/org/apache/camel/quarkus/component/aws2/kinesis/it/Aws2KinesisResource.java b/integration-test-groups/aws2/aws2-kinesis/src/main/java/org/apache/camel/quarkus/component/aws2/kinesis/it/Aws2KinesisResource.java index d3a556d253..fdbeeff70a 100644 --- a/integration-test-groups/aws2/aws2-kinesis/src/main/java/org/apache/camel/quarkus/component/aws2/kinesis/it/Aws2KinesisResource.java +++ b/integration-test-groups/aws2/aws2-kinesis/src/main/java/org/apache/camel/quarkus/component/aws2/kinesis/it/Aws2KinesisResource.java @@ -45,6 +45,9 @@ public class Aws2KinesisResource extends BaseAws2Resource { @ConfigProperty(name = "aws-kinesis.stream-name") String streamName; + @ConfigProperty(name = "aws-kinesis.stream-name-for-default-credentials") + String streamNameForDefaultCredentials; + @Inject ProducerTemplate producerTemplate; @@ -81,7 +84,8 @@ public class Aws2KinesisResource extends BaseAws2Resource { } private String componentUri() { - return "aws2-kinesis://" + streamName + "?useDefaultCredentialsProvider=" + isUseDefaultCredentials(); + return "aws2-kinesis://" + (isUseDefaultCredentials() ? streamNameForDefaultCredentials : streamName) + + "?useDefaultCredentialsProvider=" + isUseDefaultCredentials(); } } diff --git a/integration-test-groups/aws2/aws2-kinesis/src/main/java/org/apache/camel/quarkus/component/aws2/kinesis/it/Aws2KinesisRoutes.java b/integration-test-groups/aws2/aws2-kinesis/src/main/java/org/apache/camel/quarkus/component/aws2/kinesis/it/Aws2KinesisRoutes.java index bf6433ef9f..5b6a701da5 100644 --- a/integration-test-groups/aws2/aws2-kinesis/src/main/java/org/apache/camel/quarkus/component/aws2/kinesis/it/Aws2KinesisRoutes.java +++ b/integration-test-groups/aws2/aws2-kinesis/src/main/java/org/apache/camel/quarkus/component/aws2/kinesis/it/Aws2KinesisRoutes.java @@ -32,6 +32,9 @@ public class Aws2KinesisRoutes extends RouteBuilder { @ConfigProperty(name = "aws-kinesis.stream-name") String streamName; + @ConfigProperty(name = "aws-kinesis.stream-name-for-default-credentials") + String streamNameForDefaultCredentials; + @Inject @Named("aws2KinesisMessages") Queue<String> aws2KinesisMessages; @@ -40,10 +43,16 @@ public class Aws2KinesisRoutes extends RouteBuilder { return "aws2-kinesis://" + streamName; } + private String componentUriForDefaultCredentials() { + return "aws2-kinesis://" + streamNameForDefaultCredentials; + } + @Override public void configure() throws Exception { from(componentUri()) .process(exchange -> aws2KinesisMessages.add(exchange.getMessage().getBody(String.class))); + from(componentUriForDefaultCredentials()) + .process(exchange -> aws2KinesisMessages.add(exchange.getMessage().getBody(String.class))); } static class Producers { diff --git a/integration-test-groups/aws2/aws2-kinesis/src/test/java/org/apache/camel/quarkus/component/aws2/kinesis/it/Aws2KinesisTestEnvCustomizer.java b/integration-test-groups/aws2/aws2-kinesis/src/test/java/org/apache/camel/quarkus/component/aws2/kinesis/it/Aws2KinesisTestEnvCustomizer.java index 4486af899c..99d7718a8c 100644 --- a/integration-test-groups/aws2/aws2-kinesis/src/test/java/org/apache/camel/quarkus/component/aws2/kinesis/it/Aws2KinesisTestEnvCustomizer.java +++ b/integration-test-groups/aws2/aws2-kinesis/src/test/java/org/apache/camel/quarkus/component/aws2/kinesis/it/Aws2KinesisTestEnvCustomizer.java @@ -79,6 +79,8 @@ public class Aws2KinesisTestEnvCustomizer implements Aws2TestEnvCustomizer { public void customize(Aws2TestEnvContext envContext) { final String streamName = "camel-quarkus-" + RandomStringUtils.randomAlphanumeric(16).toLowerCase(Locale.ROOT); + final String streamNameForDefaultCredentials = "camel-quarkus-" + + RandomStringUtils.randomAlphanumeric(16).toLowerCase(Locale.ROOT); final String streamArn; { envContext.property("aws-kinesis.stream-name", streamName); @@ -99,6 +101,19 @@ public class Aws2KinesisTestEnvCustomizer implements Aws2TestEnvCustomizer { envContext.closeable(() -> client.deleteStream(DeleteStreamRequest.builder().streamName(streamName).build())); } + { + envContext.property("aws-kinesis.stream-name-for-default-credentials", streamNameForDefaultCredentials); + final KinesisClient client = envContext.client(Service.KINESIS, KinesisClient::builder); + client.createStream( + CreateStreamRequest.builder() + .shardCount(1) + .streamName(streamNameForDefaultCredentials) + .build()); + + envContext.closeable(() -> client + .deleteStream(DeleteStreamRequest.builder().streamName(streamNameForDefaultCredentials).build())); + } + { final S3Client s3Client = envContext.client(Service.S3, S3Client::builder);