Author: davsclaus
Date: Sat Apr 12 10:07:46 2008
New Revision: 647473

URL: http://svn.apache.org/viewvc?rev=647473&view=rev
Log:
CAMEL-424 Added code snippet to be added to the wiki documentation

Added:
    
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinarySampleTest.java

Added: 
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=647473&view=auto
==============================================================================
--- 
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinarySampleTest.java
 (added)
+++ 
activemq/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpToBinarySampleTest.java
 Sat Apr 12 10:07:46 2008
@@ -0,0 +1,36 @@
+package org.apache.camel.component.file.remote;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.ContextTestSupport;
+
+/**
+ * Unit test used for FTP wiki documentation
+ */
+public class FromFtpToBinarySampleTest extends ContextTestSupport {
+
+    public void testDummy() throws Exception {
+        // this is a noop test
+    }
+
+    // START SNIPPET: e1
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+                // we use a delay of 60 minutes (eg. once pr. hour we poll the 
FTP server
+                long delay = 60 * 60 * 1000L;
+
+                // 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
+
+                // 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
+                // the URI parameter name. The FTP Component is an extension 
of the File Component.
+                from("ftp://[EMAIL 
PROTECTED]/public/reports?password=tiger&binary=true&consumer.delay=" + delay).
+                    to("file://target/test-reports");
+            }
+        };
+    }
+    // END SNIPPET: e1
+
+}


Reply via email to