camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1358599 - /camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileToFtpDeleteTest.java
Date Sat, 07 Jul 2012 16:30:53 GMT
Author: davsclaus
Date: Sat Jul  7 16:30:53 2012
New Revision: 1358599

URL: http://svn.apache.org/viewvc?rev=1358599&view=rev
Log:
Added test based on user forum issue

Added:
    camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileToFtpDeleteTest.java
      - copied, changed from r1358517, camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileToFtpTest.java

Copied: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileToFtpDeleteTest.java
(from r1358517, camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileToFtpTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileToFtpDeleteTest.java?p2=camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileToFtpDeleteTest.java&p1=camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileToFtpTest.java&r1=1358517&r2=1358599&rev=1358599&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileToFtpTest.java
(original)
+++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFileToFtpDeleteTest.java
Sat Jul  7 16:30:53 2012
@@ -16,6 +16,10 @@
  */
 package org.apache.camel.component.file.remote;
 
+import java.io.File;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.NotifyBuilder;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.junit.Test;
@@ -23,25 +27,39 @@ import org.junit.Test;
 /**
  * @version 
  */
-public class FromFileToFtpTest extends FtpServerTestSupport {
+public class FromFileToFtpDeleteTest extends FtpServerTestSupport {
 
     protected String getFtpUrl() {
-        return "ftp://admin@localhost:" + getPort() + "/tmp2/camel?password=admin&consumer.initialDelay=3000";
+        return "ftp://admin@localhost:" + getPort() + "?password=admin";
     }
 
     @Test
-    public void testFromFileToFtp() throws Exception {
+    public void testFromFileToFtpDelete() throws Exception {
+        NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create();
+
         MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMessageCount(2);
+        mock.expectedMessageCount(1);
+
+        template.sendBodyAndHeader("file:target/delete", "Hello World", Exchange.FILE_NAME,
"hello.txt");
 
         assertMockEndpointsSatisfied();
+        assertTrue(notify.matchesMockWaitTime());
+
+        // file should be deleted
+        File file = new File("target/delete/hello.txt");
+        assertFalse("File should be deleted", file.exists());
+
+        // file should exists on ftp server
+        file = new File(FTP_ROOT_DIR + "/hello.txt");
+        assertTrue("File should exist on ftp server", file.exists());
     }
 
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                from(getFtpUrl()).to("mock:result");
-                from("file:src/main/data?noop=true&consumer.delay=3000").to(getFtpUrl());
+                from("file:target/delete?delete=true")
+                    .to(getFtpUrl())
+                    .to("mock:result");
             }
         };
     }



Mime
View raw message