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/02 14:07:28 UTC

[camel] 04/06: CAMEL-16171 - Add uri-endpoint-override options to all AWS2 components - AWS2-MSK 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 c71de281c237b19b0c0ffa3b7192cecc8eb21d43
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Mar 2 15:00:24 2021 +0100

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

diff --git a/components/camel-aws2-msk/src/test/java/org/apache/camel/component/aws2/msk/MSKComponentConfigurationTest.java b/components/camel-aws2-msk/src/test/java/org/apache/camel/component/aws2/msk/MSKComponentConfigurationTest.java
index af263dc..135e0de 100644
--- a/components/camel-aws2-msk/src/test/java/org/apache/camel/component/aws2/msk/MSKComponentConfigurationTest.java
+++ b/components/camel-aws2-msk/src/test/java/org/apache/camel/component/aws2/msk/MSKComponentConfigurationTest.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 MSKComponentConfigurationTest extends CamelTestSupport {
 
@@ -67,4 +68,20 @@ public class MSKComponentConfigurationTest extends CamelTestSupport {
         assertEquals("localhost", endpoint.getConfiguration().getProxyHost());
         assertEquals(Integer.valueOf(9000), endpoint.getConfiguration().getProxyPort());
     }
+
+    @Test
+    public void createEndpointWithOverride() throws Exception {
+        MSK2Component component = context.getComponent("aws2-msk", MSK2Component.class);
+        component.getConfiguration().setAccessKey("XXX");
+        component.getConfiguration().setSecretKey("YYY");
+        component.getConfiguration().setRegion(Region.US_WEST_1.toString());
+        MSK2Endpoint endpoint
+                = (MSK2Endpoint) component.createEndpoint("aws2-msk://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());
+    }
 }