You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2020/03/20 14:48:38 UTC

[camel] 02/03: CAMEL-14658 - Provide a simpler way to connect to a local s3 instance, added a test

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 71cde90f107f892119711b79a2175b044012324b
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Mar 20 15:42:29 2020 +0100

    CAMEL-14658 - Provide a simpler way to connect to a local s3 instance, added a test
---
 .../component/aws/s3/S3ComponentConfigurationTest.java    | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/components/camel-aws-s3/src/test/java/org/apache/camel/component/aws/s3/S3ComponentConfigurationTest.java b/components/camel-aws-s3/src/test/java/org/apache/camel/component/aws/s3/S3ComponentConfigurationTest.java
index d1e1259..43aa227 100644
--- a/components/camel-aws-s3/src/test/java/org/apache/camel/component/aws/s3/S3ComponentConfigurationTest.java
+++ b/components/camel-aws-s3/src/test/java/org/apache/camel/component/aws/s3/S3ComponentConfigurationTest.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.aws.s3;
 
+import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration;
 import com.amazonaws.regions.Regions;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
@@ -239,4 +240,18 @@ public class S3ComponentConfigurationTest extends CamelTestSupport {
         S3Component component = context.getComponent("aws-s3", S3Component.class);
         component.createEndpoint("aws-s3://MyTopic?amazonS3Client=#amazonS3Client");
     }
+    
+    @Test
+    public void createEndpointWithEndpointConfiguration() throws Exception {
+
+        EndpointConfiguration endpointConfiguration = new EndpointConfiguration("localhost", Regions.US_EAST_1.toString());
+        context.getRegistry().bind("endpointConfiguration", endpointConfiguration);
+        S3Component component = context.getComponent("aws-s3", S3Component.class);
+        S3Endpoint endpoint = (S3Endpoint)component.createEndpoint("aws-s3://MyBucket?endpointConfiguration=#endpointConfiguration&accessKey=xxx&secretKey=yyy&region=US_WEST_1");
+
+        assertEquals("MyBucket", endpoint.getConfiguration().getBucketName());
+        assertEquals("xxx", endpoint.getConfiguration().getAccessKey());
+        assertEquals("yyy", endpoint.getConfiguration().getSecretKey());
+        assertNotNull(endpoint.getConfiguration().getEndpointConfiguration());
+    }
 }