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

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

commit 2df055b8a254198f608493aa302eccbba87d5b7f
Author: Andrea Cosentino <anco...@gmail.com>
AuthorDate: Tue Nov 22 16:36:01 2022 +0100

    Added it-test for SFTP Sink
    
    Signed-off-by: Andrea Cosentino <anco...@gmail.com>
---
 it-tests/Makefile                             |  2 ++
 it-tests/misc/sftp/sink/timer-sftp-it-test.sh | 36 +++++++++++++++++++++++++++
 it-tests/misc/sftp/sink/timer-sftp.yaml       | 31 +++++++++++++++++++++++
 3 files changed, 69 insertions(+)

diff --git a/it-tests/Makefile b/it-tests/Makefile
index 390c29a3..28336809 100644
--- a/it-tests/Makefile
+++ b/it-tests/Makefile
@@ -35,6 +35,8 @@ tests:
        ./timer-aws-kinesis-firehose-it-test.sh $(camel-version)
        cd misc/sftp/source/ && \
        ./sftp-log-it-test.sh $(camel-version)
+       cd misc/sftp/sink/ && \
+       ./timer-sftp-it-test.sh $(camel-version)
        ./scripts/results.sh
        rm -rf tests
        
diff --git a/it-tests/misc/sftp/sink/timer-sftp-it-test.sh 
b/it-tests/misc/sftp/sink/timer-sftp-it-test.sh
new file mode 100755
index 00000000..096761e9
--- /dev/null
+++ b/it-tests/misc/sftp/sink/timer-sftp-it-test.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+if [ $# -ne 1 ]; then
+    echo $0: usage: timer-sftp-it-test.sh camel-version
+    exit 1
+fi
+
+camel_version=$1
+
+docker pull emberstack/sftp
+docker run -p 24:22 --name sftp -d emberstack/sftp 
+
+sleep 5
+
+jbang run -Dcamel.jbang.version=$camel_version camel@apache/camel run 
--local-kamelet-dir=../../../../kamelets/ timer-sftp.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`
+if [[ $success == 5 && $fail == 0 ]] 
+then 
+    mkdir -p ../../../tests/
+    echo "Test Successful" > ../../../tests/timer-sftp-it-test.result ;
+else
+    mkdir -p ../../../tests/
+    echo "Test failed" > ../../../tests/timer-sftp-it-test.result ;
+fi
+
+jbang run -Dcamel.jbang.version=$camel_version camel@apache/camel stop 
timer-sftp
+
+docker stop sftp
+docker rm sftp
+
+cat ../../../tests/timer-sftp-it-test.result
diff --git a/it-tests/misc/sftp/sink/timer-sftp.yaml 
b/it-tests/misc/sftp/sink/timer-sftp.yaml
new file mode 100644
index 00000000..4a6e9fee
--- /dev/null
+++ b/it-tests/misc/sftp/sink/timer-sftp.yaml
@@ -0,0 +1,31 @@
+## ---------------------------------------------------------------------------
+## 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:sftp-sink"
+          parameters:
+            username: demo
+            password: demo
+            connectionHost: localhost
+            connectionPort: 24
+            directoryName: demos/  

Reply via email to