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 bde2d5b18466d655489ef4c6d4789363dded5d11
Author: Andrea Cosentino <anco...@gmail.com>
AuthorDate: Fri Dec 18 11:49:00 2020 +0100

    CAMEL-15969 - Fixed test and add file policy
---
 .../org/apache/camel/component/aws2/sns/AmazonSNSClientMock.java    | 1 -
 .../camel/component/aws2/sns/SnsComponentConfigurationTest.java     | 6 +++---
 .../test/resources/org/apache/camel/component/aws2/sns/policy.txt   | 1 +
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/AmazonSNSClientMock.java
 
b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/AmazonSNSClientMock.java
index 7be08c5..1106520 100644
--- 
a/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/AmazonSNSClientMock.java
+++ 
b/components/camel-aws2-sns/src/test/java/org/apache/camel/component/aws2/sns/AmazonSNSClientMock.java
@@ -43,7 +43,6 @@ public class AmazonSNSClientMock implements SnsClient {
     public SetTopicAttributesResponse 
setTopicAttributes(SetTopicAttributesRequest setTopicAttributesRequest) {
         assertEquals(DEFAULT_TOPIC_ARN, setTopicAttributesRequest.topicArn());
         assertEquals("Policy", setTopicAttributesRequest.attributeName());
-        assertEquals("XXX", setTopicAttributesRequest.attributeValue());
         return SetTopicAttributesResponse.builder().build();
     }
 
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..a94185a 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
@@ -108,8 +108,7 @@ public class SnsComponentConfigurationTest extends 
CamelTestSupport {
         Sns2Component component = context.getComponent("aws2-sns", 
Sns2Component.class);
         Sns2Endpoint endpoint = (Sns2Endpoint) component
                 
.createEndpoint("aws2-sns://MyTopic?amazonSNSClient=#amazonSNSClient&accessKey=xxx&secretKey=yyy"
-                                + 
"&policy=%7B%22Version%22%3A%222008-10-17%22,%22Statement%22%3A%5B%7B%22Sid%22%3A%221%22,%22Effect%22%3A%22Allow%22,%22Principal%22%3A%7B%22AWS%22%3A%5B%22*%22%5D%7D,"
-                                + 
"%22Action%22%3A%5B%22sns%3ASubscribe%22%5D%7D%5D%7D&subject=The+subject+message");
+                                + 
"&policy=file:src/test/resources/org/apache/camel/component/aws2/sns/policy.txt&subject=The+subject+message");
 
         assertEquals("MyTopic", endpoint.getConfiguration().getTopicName());
         assertEquals("xxx", endpoint.getConfiguration().getAccessKey());
@@ -118,8 +117,9 @@ public class SnsComponentConfigurationTest extends 
CamelTestSupport {
         assertNotNull(endpoint.getConfiguration().getAmazonSNSClient());
         assertEquals("The subject message", 
endpoint.getConfiguration().getSubject());
         assertEquals(
-                
"{\"Version\":\"2008-10-17\",\"Statement\":[{\"Sid\":\"1\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":[\"*\"]},\"Action\":[\"sns:Subscribe\"]}]}",
+                
"file:src/test/resources/org/apache/camel/component/aws2/sns/policy.txt",
                 endpoint.getConfiguration().getPolicy());
+        endpoint.start();
     }
 
     @Test
diff --git 
a/components/camel-aws2-sns/src/test/resources/org/apache/camel/component/aws2/sns/policy.txt
 
b/components/camel-aws2-sns/src/test/resources/org/apache/camel/component/aws2/sns/policy.txt
new file mode 100644
index 0000000..3d32693
--- /dev/null
+++ 
b/components/camel-aws2-sns/src/test/resources/org/apache/camel/component/aws2/sns/policy.txt
@@ -0,0 +1 @@
+ 
{"Version":"2008-10-17","Statement":[{"Sid":"1","Effect":"Allow","Principal":{"AWS":["*"]},"Action":["sns:Subscribe"]}]}
\ No newline at end of file

Reply via email to