camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bvah...@apache.org
Subject svn commit: r1404297 - in /camel/branches/camel-2.9.x: ./ components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/
Date Wed, 31 Oct 2012 18:54:16 GMT
Author: bvahdat
Date: Wed Oct 31 18:54:16 2012
New Revision: 1404297

URL: http://svn.apache.org/viewvc?rev=1404297&view=rev
Log:
Merged revisions 1404295 via svnmerge from 
https://svn.apache.org/repos/asf/camel/branches/camel-2.10.x

................
  r1404295 | bvahdat | 2012-10-31 19:50:59 +0100 (Mi, 31 Okt 2012) | 9 lines
  
  Merged revisions 1404291 via svnmerge from 
  https://svn.apache.org/repos/asf/camel/trunk
  
  ........
    r1404291 | bvahdat | 2012-10-31 19:46:44 +0100 (Mi, 31 Okt 2012) | 1 line
    
    Added asserts verifying the effect of the disconnect option by the ftp producer as well.
Also polished a bit.
  ........
................

Modified:
    camel/branches/camel-2.9.x/   (props changed)
    camel/branches/camel-2.9.x/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDisconnectTest.java
    camel/branches/camel-2.9.x/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerDisconnectTest.java

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
  Merged /camel/trunk:r1404291
  Merged /camel/branches/camel-2.10.x:r1404295

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.9.x/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDisconnectTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDisconnectTest.java?rev=1404297&r1=1404296&r2=1404297&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDisconnectTest.java
(original)
+++ camel/branches/camel-2.9.x/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerDisconnectTest.java
Wed Oct 31 18:54:16 2012
@@ -17,10 +17,11 @@
 package org.apache.camel.component.file.remote;
 
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.commons.net.ftp.FTPClient;
 import org.junit.Test;
 
 public class FtpConsumerDisconnectTest extends FtpServerTestSupport {
-
+    
     private String getFtpUrl() {
         return "ftp://admin@localhost:" + getPort() + "/done?password=admin&disconnect=true&delay=5000";
     }
@@ -28,10 +29,11 @@ public class FtpConsumerDisconnectTest e
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        
-        // force the singleton FtpEndpoint to make use of a custom FTPClient
+
+        // ask the singleton FtpEndpoint to make use of a custom FTPClient
+        // so that we can hold a reference on it inside the test below
         FtpEndpoint<?> endpoint = context.getEndpoint(getFtpUrl(), FtpEndpoint.class);
-        endpoint.setFtpClient(endpoint.createFtpClient());
+        endpoint.setFtpClient(new FTPClient());
 
         sendFile(getFtpUrl(), "Hello World", "claus.txt");
     }
@@ -51,13 +53,14 @@ public class FtpConsumerDisconnectTest e
         getMockEndpoint("mock:result").expectedMessageCount(1);
         assertMockEndpointsSatisfied();
 
-        // give time for ftp consumer to disconnect (delay is 5000 ms which is long enough
to avoid a second poll cycle)
+        // give time for ftp consumer to disconnect, delay is 5000 ms which is long
+        // enough to avoid a second poll cycle before we are done with the asserts
+        // below inside the main thread
         Thread.sleep(2000);
 
         FtpEndpoint<?> endpoint = context.getEndpoint(getFtpUrl(), FtpEndpoint.class);
         assertFalse("The FTPClient should be already disconnected", endpoint.getFtpClient().isConnected());
-        assertTrue("The FtpEndpoint is configured to disconnect after each poll", endpoint.isDisconnect());
-
+        assertTrue("The FtpEndpoint should be configured to disconnect", endpoint.isDisconnect());
     }
 
 }
\ No newline at end of file

Modified: camel/branches/camel-2.9.x/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerDisconnectTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerDisconnectTest.java?rev=1404297&r1=1404296&r2=1404297&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerDisconnectTest.java
(original)
+++ camel/branches/camel-2.9.x/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpProducerDisconnectTest.java
Wed Oct 31 18:54:16 2012
@@ -16,10 +16,21 @@
  */
 package org.apache.camel.component.file.remote;
 
+import org.apache.commons.net.ftp.FTPClient;
 import org.junit.Test;
 
 public class FtpProducerDisconnectTest extends FtpServerTestSupport {
 
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+
+        // ask the singleton FtpEndpoint to make use of a custom FTPClient
+        // so that we can hold a reference on it inside the test below
+        FtpEndpoint<?> endpoint = context.getEndpoint(getFtpUrl(), FtpEndpoint.class);
+        endpoint.setFtpClient(new FTPClient());
+    }
+
     private String getFtpUrl() {
         return "ftp://admin@localhost:" + getPort() + "/done?password=admin&disconnect=true";
     }
@@ -27,6 +38,10 @@ public class FtpProducerDisconnectTest e
     @Test
     public void testDisconnectOnDone() throws Exception {
         sendFile(getFtpUrl(), "Hello World", "claus.txt");
+
+        FtpEndpoint<?> endpoint = context.getEndpoint(getFtpUrl(), FtpEndpoint.class);
+        assertFalse("The FTPClient should be already disconnected", endpoint.getFtpClient().isConnected());
+        assertTrue("The FtpEndpoint should be configured to disconnect", endpoint.isDisconnect());
     }
 
 }
\ No newline at end of file



Mime
View raw message