Author: cmueller
Date: Sat Sep  8 21:32:48 2012
New Revision: 1382369

URL: http://svn.apache.org/viewvc?rev=1382369&view=rev
Log:
fixed test which randomly fail on slow CI server

Modified:
    
camel/trunk/components/camel-jsch/src/test/java/org/apache/camel/component/jsch/ScpSimpleProduceTest.java

Modified: 
camel/trunk/components/camel-jsch/src/test/java/org/apache/camel/component/jsch/ScpSimpleProduceTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/components/camel-jsch/src/test/java/org/apache/camel/component/jsch/ScpSimpleProduceTest.java?rev=1382369&r1=1382368&r2=1382369&view=diff
==============================================================================
--- 
camel/trunk/components/camel-jsch/src/test/java/org/apache/camel/component/jsch/ScpSimpleProduceTest.java
 (original)
+++ 
camel/trunk/components/camel-jsch/src/test/java/org/apache/camel/component/jsch/ScpSimpleProduceTest.java
 Sat Sep  8 21:32:48 2012
@@ -22,10 +22,8 @@ import org.apache.camel.Exchange;
 import org.junit.Assume;
 import org.junit.Test;
 
-/**
- * @version 
- */
 public class ScpSimpleProduceTest extends ScpServerTestSupport {
+    
     @Override
     public boolean isUseRouteBuilder() {
         return false;
@@ -37,9 +35,10 @@ public class ScpSimpleProduceTest extend
 
         String uri = getScpUri() + 
"?username=admin&password=admin&knownHostsFile=" + getKnownHostsFile();
         template.sendBodyAndHeader(uri, "Hello World", Exchange.FILE_NAME, 
"hello.txt");
+        Thread.sleep(100);
 
-        File file = new File(getScpPath() + "/hello.txt").getAbsoluteFile();
-        assertTrue("File should exist: " + file, file.exists());
+        File file = new File(getScpPath() + "/hello.txt");
+        assertFileExists(file.getAbsolutePath());
         assertEquals("Hello World", 
context.getTypeConverter().convertTo(String.class, file));
     }
 
@@ -49,9 +48,10 @@ public class ScpSimpleProduceTest extend
 
         String uri = getScpUri() + 
"?username=admin&password=admin&knownHostsFile=" + getKnownHostsFile();
         template.sendBodyAndHeader(uri, "Bye World", Exchange.FILE_NAME, 
"mysub/bye.txt");
+        Thread.sleep(100);
 
-        File file = new File(getScpPath() + 
"/mysub/bye.txt").getAbsoluteFile();
-        assertTrue("File should exist: " + file, file.exists());
+        File file = new File(getScpPath() + "/mysub/bye.txt");
+        assertFileExists(file.getAbsolutePath());
         assertEquals("Bye World", 
context.getTypeConverter().convertTo(String.class, file));
     }
 
@@ -61,9 +61,10 @@ public class ScpSimpleProduceTest extend
 
         String uri = getScpUri() + 
"?username=admin&password=admin&knownHostsFile=" + getKnownHostsFile();
         template.sendBodyAndHeader(uri, "Farewell World", Exchange.FILE_NAME, 
"mysub/mysubsub/farewell.txt");
+        Thread.sleep(100);
 
-        File file = new File(getScpPath() + 
"/mysub/mysubsub/farewell.txt").getAbsoluteFile();
-        assertTrue("File should exist: " + file, file.exists());
+        File file = new File(getScpPath() + "/mysub/mysubsub/farewell.txt");
+        assertFileExists(file.getAbsolutePath());
         assertEquals("Farewell World", 
context.getTypeConverter().convertTo(String.class, file));
     }
 
@@ -73,9 +74,10 @@ public class ScpSimpleProduceTest extend
 
         String uri = getScpUri() + 
"?username=admin&password=admin&chmod=640&knownHostsFile=" + 
getKnownHostsFile();
         template.sendBodyAndHeader(uri, "Bonjour Monde", Exchange.FILE_NAME, 
"monde.txt");
+        Thread.sleep(100);
 
-        File file = new File(getScpPath() + "/monde.txt").getAbsoluteFile();
-        assertTrue("File should exist: " + file, file.exists());
+        File file = new File(getScpPath() + "/monde.txt");
+        assertFileExists(file.getAbsolutePath());
         // Mina sshd we use for testing ignores file perms;
         // assertFalse("File should not have execute rights: " + file, 
file.canExecute());
         assertEquals("Bonjour Monde", 
context.getTypeConverter().convertTo(String.class, file));
@@ -87,9 +89,10 @@ public class ScpSimpleProduceTest extend
 
         String uri = getScpUri() + 
"?username=admin&privateKeyFile=src/test/resources/camel-key.priv&privateKeyFilePassphrase=password&knownHostsFile="
 + getKnownHostsFile();
         template.sendBodyAndHeader(uri, "Hallo Welt", Exchange.FILE_NAME, 
"welt.txt");
+        Thread.sleep(100);
 
-        File file = new File(getScpPath() + "/welt.txt").getAbsoluteFile();
-        assertTrue("File should exist: " + file, file.exists());
+        File file = new File(getScpPath() + "/welt.txt");
+        assertFileExists(file.getAbsolutePath());
         // Mina sshd we use for testing ignores file perms;
         // assertFalse("File should not have execute rights: " + file, 
file.canExecute());
         assertEquals("Hallo Welt", 
context.getTypeConverter().convertTo(String.class, file));


Reply via email to