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 2022/11/23 12:04:49 UTC

[camel-kamelets] 01/02: Added an SCP Sink IT Test

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

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

commit 0ad19db30e31404f8fe0b0c5932b2f6bdc7cae82
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Nov 23 13:01:03 2022 +0100

    Added an SCP Sink IT Test
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 it-tests/misc/scp/sink/timer-scp-it-test.sh | 36 +++++++++++++++++++++++++++++
 it-tests/misc/scp/sink/timer-scp.yaml       | 30 ++++++++++++++++++++++++
 2 files changed, 66 insertions(+)

diff --git a/it-tests/misc/scp/sink/timer-scp-it-test.sh b/it-tests/misc/scp/sink/timer-scp-it-test.sh
new file mode 100755
index 00000000..c1788173
--- /dev/null
+++ b/it-tests/misc/scp/sink/timer-scp-it-test.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+if [ $# -ne 1 ]; then
+    echo $0: usage: timer-scp-it-test.sh camel-version
+    exit 1
+fi
+
+camel_version=$1
+
+docker pull rastasheep/ubuntu-sshd:14.04
+docker run -d -P --name test_sshd -p 32768:22 rastasheep/ubuntu-sshd:14.04
+
+sleep 5
+
+jbang run -Dcamel.jbang.version=$camel_version camel@apache/camel run --local-kamelet-dir=../../../../kamelets/ timer-scp.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-scp-it-test.result ;
+else
+    mkdir -p ../../../tests/
+    echo "Test failed" > ../../../tests/timer-scp-it-test.result ;
+fi
+
+jbang run -Dcamel.jbang.version=$camel_version camel@apache/camel stop timer-scp
+
+docker stop test_sshd
+docker rm test_sshd
+
+cat ../../../tests/timer-scp-it-test.result
diff --git a/it-tests/misc/scp/sink/timer-scp.yaml b/it-tests/misc/scp/sink/timer-scp.yaml
new file mode 100644
index 00000000..03bc1fbf
--- /dev/null
+++ b/it-tests/misc/scp/sink/timer-scp.yaml
@@ -0,0 +1,30 @@
+## ---------------------------------------------------------------------------
+## 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:scp-sink"
+          parameters:
+            username: root
+            password: root
+            serverName: localhost
+            serverPort: 32768