You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by on...@apache.org on 2018/10/05 08:11:28 UTC

[camel] branch master updated: CAMEL-12853 - disable SftpConsumerDisconnectTest

This is an automated email from the ASF dual-hosted git repository.

onders pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 80c35e1  CAMEL-12853 - disable SftpConsumerDisconnectTest
80c35e1 is described below

commit 80c35e14f152e943439f25fa019e34241fd3c517
Author: onders <on...@apache.org>
AuthorDate: Thu Oct 4 12:11:56 2018 +0300

    CAMEL-12853 - disable SftpConsumerDisconnectTest
---
 .../remote/sftp/SftpConsumerDisconnectTest.java    | 55 ++++++++--------------
 1 file changed, 20 insertions(+), 35 deletions(-)

diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumerDisconnectTest.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumerDisconnectTest.java
index 94508c2..8b78a32 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumerDisconnectTest.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpConsumerDisconnectTest.java
@@ -24,22 +24,16 @@ import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.commons.io.FileUtils;
-import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 
+@Ignore
 public class SftpConsumerDisconnectTest extends SftpServerTestSupport {
     private static final String SAMPLE_FILE_NAME_1 = String.format("sample-1-%s.txt", SftpConsumerDisconnectTest.class.getSimpleName());
     private static final String SAMPLE_FILE_NAME_2 = String.format("sample-2-%s.txt", SftpConsumerDisconnectTest.class.getSimpleName());
     private static final String SAMPLE_FILE_CHARSET = "iso-8859-1";
     private static final String SAMPLE_FILE_PAYLOAD = "abc";
 
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
-        context.stopRoute("foo");
-        context.stopRoute("bar");
-    }
-
     @Test
     public void testConsumeDelete() throws Exception {
         if (!canTest()) {
@@ -58,25 +52,12 @@ public class SftpConsumerDisconnectTest extends SftpServerTestSupport {
 
         // Check that expectations are satisfied
         assertMockEndpointsSatisfied();
+        
+        Thread.sleep(250);
 
         // File is deleted
-        assertTrue(fileRemovedEventually(FTP_ROOT_DIR + "/" + SAMPLE_FILE_NAME_1));
-    }
-
-    public boolean fileRemovedEventually(String fileName) throws InterruptedException {
-        // try up to 10 seconds
-        for (int i = 0; i < 10; i++) {
-            // Give it a second to delete the file
-            Thread.sleep(1000);
-
-            // File is deleted
-            File file = new File(FTP_ROOT_DIR + "/" + SAMPLE_FILE_NAME_1);
-            if (!file.exists()) {
-                return true;
-            }
-        }
-
-        return false;
+        File deletedFile = new File(FTP_ROOT_DIR + "/" + SAMPLE_FILE_NAME_1);
+        assertFalse("File should have been deleted: " + deletedFile, deletedFile.exists());
     }
 
     @Test
@@ -109,21 +90,25 @@ public class SftpConsumerDisconnectTest extends SftpServerTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("sftp://localhost:" + getPort() + "/" + FTP_ROOT_DIR + "?username=admin&password=admin&delete=true").routeId("foo").noAutoStartup().process(new Processor() {
-                    @Override
-                    public void process(Exchange exchange) throws Exception {
-                        disconnectAllSessions(); // disconnect all Sessions from
-                                                 // the SFTP server
-                    }
-                }).to("mock:result");
-                from("sftp://localhost:" + getPort() + "/" + FTP_ROOT_DIR + "?username=admin&password=admin&noop=false&move=.camel").routeId("bar").noAutoStartup()
+                from("sftp://localhost:" + getPort() + "/" + FTP_ROOT_DIR + "?username=admin&password=admin&delete=true")
+                    .routeId("foo")
+                    .noAutoStartup()
                     .process(new Processor() {
                         @Override
                         public void process(Exchange exchange) throws Exception {
-                            disconnectAllSessions(); // disconnect all Sessions
-                                                     // from the SFTP server
+                            disconnectAllSessions(); // disconnect all Sessions from
+                                                     // the SFTP server
                         }
                     }).to("mock:result");
+                from("sftp://localhost:" + getPort() + "/" + FTP_ROOT_DIR + "?username=admin&password=admin&noop=false&move=.camel")
+                    .routeId("bar")
+                    .noAutoStartup().process(new Processor() {
+                        @Override
+                        public void process(Exchange exchange) throws Exception {
+                           disconnectAllSessions(); // disconnect all Sessions
+                                                    // from the SFTP server
+                       }
+                   }).to("mock:result");
             }
         };
     }