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/02/11 06:33:44 UTC

[camel] branch 16079-3.7.x created (now 8377680)

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a change to branch 16079-3.7.x
in repository https://gitbox.apache.org/repos/asf/camel.git.


      at 8377680  CAMEL-16079 - aws-sns2 does not recognise FIFO queue configured though arn

This branch includes the following new commits:

     new ac0fdd2  CAMEL-16079 - aws-sns2 does not recognise FIFO queue configured though arn
     new 8377680  CAMEL-16079 - aws-sns2 does not recognise FIFO queue configured though arn

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[camel] 01/02: CAMEL-16079 - aws-sns2 does not recognise FIFO queue configured though arn

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch 16079-3.7.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit ac0fdd2b5717d56cb2c005cb5383669c628bf0fc
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Feb 11 06:55:39 2021 +0100

    CAMEL-16079 - aws-sns2 does not recognise FIFO queue configured though arn
---
 .../camel/component/aws2/sns/Sns2Configuration.java |  6 ++++--
 .../aws2/sns/SnsComponentConfigurationTest.java     | 21 +++++++++++++++++++++
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Configuration.java b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Configuration.java
index ab5a42c..fb957d1 100644
--- a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Configuration.java
+++ b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Configuration.java
@@ -351,8 +351,10 @@ public class Sns2Configuration implements Cloneable {
     boolean isFifoTopic() {
         // AWS docs suggest this is valid derivation.
         // FIFO topic names must end with .fifo, and standard topic cannot
-        if (topicName.endsWith(".fifo")) {
-            return true;
+    	if (ObjectHelper.isNotEmpty(topicName)) {
+            if (topicName.endsWith(".fifo")) {
+                return true;
+            }
         }
         if (ObjectHelper.isNotEmpty(topicArn)) {
             return topicArn.endsWith(".fifo");
diff --git a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsComponentConfigurationTest.java b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsComponentConfigurationTest.java
index e2238e5..399467e 100644
--- a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsComponentConfigurationTest.java
+++ b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsComponentConfigurationTest.java
@@ -21,6 +21,7 @@ import org.junit.jupiter.api.Test;
 import software.amazon.awssdk.core.Protocol;
 import software.amazon.awssdk.regions.Region;
 
+import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
@@ -227,4 +228,24 @@ public class SnsComponentConfigurationTest extends CamelTestSupport {
         Sns2Component component = context.getComponent("aws2-sns", Sns2Component.class);
         component.createEndpoint("aws2-sns://MyTopic?amazonSNSClient=#amazonSNSClient");
     }
+    
+    @Test
+    public void createEndpointWithArnConfiguration() throws Exception {
+        AmazonSNSClientMock mock = new AmazonSNSClientMock();
+
+        context.getRegistry().bind("amazonSNSClient", mock);
+
+        Sns2Component component = context.getComponent("aws2-sns", Sns2Component.class);
+        Sns2Endpoint endpoint = (Sns2Endpoint) component
+                .createEndpoint("aws2-sns://arn:aws:sns:eu-west-1:123456789:somewhere-over-the-rainbow?amazonSNSClient=#amazonSNSClient&accessKey=xxx&secretKey=yyy");
+
+        assertEquals("arn:aws:sns:eu-west-1:123456789:somewhere-over-the-rainbow", endpoint.getConfiguration().getTopicArn());
+        assertEquals("xxx", endpoint.getConfiguration().getAccessKey());
+        assertEquals("yyy", endpoint.getConfiguration().getSecretKey());
+        assertNotNull(endpoint.getConfiguration().getAmazonSNSClient());
+        assertNull(endpoint.getConfiguration().getTopicName());
+        assertNull(endpoint.getConfiguration().getSubject());
+        assertNull(endpoint.getConfiguration().getPolicy());
+        assertFalse(endpoint.getConfiguration().isFifoTopic());
+    }
 }


[camel] 02/02: CAMEL-16079 - aws-sns2 does not recognise FIFO queue configured though arn

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch 16079-3.7.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 837768043b1b1f29acc9692795efc1a2845ec2d8
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Feb 11 06:59:38 2021 +0100

    CAMEL-16079 - aws-sns2 does not recognise FIFO queue configured though arn
---
 .../org/apache/camel/component/aws2/sns/Sns2Configuration.java     | 2 +-
 .../camel/component/aws2/sns/SnsComponentConfigurationTest.java    | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Configuration.java b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Configuration.java
index fb957d1..c0799e3 100644
--- a/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Configuration.java
+++ b/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Configuration.java
@@ -351,7 +351,7 @@ public class Sns2Configuration implements Cloneable {
     boolean isFifoTopic() {
         // AWS docs suggest this is valid derivation.
         // FIFO topic names must end with .fifo, and standard topic cannot
-    	if (ObjectHelper.isNotEmpty(topicName)) {
+        if (ObjectHelper.isNotEmpty(topicName)) {
             if (topicName.endsWith(".fifo")) {
                 return true;
             }
diff --git a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsComponentConfigurationTest.java b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsComponentConfigurationTest.java
index 399467e..5b980b8 100644
--- a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsComponentConfigurationTest.java
+++ b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/SnsComponentConfigurationTest.java
@@ -21,8 +21,8 @@ import org.junit.jupiter.api.Test;
 import software.amazon.awssdk.core.Protocol;
 import software.amazon.awssdk.regions.Region;
 
-import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -228,7 +228,7 @@ public class SnsComponentConfigurationTest extends CamelTestSupport {
         Sns2Component component = context.getComponent("aws2-sns", Sns2Component.class);
         component.createEndpoint("aws2-sns://MyTopic?amazonSNSClient=#amazonSNSClient");
     }
-    
+
     @Test
     public void createEndpointWithArnConfiguration() throws Exception {
         AmazonSNSClientMock mock = new AmazonSNSClientMock();
@@ -237,7 +237,8 @@ public class SnsComponentConfigurationTest extends CamelTestSupport {
 
         Sns2Component component = context.getComponent("aws2-sns", Sns2Component.class);
         Sns2Endpoint endpoint = (Sns2Endpoint) component
-                .createEndpoint("aws2-sns://arn:aws:sns:eu-west-1:123456789:somewhere-over-the-rainbow?amazonSNSClient=#amazonSNSClient&accessKey=xxx&secretKey=yyy");
+                .createEndpoint(
+                        "aws2-sns://arn:aws:sns:eu-west-1:123456789:somewhere-over-the-rainbow?amazonSNSClient=#amazonSNSClient&accessKey=xxx&secretKey=yyy");
 
         assertEquals("arn:aws:sns:eu-west-1:123456789:somewhere-over-the-rainbow", endpoint.getConfiguration().getTopicArn());
         assertEquals("xxx", endpoint.getConfiguration().getAccessKey());