Author: ningjiang
Date: Tue Jul 15 20:04:18 2008
New Revision: 677141

URL: http://svn.apache.org/viewvc?rev=677141&view=rev
Log:
CAMEL-718 Applied patch with thanks to Geoff, also fixed some typos of the ftp 
unit tests

Modified:
    
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java
    
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinarySampleTest.java
    
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToFileNoFileNameHeaderTest.java

Modified: 
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java?rev=677141&r1=677140&r2=677141&view=diff
==============================================================================
--- 
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java
 (original)
+++ 
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java
 Tue Jul 15 20:04:18 2008
@@ -48,16 +48,20 @@
         final FTPClient client = new FTPClient();
         return client;
     }
-    
+
     public void connect(FTPClient client) throws IOException {
         RemoteFileConfiguration config = getConfiguration();
         String host = config.getHost();
         int port = config.getPort();
         client.connect(host, port);
-        client.login(config.getUsername(), config.getPassword());
-        client.setFileType(config.isBinary() ? FTPClient.BINARY_FILE_TYPE : 
FTPClient.ASCII_FILE_TYPE);   
+        if (null != config.getUsername()) {
+            client.login(config.getUsername(), config.getPassword());
+        } else {
+            client.login("anonymous", null);
+        }
+        client.setFileType(config.isBinary() ? FTPClient.BINARY_FILE_TYPE : 
FTPClient.ASCII_FILE_TYPE);
     }
-    
+
     public void disconnect(FTPClient client) throws IOException {
         client.disconnect();
     }

Modified: 
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinarySampleTest.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinarySampleTest.java?rev=677141&r1=677140&r2=677141&view=diff
==============================================================================
--- 
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinarySampleTest.java
 (original)
+++ 
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinarySampleTest.java
 Tue Jul 15 20:04:18 2008
@@ -37,7 +37,7 @@
 
                 // from the given FTP server we poll (= download) all the files
                 // from the public/reports folder as BINARY types and store 
this as files
-                // in a local directory. Camle will use the filenames from the 
FTPServer
+                // in a local directory. Camel will use the filenames from the 
FTPServer
 
                 // notice that the FTPConsumer properties must be prefixed 
with "consumer." in the URL
                 // the delay parameter is from the FileConsumer component so 
we should use consumer.delay as

Modified: 
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToFileNoFileNameHeaderTest.java
URL: 
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToFileNoFileNameHeaderTest.java?rev=677141&r1=677140&r2=677141&view=diff
==============================================================================
--- 
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToFileNoFileNameHeaderTest.java
 (original)
+++ 
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToFileNoFileNameHeaderTest.java
 Tue Jul 15 20:04:18 2008
@@ -79,7 +79,7 @@
         return new RouteBuilder() {
             public void configure() throws Exception {
                 String fileUrl = "file:target/ftptest/?append=false&noop=true";
-                // we do not set any filename in the header propery so the 
filename should be the one
+                // we do not set any filename in the header property so the 
filename should be the one
                 // from the FTP server we downloaded
                 
from(ftpUrl).convertBodyTo(String.class).to(fileUrl).to("mock:result");
             }


Reply via email to