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

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 813d966  CAMEL-14947: camel-sftp: check for existance of remote 
directory using ls is very slow. Polished the prev PR and rename the option to 
a better name.
813d966 is described below

commit 813d966440ff952dcc962f4c43f864405a62ad2e
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Apr 25 08:59:35 2020 +0200

    CAMEL-14947: camel-sftp: check for existance of remote directory using ls 
is very slow. Polished the prev PR and rename the option to a better name.
---
 .../remote/sftp/SftpProducerFileWithPathTest.java  | 49 ++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpProducerFileWithPathTest.java
 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpProducerFileWithPathTest.java
index d6bc681..8489194 100644
--- 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpProducerFileWithPathTest.java
+++ 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpProducerFileWithPathTest.java
@@ -44,4 +44,53 @@ public class SftpProducerFileWithPathTest extends 
SftpServerTestSupport {
         assertEquals("Hello World", IOConverter.toString(file, null));
     }
 
+    @Test
+    public void testProducerFileWithPathTwice() throws Exception {
+        if (!canTest()) {
+            return;
+        }
+
+        template.sendBodyAndHeader(getFtpUrl(), "Hello World", 
Exchange.FILE_NAME, "hello/claus.txt");
+        template.sendBodyAndHeader(getFtpUrl(), "Hello Again World", 
Exchange.FILE_NAME, "hello/andrea.txt");
+
+        File file = new File(FTP_ROOT_DIR + "/hello/claus.txt");
+        assertTrue(file.exists(), "The uploaded file should exists");
+        assertEquals("Hello World", IOConverter.toString(file, null));
+
+        file = new File(FTP_ROOT_DIR + "/hello/andrea.txt");
+        assertTrue(file.exists(), "The uploaded file should exists");
+        assertEquals("Hello Again World", IOConverter.toString(file, null));
+    }
+
+    @Test
+    public void testProducerFileWithPathExistDirCheckUsingLs() throws 
Exception {
+        if (!canTest()) {
+            return;
+        }
+
+        template.sendBodyAndHeader(getFtpUrl() + 
"&existDirCheckUsingLs=false", "Bye World", Exchange.FILE_NAME, 
"bye/andrea.txt");
+
+        File file = new File(FTP_ROOT_DIR + "/bye/andrea.txt");
+        assertTrue(file.exists(), "The uploaded file should exists");
+        assertEquals("Bye World", IOConverter.toString(file, null));
+    }
+
+    @Test
+    public void testProducerFileWithPathExistDirCheckUsingLsTwice() throws 
Exception {
+        if (!canTest()) {
+            return;
+        }
+
+        template.sendBodyAndHeader(getFtpUrl() + 
"&existDirCheckUsingLs=false", "Bye World", Exchange.FILE_NAME, 
"bye/andrea.txt");
+        template.sendBodyAndHeader(getFtpUrl() + 
"&existDirCheckUsingLs=false", "Bye Again World", Exchange.FILE_NAME, 
"bye/claus.txt");
+
+        File file = new File(FTP_ROOT_DIR + "/bye/andrea.txt");
+        assertTrue(file.exists(), "The uploaded file should exists");
+        assertEquals("Bye World", IOConverter.toString(file, null));
+
+        file = new File(FTP_ROOT_DIR + "/bye/claus.txt");
+        assertTrue(file.exists(), "The uploaded file should exists");
+        assertEquals("Bye Again World", IOConverter.toString(file, null));
+    }
+
 }

Reply via email to