You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2010/11/08 10:21:10 UTC
svn commit: r1032503 - in /camel/trunk/components/camel-ftp/src:
main/java/org/apache/camel/component/file/remote/
test/java/org/apache/camel/component/file/remote/sftp/
Author: davsclaus
Date: Mon Nov 8 09:20:56 2010
New Revision: 1032503
URL: http://svn.apache.org/viewvc?rev=1032503&view=rev
Log:
CAMEL-3309: Fixed sftp producer with change dir stepwise and not stepswise.
Added:
camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceNotStepwiseTest.java
- copied, changed from r1032484, camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceTest.java
Modified:
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceTest.java
Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java?rev=1032503&r1=1032502&r2=1032503&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java (original)
+++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java Mon Nov 8 09:20:56 2010
@@ -520,6 +520,7 @@ public class FtpOperations implements Re
// not stepwise should change directory in one operation
if (!endpoint.getConfiguration().isStepwise()) {
doChangeDirectory(path);
+ return;
}
// if it starts with the root path then a little special handling for that
Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java?rev=1032503&r1=1032502&r2=1032503&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java (original)
+++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java Mon Nov 8 09:20:56 2010
@@ -359,6 +359,7 @@ public class SftpOperations implements R
// not stepwise should change directory in one operation
if (!endpoint.getConfiguration().isStepwise()) {
doChangeDirectory(path);
+ return;
}
// if it starts with the root path then a little special handling for that
Copied: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceNotStepwiseTest.java (from r1032484, camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceNotStepwiseTest.java?p2=camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceNotStepwiseTest.java&p1=camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceTest.java&r1=1032484&r2=1032503&rev=1032503&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceTest.java (original)
+++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceNotStepwiseTest.java Mon Nov 8 09:20:56 2010
@@ -26,7 +26,7 @@ import org.junit.Test;
* @version $Revision$
*/
@Ignore("Disabled due CI servers fails on full build running with these tests")
-public class SftpSimpleProduceTest extends SftpServerTestSupport {
+public class SftpSimpleProduceNotStepwiseTest extends SftpServerTestSupport {
@Override
public boolean isUseRouteBuilder() {
@@ -39,7 +39,7 @@ public class SftpSimpleProduceTest exten
return;
}
- template.sendBodyAndHeader("sftp://localhost:" + getPort() + "/" + FTP_ROOT_DIR + "?username=admin&password=admin", "Hello World", Exchange.FILE_NAME, "hello.txt");
+ template.sendBodyAndHeader("sftp://localhost:" + getPort() + "/" + FTP_ROOT_DIR + "?username=admin&password=admin&stepwise=false", "Hello World", Exchange.FILE_NAME, "hello.txt");
File file = new File(FTP_ROOT_DIR + "/hello.txt").getAbsoluteFile();
assertTrue("File should exist: " + file, file.exists());
@@ -52,11 +52,24 @@ public class SftpSimpleProduceTest exten
return;
}
- template.sendBodyAndHeader("sftp://localhost:" + getPort() + "/" + FTP_ROOT_DIR + "/mysub?username=admin&password=admin", "Bye World", Exchange.FILE_NAME, "bye.txt");
+ template.sendBodyAndHeader("sftp://localhost:" + getPort() + "/" + FTP_ROOT_DIR + "/mysub?username=admin&password=admin&stepwise=false", "Bye World", Exchange.FILE_NAME, "bye.txt");
File file = new File(FTP_ROOT_DIR + "/mysub/bye.txt").getAbsoluteFile();
assertTrue("File should exist: " + file, file.exists());
assertEquals("Bye World", context.getTypeConverter().convertTo(String.class, file));
}
+ @Test
+ public void testSftpSimpleTwoSubPathProduce() throws Exception {
+ if (!canTest()) {
+ return;
+ }
+
+ template.sendBodyAndHeader("sftp://localhost:" + getPort() + "/" + FTP_ROOT_DIR + "/mysub/myother?username=admin&password=admin&stepwise=false", "Farewell World", Exchange.FILE_NAME, "farewell.txt");
+
+ File file = new File(FTP_ROOT_DIR + "/mysub/myother/farewell.txt").getAbsoluteFile();
+ assertTrue("File should exist: " + file, file.exists());
+ assertEquals("Farewell World", context.getTypeConverter().convertTo(String.class, file));
+ }
+
}
Modified: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceTest.java?rev=1032503&r1=1032502&r2=1032503&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceTest.java (original)
+++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpSimpleProduceTest.java Mon Nov 8 09:20:56 2010
@@ -59,4 +59,17 @@ public class SftpSimpleProduceTest exten
assertEquals("Bye World", context.getTypeConverter().convertTo(String.class, file));
}
+ @Test
+ public void testSftpSimpleTwoSubPathProduce() throws Exception {
+ if (!canTest()) {
+ return;
+ }
+
+ template.sendBodyAndHeader("sftp://localhost:" + getPort() + "/" + FTP_ROOT_DIR + "/mysub/myother?username=admin&password=admin", "Farewell World", Exchange.FILE_NAME, "farewell.txt");
+
+ File file = new File(FTP_ROOT_DIR + "/mysub/myother/farewell.txt").getAbsoluteFile();
+ assertTrue("File should exist: " + file, file.exists());
+ assertEquals("Farewell World", context.getTypeConverter().convertTo(String.class, file));
+ }
+
}