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

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

commit 9dcf37bed4cad847a7952e50ea4aac1b9af6e4af
Author: Andrea Cosentino <anco...@gmail.com>
AuthorDate: Thu Nov 10 13:22:45 2022 +0100

    Added AWS Sink SNS Test
    
    Signed-off-by: Andrea Cosentino <anco...@gmail.com>
---
 it-tests/aws/aws-sns/sink/terraform/main.tf        | 51 ++++++++++++++++++++++
 it-tests/aws/aws-sns/sink/timer-aws-sns-it-test.sh | 38 ++++++++++++++++
 it-tests/aws/aws-sns/sink/timer-aws-sns.yaml       | 29 ++++++++++++
 3 files changed, 118 insertions(+)

diff --git a/it-tests/aws/aws-sns/sink/terraform/main.tf 
b/it-tests/aws/aws-sns/sink/terraform/main.tf
new file mode 100644
index 00000000..ccfa8365
--- /dev/null
+++ b/it-tests/aws/aws-sns/sink/terraform/main.tf
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+terraform {
+  required_providers {
+    aws = {
+      source  = "hashicorp/aws"
+      version = "~> 3.27"
+    }
+  }
+
+  required_version = ">= 0.14.9"
+}
+
+provider "aws" {
+  profile = "default"
+  region  = "eu-west-1"
+}
+
+variable "sns_topic_name" {
+  type = string
+  default = "s3-camel-test-123"
+}
+
+
+data "aws_caller_identity" "current" {}
+
+# Create a new SNS TOPIC
+resource "aws_sns_topic" "MySNSTopic" {
+  name = var.sns_topic_name
+}
+
+output "SNS-topic" {
+  value       = aws_sns_topic.MySNSTopic.id
+  description = "The SQS Queue"
+}
+       
diff --git a/it-tests/aws/aws-sns/sink/timer-aws-sns-it-test.sh 
b/it-tests/aws/aws-sns/sink/timer-aws-sns-it-test.sh
new file mode 100755
index 00000000..d840f428
--- /dev/null
+++ b/it-tests/aws/aws-sns/sink/timer-aws-sns-it-test.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+if [ $# -ne 1 ]; then
+    echo $0: usage: timer-aws-sns-it-test.sh camel-version
+    exit 1
+fi
+
+camel_version=$1
+
+cd terraform/
+terraform init
+terraform apply -auto-approve
+cd ../
+
+jbang run -Dcamel.jbang.version=$camel_version camel@apache/camel run 
timer-aws-sns.yaml &
+
+sleep 10
+
+variable=`jbang run -Dcamel.jbang.version=$camel_version camel@apache/camel 
get | tail -n +2` 
+success=`echo $variable | cut -d' ' -f11`
+fail=`echo $variable | cut -d' ' -f12`
+echo $success $fail
+if [[ $success == 5 && $fail == 0 ]] 
+then 
+    mkdir -p ../../../tests/
+    echo "Test Successful" > ../../../tests/timer-aws-sns-it-test.result ;
+else
+    mkdir -p ../../../tests/
+    echo "Test failed" > ../../../tests/timer-aws-sns-it-test.result ;
+fi
+
+jbang run -Dcamel.jbang.version=$camel_version camel@apache/camel stop 
timer-aws-sns
+
+cd terraform/
+terraform destroy -auto-approve
+cd ../
+
+cat ../../../tests/timer-aws-sns-it-test.result
diff --git a/it-tests/aws/aws-sns/sink/timer-aws-sns.yaml 
b/it-tests/aws/aws-sns/sink/timer-aws-sns.yaml
new file mode 100644
index 00000000..338e1021
--- /dev/null
+++ b/it-tests/aws/aws-sns/sink/timer-aws-sns.yaml
@@ -0,0 +1,29 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+- route:
+    from:
+      uri: "timer://foo?delay=0&fixedRate=true&period=1000&repeatCount=5"
+      steps:
+      - set-body:
+          constant: "test"
+      - to: 
+          uri: "kamelet:aws-sns-sink"
+          parameters:
+            topicNameOrArn: "s3-camel-test-123"
+            useDefaultCredentialsProvider: true
+            region: "eu-west-1"     

Reply via email to