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 2021/03/04 12:12:08 UTC

[camel] 04/06: CAMEL-16171 - Add uri-endpoint-override options to all AWS2 components - AWS2-STS component

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 2204819cface5320439a9e4d863b913b95d57449
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Mar 4 11:34:45 2021 +0100

    CAMEL-16171 - Add uri-endpoint-override options to all AWS2 components - AWS2-STS component
---
 .../aws2/sts/STS2ComponentConfigurationTest.java        | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/components/camel-aws2-sts/src/test/java/org/apache/camel/component/aws2/sts/STS2ComponentConfigurationTest.java b/components/camel-aws2-sts/src/test/java/org/apache/camel/component/aws2/sts/STS2ComponentConfigurationTest.java
index 8d52a0c..0e4885d 100644
--- a/components/camel-aws2-sts/src/test/java/org/apache/camel/component/aws2/sts/STS2ComponentConfigurationTest.java
+++ b/components/camel-aws2-sts/src/test/java/org/apache/camel/component/aws2/sts/STS2ComponentConfigurationTest.java
@@ -22,6 +22,7 @@ import software.amazon.awssdk.core.Protocol;
 import software.amazon.awssdk.regions.Region;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class STS2ComponentConfigurationTest extends CamelTestSupport {
 
@@ -68,4 +69,20 @@ public class STS2ComponentConfigurationTest extends CamelTestSupport {
         assertEquals(Integer.valueOf(9000), endpoint.getConfiguration().getProxyPort());
     }
 
+
+    @Test
+    public void createEndpointWithOverride() throws Exception {
+        STS2Component component = context.getComponent("aws2-sts", STS2Component.class);
+        component.getConfiguration().setAccessKey("XXX");
+        component.getConfiguration().setSecretKey("YYY");
+        component.getConfiguration().setRegion(Region.US_WEST_1.toString());
+        STS2Endpoint endpoint
+                = (STS2Endpoint) component.createEndpoint("aws2-sts://label?accessKey=xxxxxx&secretKey=yyyyy&region=US_EAST_1&overrideEndpoint=true&uriEndpointOverride=http://localhost:9090");
+
+        assertEquals("xxxxxx", endpoint.getConfiguration().getAccessKey());
+        assertEquals("yyyyy", endpoint.getConfiguration().getSecretKey());
+        assertEquals("US_EAST_1", endpoint.getConfiguration().getRegion());
+        assertTrue(endpoint.getConfiguration().isOverrideEndpoint());
+        assertEquals("http://localhost:9090", endpoint.getConfiguration().getUriEndpointOverride());
+    }
 }