This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit 04470cb180df89adb35c0c1eace30300fa9172b3 Author: Christophe Willemsen <willemsen.christo...@gmail.com> AuthorDate: Mon Jul 20 23:22:43 2020 +0200 CAMEL-15310 failing test --- .../component/aws/s3/S3ComponentClientRegistryTest.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/components/camel-aws-s3/src/test/java/org/apache/camel/component/aws/s3/S3ComponentClientRegistryTest.java b/components/camel-aws-s3/src/test/java/org/apache/camel/component/aws/s3/S3ComponentClientRegistryTest.java index 2bf125b..edac0a4 100644 --- a/components/camel-aws-s3/src/test/java/org/apache/camel/component/aws/s3/S3ComponentClientRegistryTest.java +++ b/components/camel-aws-s3/src/test/java/org/apache/camel/component/aws/s3/S3ComponentClientRegistryTest.java @@ -19,11 +19,7 @@ package org.apache.camel.component.aws.s3; import org.apache.camel.test.junit5.CamelTestSupport; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.*; public class S3ComponentClientRegistryTest extends CamelTestSupport { @@ -52,4 +48,15 @@ public class S3ComponentClientRegistryTest extends CamelTestSupport { assertThrows(IllegalArgumentException.class, () -> component.createEndpoint("aws-s3://MyBucket")); } + + @Test + public void createEndpointWithCredentialsAndClientExistInRegistry() throws Exception { + AmazonS3ClientMock clientMock = new AmazonS3ClientMock(); + context.getRegistry().bind("amazonS3Client", clientMock); + S3Component component = context.getComponent("aws-s3", S3Component.class); + S3Endpoint endpoint = (S3Endpoint)component.createEndpoint("aws-s3://MyBucket?accessKey=RAW(XXX)&secretKey=RAW(XXX)"); + + assertEquals("MyBucket", endpoint.getConfiguration().getBucketName()); + assertNotSame(clientMock, endpoint.getConfiguration().getAmazonS3Client()); + } }