You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2017/07/08 10:47:06 UTC

[3/3] camel git commit: CAMEL-11446: Use awaitility in camel-core for testing where we otherwise use thred sleep which can be speeded up.

CAMEL-11446: Use awaitility in camel-core for testing where we otherwise use thred sleep which can be speeded up.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ffc08f48
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ffc08f48
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ffc08f48

Branch: refs/heads/master
Commit: ffc08f4806062aa29abfeab513e5731f5144053a
Parents: 76accb3
Author: Claus Ibsen <da...@apache.org>
Authored: Sat Jul 8 12:46:50 2017 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Jul 8 12:46:50 2017 +0200

----------------------------------------------------------------------
 .../file/FileConsumeRootDirManualTest.java        |  2 ++
 .../file/FileConsumeRunLoggingLevelTest.java      |  2 +-
 ...leConsumeSimpleAbsoluteMoveToAbsoluteTest.java | 10 ++++++----
 ...leConsumeSimpleAbsoluteMoveToRelativeTest.java |  9 +++++----
 ...leConsumeSimpleRelativeMoveToAbsoluteTest.java |  9 +++++----
 ...leConsumeSimpleRelativeMoveToRelativeTest.java |  9 +++++----
 .../file/FileConsumeSingleDirectoryOnlyTest.java  | 12 +++++-------
 .../file/FileConsumeWithDollarInPathTest.java     |  2 +-
 .../component/file/FileConsumerNoopTest.java      | 18 +++++++++---------
 ...ileConsumerPollStrategyPolledMessagesTest.java |  2 +-
 ...ileConsumerPollStrategyStopOnRollbackTest.java |  4 ++--
 ...PreMoveCopyAndDeleteOnRenameFailFalseTest.java |  2 +-
 .../file/FileConsumerPreMoveIssueTest.java        |  2 +-
 .../component/file/FileConsumerPreMoveTest.java   |  2 +-
 ...leConsumerPreMoveWithProbeContentTypeTest.java |  2 +-
 .../file/FileConsumerProducerRouteTest.java       |  9 +++++----
 .../file/FileConsumerRelativeFileNameTest.java    | 17 +++++++++++------
 .../file/FileConsumerSharedThreadPollTest.java    |  4 ++--
 .../file/FileConsumerSkipDotFilesTest.java        |  5 ++---
 .../file/FileContentBasedRouterTest.java          | 13 +++++++------
 20 files changed, 73 insertions(+), 62 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/ffc08f48/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeRootDirManualTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeRootDirManualTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeRootDirManualTest.java
index 2ae4805..fdb1d96 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeRootDirManualTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeRootDirManualTest.java
@@ -19,7 +19,9 @@ package org.apache.camel.component.file;
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Ignore;
 
+@Ignore("Manual test")
 public class FileConsumeRootDirManualTest extends ContextTestSupport {
 
     public void testSkipMe() {

http://git-wip-us.apache.org/repos/asf/camel/blob/ffc08f48/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeRunLoggingLevelTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeRunLoggingLevelTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeRunLoggingLevelTest.java
index b39559f..1d2dfda 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeRunLoggingLevelTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeRunLoggingLevelTest.java
@@ -44,7 +44,7 @@ public class FileConsumeRunLoggingLevelTest extends ContextTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("file:target/files?runLoggingLevel=INFO")
+                from("file:target/files?runLoggingLevel=INFO&initialDelay=0&delay=10")
                     .to("mock:result");
             }
         };

http://git-wip-us.apache.org/repos/asf/camel/blob/ffc08f48/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSimpleAbsoluteMoveToAbsoluteTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSimpleAbsoluteMoveToAbsoluteTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSimpleAbsoluteMoveToAbsoluteTest.java
index a94df52..ff3dd3a 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSimpleAbsoluteMoveToAbsoluteTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSimpleAbsoluteMoveToAbsoluteTest.java
@@ -37,19 +37,21 @@ public class FileConsumeSimpleAbsoluteMoveToAbsoluteTest extends ContextTestSupp
         // use current dir as base as absolute path
         base = new File("").getAbsolutePath() + "/target/move";
         super.setUp();
-        template.sendBodyAndHeader(fileUrl, "Bye World", Exchange.FILE_NAME, "bye.txt");
-        template.sendBodyAndHeader(fileUrl, "Hello World", Exchange.FILE_NAME, "sub/hello.txt");
-        template.sendBodyAndHeader(fileUrl, "Goodday World", Exchange.FILE_NAME, "sub/sub2/goodday.txt");
     }
 
     public void testMoveToSubDir() throws Exception {
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMessageCount(3);
+
         // will flatten when using absolute path in move
         mock.expectedFileExists(base + "/.done/bye.txt");
         mock.expectedFileExists(base + "/.done/hello.txt");
         mock.expectedFileExists(base + "/.done/goodday.txt");
 
+        template.sendBodyAndHeader(fileUrl, "Bye World", Exchange.FILE_NAME, "bye.txt");
+        template.sendBodyAndHeader(fileUrl, "Hello World", Exchange.FILE_NAME, "sub/hello.txt");
+        template.sendBodyAndHeader(fileUrl, "Goodday World", Exchange.FILE_NAME, "sub/sub2/goodday.txt");
+
         assertMockEndpointsSatisfied();
     }
 
@@ -58,7 +60,7 @@ public class FileConsumeSimpleAbsoluteMoveToAbsoluteTest extends ContextTestSupp
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("file://" + base + "?recursive=true&move=" + base + "/.done")
+                from("file://" + base + "?recursive=true&move=" + base + "/.done&initialDelay=0&delay=10")
                         .convertBodyTo(String.class).to("mock:result");
             }
         };

http://git-wip-us.apache.org/repos/asf/camel/blob/ffc08f48/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSimpleAbsoluteMoveToRelativeTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSimpleAbsoluteMoveToRelativeTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSimpleAbsoluteMoveToRelativeTest.java
index d91eb98..a683eff 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSimpleAbsoluteMoveToRelativeTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSimpleAbsoluteMoveToRelativeTest.java
@@ -37,9 +37,6 @@ public class FileConsumeSimpleAbsoluteMoveToRelativeTest extends ContextTestSupp
         // use current dir as base as absolute path
         base = new File("").getAbsolutePath() + "/target/move";
         super.setUp();
-        template.sendBodyAndHeader(fileUrl, "Bye World", Exchange.FILE_NAME, "bye.txt");
-        template.sendBodyAndHeader(fileUrl, "Hello World", Exchange.FILE_NAME, "sub/hello.txt");
-        template.sendBodyAndHeader(fileUrl, "Goodday World", Exchange.FILE_NAME, "sub/sub2/goodday.txt");
     }
 
     public void testMoveToSubDir() throws Exception {
@@ -49,6 +46,10 @@ public class FileConsumeSimpleAbsoluteMoveToRelativeTest extends ContextTestSupp
         mock.expectedFileExists(base + "/sub/.done/hello.txt");
         mock.expectedFileExists(base + "/sub/sub2/.done/goodday.txt");
 
+        template.sendBodyAndHeader(fileUrl, "Bye World", Exchange.FILE_NAME, "bye.txt");
+        template.sendBodyAndHeader(fileUrl, "Hello World", Exchange.FILE_NAME, "sub/hello.txt");
+        template.sendBodyAndHeader(fileUrl, "Goodday World", Exchange.FILE_NAME, "sub/sub2/goodday.txt");
+
         assertMockEndpointsSatisfied();
     }
 
@@ -57,7 +58,7 @@ public class FileConsumeSimpleAbsoluteMoveToRelativeTest extends ContextTestSupp
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("file://" + base + "?recursive=true&move=.done")
+                from("file://" + base + "?recursive=true&move=.done&initialDelay=0&delay=10")
                         .convertBodyTo(String.class).to("mock:result");
             }
         };

http://git-wip-us.apache.org/repos/asf/camel/blob/ffc08f48/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSimpleRelativeMoveToAbsoluteTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSimpleRelativeMoveToAbsoluteTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSimpleRelativeMoveToAbsoluteTest.java
index 2eeb67f..7e423e6 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSimpleRelativeMoveToAbsoluteTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSimpleRelativeMoveToAbsoluteTest.java
@@ -37,9 +37,6 @@ public class FileConsumeSimpleRelativeMoveToAbsoluteTest extends ContextTestSupp
         // use current dir as base as absolute path
         base = new File("").getAbsolutePath() + "/target/move";
         super.setUp();
-        template.sendBodyAndHeader(fileUrl, "Bye World", Exchange.FILE_NAME, "bye.txt");
-        template.sendBodyAndHeader(fileUrl, "Hello World", Exchange.FILE_NAME, "sub/hello.txt");
-        template.sendBodyAndHeader(fileUrl, "Goodday World", Exchange.FILE_NAME, "sub/sub2/goodday.txt");
     }
 
     public void testMoveToSubDir() throws Exception {
@@ -50,6 +47,10 @@ public class FileConsumeSimpleRelativeMoveToAbsoluteTest extends ContextTestSupp
         mock.expectedFileExists(base + "/.done/hello.txt");
         mock.expectedFileExists(base + "/.done/goodday.txt");
 
+        template.sendBodyAndHeader(fileUrl, "Bye World", Exchange.FILE_NAME, "bye.txt");
+        template.sendBodyAndHeader(fileUrl, "Hello World", Exchange.FILE_NAME, "sub/hello.txt");
+        template.sendBodyAndHeader(fileUrl, "Goodday World", Exchange.FILE_NAME, "sub/sub2/goodday.txt");
+
         assertMockEndpointsSatisfied();
     }
 
@@ -58,7 +59,7 @@ public class FileConsumeSimpleRelativeMoveToAbsoluteTest extends ContextTestSupp
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("file://target/move?recursive=true&move=" + base + "/.done")
+                from("file://target/move?recursive=true&move=" + base + "/.done&initialDelay=0&delay=10")
                         .convertBodyTo(String.class).to("mock:result");
             }
         };

http://git-wip-us.apache.org/repos/asf/camel/blob/ffc08f48/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSimpleRelativeMoveToRelativeTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSimpleRelativeMoveToRelativeTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSimpleRelativeMoveToRelativeTest.java
index 6b0c96e..947b8dd 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSimpleRelativeMoveToRelativeTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSimpleRelativeMoveToRelativeTest.java
@@ -32,9 +32,6 @@ public class FileConsumeSimpleRelativeMoveToRelativeTest extends ContextTestSupp
     protected void setUp() throws Exception {
         deleteDirectory("target/move");
         super.setUp();
-        template.sendBodyAndHeader(fileUrl, "Bye World", Exchange.FILE_NAME, "bye.txt");
-        template.sendBodyAndHeader(fileUrl, "Hello World", Exchange.FILE_NAME, "sub/hello.txt");
-        template.sendBodyAndHeader(fileUrl, "Goodday World", Exchange.FILE_NAME, "sub/sub2/goodday.txt");
     }
 
     public void testMoveToSubDir() throws Exception {
@@ -44,6 +41,10 @@ public class FileConsumeSimpleRelativeMoveToRelativeTest extends ContextTestSupp
         mock.expectedFileExists("target/move/sub/.done/hello.txt");
         mock.expectedFileExists("target/move/sub/sub2/.done/goodday.txt");
 
+        template.sendBodyAndHeader(fileUrl, "Bye World", Exchange.FILE_NAME, "bye.txt");
+        template.sendBodyAndHeader(fileUrl, "Hello World", Exchange.FILE_NAME, "sub/hello.txt");
+        template.sendBodyAndHeader(fileUrl, "Goodday World", Exchange.FILE_NAME, "sub/sub2/goodday.txt");
+
         assertMockEndpointsSatisfied();
     }
 
@@ -52,7 +53,7 @@ public class FileConsumeSimpleRelativeMoveToRelativeTest extends ContextTestSupp
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("file://target/move?recursive=true&move=.done")
+                from("file://target/move?recursive=true&move=.done&initialDelay=0&delay=10")
                         .convertBodyTo(String.class).to("mock:result");
             }
         };

http://git-wip-us.apache.org/repos/asf/camel/blob/ffc08f48/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSingleDirectoryOnlyTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSingleDirectoryOnlyTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSingleDirectoryOnlyTest.java
index 25511a6..8b3b99b 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSingleDirectoryOnlyTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeSingleDirectoryOnlyTest.java
@@ -30,18 +30,16 @@ public class FileConsumeSingleDirectoryOnlyTest extends ContextTestSupport {
     protected void setUp() throws Exception {
         deleteDirectory("target/singledirectoryonly");
         super.setUp();
-        template.sendBodyAndHeader("file://target/singledirectoryonly", "Hello World", Exchange.FILE_NAME, "report.txt");
-        template.sendBodyAndHeader("file://target/singledirectoryonly", "Bye World", Exchange.FILE_NAME, "report2.txt");
-        template.sendBodyAndHeader("file://target/singledirectoryonly/2008", "2008 Report", Exchange.FILE_NAME, "report2008.txt");
     }
 
     public void testConsumeFileOnly() throws Exception {
         MockEndpoint mock = getMockEndpoint("mock:result");
-        // Default wait time of 10 sec is not quite long enough on slow
-        // machines.
-        mock.setResultWaitTime(15000L);
         mock.expectedBodiesReceivedInAnyOrder("Hello World", "Bye World");
 
+        template.sendBodyAndHeader("file://target/singledirectoryonly/2008", "2008 Report", Exchange.FILE_NAME, "report2008.txt");
+        template.sendBodyAndHeader("file://target/singledirectoryonly", "Hello World", Exchange.FILE_NAME, "report.txt");
+        template.sendBodyAndHeader("file://target/singledirectoryonly", "Bye World", Exchange.FILE_NAME, "report2.txt");
+
         assertMockEndpointsSatisfied();
     }
 
@@ -49,7 +47,7 @@ public class FileConsumeSingleDirectoryOnlyTest extends ContextTestSupport {
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                from("file://target/singledirectoryonly/?recursive=false&delete=true")
+                from("file://target/singledirectoryonly/?recursive=false&delete=true&initialDelay=0&delay=10")
                         .convertBodyTo(String.class).to("mock:result");
             }
         };

http://git-wip-us.apache.org/repos/asf/camel/blob/ffc08f48/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeWithDollarInPathTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeWithDollarInPathTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeWithDollarInPathTest.java
index 3af9f37..b09101a 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeWithDollarInPathTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeWithDollarInPathTest.java
@@ -46,7 +46,7 @@ public class FileConsumeWithDollarInPathTest extends ContextTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("file:" + dir).to("mock:result");
+                from("file:" + dir + "?initialDelay=0&delay=10").to("mock:result");
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/ffc08f48/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerNoopTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerNoopTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerNoopTest.java
index edd1c28..98c240a 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerNoopTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerNoopTest.java
@@ -17,6 +17,7 @@
 package org.apache.camel.component.file;
 
 import java.io.File;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.Exchange;
@@ -33,21 +34,19 @@ public class FileConsumerNoopTest extends ContextTestSupport {
     protected void setUp() throws Exception {
         deleteDirectory("target/filenoop");
         super.setUp();
-        template.sendBodyAndHeader("file://target/filenoop", "Hello World", Exchange.FILE_NAME, "hello.txt");
-        template.sendBodyAndHeader("file://target/filenoop", "Bye World", Exchange.FILE_NAME, "bye.txt");
     }
 
     public void testNoop() throws Exception {
-        NotifyBuilder notify = new NotifyBuilder(context).whenDone(2).create();
-
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMessageCount(2);
-        assertMockEndpointsSatisfied();
 
-        notify.matchesMockWaitTime();
+        template.sendBodyAndHeader("file://target/filenoop", "Hello World", Exchange.FILE_NAME, "hello.txt");
+        template.sendBodyAndHeader("file://target/filenoop", "Bye World", Exchange.FILE_NAME, "bye.txt");
+
+        assertMockEndpointsSatisfied();
 
-        File file = new File("target/filenoop");
-        assertEquals("There should be 2 files", 2, file.list().length);
+        assertTrue(new File("target/filenoop/hello.txt").exists());
+        assertTrue(new File("target/filenoop/bye.txt").exists());
     }
 
     @Override
@@ -55,7 +54,8 @@ public class FileConsumerNoopTest extends ContextTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("file://target/filenoop?noop=true&initialDelay=0&delay=10").convertBodyTo(String.class).to("mock:result");
+                from("file://target/filenoop?noop=true&initialDelay=0&delay=10")
+                    .convertBodyTo(String.class).to("mock:result");
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/ffc08f48/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyPolledMessagesTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyPolledMessagesTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyPolledMessagesTest.java
index f88198c..e6f2d68 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyPolledMessagesTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyPolledMessagesTest.java
@@ -36,7 +36,7 @@ public class FileConsumerPollStrategyPolledMessagesTest extends ContextTestSuppo
     private static int maxPolls;
     private final CountDownLatch latch = new CountDownLatch(1);
 
-    private String fileUrl = "file://target/pollstrategy/?consumer.pollStrategy=#myPoll";
+    private String fileUrl = "file://target/pollstrategy/?consumer.pollStrategy=#myPoll&initialDelay=0&delay=10";
 
     @Override
     protected JndiRegistry createRegistry() throws Exception {

http://git-wip-us.apache.org/repos/asf/camel/blob/ffc08f48/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyStopOnRollbackTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyStopOnRollbackTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyStopOnRollbackTest.java
index 0408ae3..1c007f4 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyStopOnRollbackTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPollStrategyStopOnRollbackTest.java
@@ -34,7 +34,7 @@ public class FileConsumerPollStrategyStopOnRollbackTest extends ContextTestSuppo
     private static int counter;
     private static volatile String event = "";
 
-    private String fileUrl = "file://target/pollstrategy/?pollStrategy=#myPoll";
+    private String fileUrl = "file://target/pollstrategy/?pollStrategy=#myPoll&initialDelay=0&delay=10";
 
     @Override
     protected JndiRegistry createRegistry() throws Exception {
@@ -55,7 +55,7 @@ public class FileConsumerPollStrategyStopOnRollbackTest extends ContextTestSuppo
         mock.expectedMessageCount(0);
 
         // let it run for a little while and since it fails first time we should never get a message
-        mock.assertIsSatisfied(2000);
+        mock.assertIsSatisfied(50);
 
         assertEquals("rollback", event);
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/ffc08f48/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveCopyAndDeleteOnRenameFailFalseTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveCopyAndDeleteOnRenameFailFalseTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveCopyAndDeleteOnRenameFailFalseTest.java
index d09354e..2b9ec2b 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveCopyAndDeleteOnRenameFailFalseTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveCopyAndDeleteOnRenameFailFalseTest.java
@@ -28,7 +28,7 @@ public class FileConsumerPreMoveCopyAndDeleteOnRenameFailFalseTest extends FileC
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("file://target/premove?preMove=work/work-${file:name}&initialDelay=0&delay=100&copyAndDeleteOnRenameFail=false")
+                from("file://target/premove?preMove=work/work-${file:name}&initialDelay=0&delay=10&copyAndDeleteOnRenameFail=false")
                     .process(new MyPreMoveCheckerProcessor())
                     .to("mock:result");
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/ffc08f48/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveIssueTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveIssueTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveIssueTest.java
index 49b3f67..4a40075 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveIssueTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveIssueTest.java
@@ -49,7 +49,7 @@ public class FileConsumerPreMoveIssueTest extends ContextTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("file://target/premove?preMove=before/${file:name.noext}-moved.${file:ext}")
+                from("file://target/premove?preMove=before/${file:name.noext}-moved.${file:ext}&initialDelay=0&delay=10")
                     .process(new MyPreMoveCheckerProcessor())
                     .to("mock:result");
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/ffc08f48/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveTest.java
index 36b9eba..9ad0a69 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveTest.java
@@ -66,7 +66,7 @@ public class FileConsumerPreMoveTest extends ContextTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("file://target/premove?preMove=work/work-${file:name}&initialDelay=0&delay=100")
+                from("file://target/premove?preMove=work/work-${file:name}&initialDelay=0&delay=10")
                     .process(new MyPreMoveCheckerProcessor())
                     .to("mock:result");
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/ffc08f48/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveWithProbeContentTypeTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveWithProbeContentTypeTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveWithProbeContentTypeTest.java
index d4a4848..ffca435 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveWithProbeContentTypeTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveWithProbeContentTypeTest.java
@@ -47,7 +47,7 @@ public class FileConsumerPreMoveWithProbeContentTypeTest extends ContextTestSupp
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("file://target/premove?probeContentType=true&preMove=work/work-${file:name}&initialDelay=0&delay=100")
+                from("file://target/premove?probeContentType=true&preMove=work/work-${file:name}&initialDelay=0&delay=10")
                     .to("mock:result");
             }
         };

http://git-wip-us.apache.org/repos/asf/camel/blob/ffc08f48/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerProducerRouteTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerProducerRouteTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerProducerRouteTest.java
index cde4484..ddf7b89b 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerProducerRouteTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerProducerRouteTest.java
@@ -30,14 +30,15 @@ public class FileConsumerProducerRouteTest extends ContextTestSupport {
     protected void setUp() throws Exception {
         deleteDirectory("target/file-test");
         super.setUp();
-        template.sendBodyAndHeader("file://target/file-test/a", "Hello World", Exchange.FILE_NAME, "hello.txt");
-        template.sendBodyAndHeader("file://target/file-test/a", "Bye World", Exchange.FILE_NAME, "bye.txt");
     }
 
     public void testFileRoute() throws Exception {
         MockEndpoint result = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
         result.expectedMessageCount(2);
 
+        template.sendBodyAndHeader("file://target/file-test/a", "Hello World", Exchange.FILE_NAME, "hello.txt");
+        template.sendBodyAndHeader("file://target/file-test/a", "Bye World", Exchange.FILE_NAME, "bye.txt");
+
         result.assertIsSatisfied();
     }
 
@@ -45,8 +46,8 @@ public class FileConsumerProducerRouteTest extends ContextTestSupport {
     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {
-                from("file:target/file-test/a").to("file:target/file-test/b");
-                from("file:target/file-test/b").to("mock:result");
+                from("file:target/file-test/a?initialDelay=0&delay=10").to("file:target/file-test/b");
+                from("file:target/file-test/b?initialDelay=0&delay=10").to("mock:result");
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/ffc08f48/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerRelativeFileNameTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerRelativeFileNameTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerRelativeFileNameTest.java
index e208679..e9362fa 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerRelativeFileNameTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerRelativeFileNameTest.java
@@ -30,11 +30,6 @@ public class FileConsumerRelativeFileNameTest extends ContextTestSupport {
     protected void setUp() throws Exception {
         deleteDirectory("target/filename-consumer");
         super.setUp();
-        // the file name is also starting with target/filename-consumer
-        template.sendBodyAndHeader("file:target/filename-consumer", "Hello World",
-                Exchange.FILE_NAME, "target/filename-consumer-hello.txt");
-        template.sendBodyAndHeader("file:target/filename-consumer", "Bye World",
-                Exchange.FILE_NAME, "target/filename-consumer-bye.txt");
     }
 
     public void testValidFilenameOnExchange() throws Exception {
@@ -43,6 +38,14 @@ public class FileConsumerRelativeFileNameTest extends ContextTestSupport {
         // should have file name header set
         mock.allMessages().header(Exchange.FILE_NAME).isNotNull();
 
+        // the file name is also starting with target/filename-consumer
+        template.sendBodyAndHeader("file:target/filename-consumer", "Hello World",
+            Exchange.FILE_NAME, "target/filename-consumer-hello.txt");
+        template.sendBodyAndHeader("file:target/filename-consumer", "Bye World",
+            Exchange.FILE_NAME, "target/filename-consumer-bye.txt");
+
+        context.startAllRoutes();
+
         assertMockEndpointsSatisfied();
 
         // and expect name to contain target/filename-consumer-XXX.txt
@@ -55,7 +58,9 @@ public class FileConsumerRelativeFileNameTest extends ContextTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("file:target/filename-consumer?recursive=true&sortBy=file:name").to("mock:result");
+                from("file:target/filename-consumer?initialDelay=0&delay=10&recursive=true&sortBy=file:name")
+                    .noAutoStartup()
+                    .to("mock:result");
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/ffc08f48/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSharedThreadPollTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSharedThreadPollTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSharedThreadPollTest.java
index fb0e582..2ab3ef2 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSharedThreadPollTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSharedThreadPollTest.java
@@ -69,10 +69,10 @@ public class FileConsumerSharedThreadPollTest extends ContextTestSupport {
                 pool = new ThreadPoolBuilder(context).poolSize(1).buildScheduled(this, "MySharedPool");
                 registry.put("myPool", pool);
 
-                from("file:target/a?scheduledExecutorService=#myPool").routeId("a")
+                from("file:target/a?initialDelay=0&delay=10&scheduledExecutorService=#myPool").routeId("a")
                     .to("direct:shared");
 
-                from("file:target/b?scheduledExecutorService=#myPool").routeId("b")
+                from("file:target/b?initialDelay=0&delay=10&scheduledExecutorService=#myPool").routeId("b")
                     .to("direct:shared");
 
                 from("direct:shared").routeId("shared")

http://git-wip-us.apache.org/repos/asf/camel/blob/ffc08f48/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSkipDotFilesTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSkipDotFilesTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSkipDotFilesTest.java
index c2d55ba..38ee233 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSkipDotFilesTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerSkipDotFilesTest.java
@@ -26,7 +26,7 @@ import org.apache.camel.component.mock.MockEndpoint;
  */
 public class FileConsumerSkipDotFilesTest extends ContextTestSupport {
 
-    private String fileUrl = "file://target/dotfiles/";
+    private String fileUrl = "file://target/dotfiles/?initialDelay=0&delay=10";
 
     @Override
     protected void setUp() throws Exception {
@@ -37,17 +37,16 @@ public class FileConsumerSkipDotFilesTest extends ContextTestSupport {
     public void testSkipDotFiles() throws Exception {
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMessageCount(0);
+        mock.setResultWaitTime(100);
 
         template.sendBodyAndHeader("file:target/dotfiles/", "This is a dot file",
             Exchange.FILE_NAME, ".skipme");
 
-        mock.setResultWaitTime(2000);
         mock.assertIsSatisfied();
     }
 
     public void testSkipDotFilesWithARegularFile() throws Exception {
         MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedMessageCount(1);
         mock.expectedBodiesReceived("Hello World");
 
         template.sendBodyAndHeader("file:target/dotfiles/", "This is a dot file",

http://git-wip-us.apache.org/repos/asf/camel/blob/ffc08f48/camel-core/src/test/java/org/apache/camel/component/file/FileContentBasedRouterTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileContentBasedRouterTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileContentBasedRouterTest.java
index 923df5b..dc4ef39 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileContentBasedRouterTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileContentBasedRouterTest.java
@@ -38,31 +38,30 @@ public class FileContentBasedRouterTest extends ContextTestSupport {
     }
 
     public void testRouteLondon() throws Exception {
-        sendFiles();
-
         MockEndpoint mock = getMockEndpoint("mock:london");
         mock.expectedMessageCount(1);
         // should not load the content of the body into memory unless demand for it
         // so the type received should be a GenericFile (holder for the file)
         mock.message(0).body().isInstanceOf(GenericFile.class);
 
+        sendFiles();
+
         assertMockEndpointsSatisfied();
     }
 
     public void testRouteParis() throws Exception {
-        sendFiles();
-
         MockEndpoint mock = getMockEndpoint("mock:paris");
         mock.expectedMessageCount(1);
         // should not load the content of the body into memory unless demand for it
         // so the type received should be a GenericFile (holder for the file)
         mock.message(0).body().isInstanceOf(GenericFile.class);
 
+        sendFiles();
+
         assertMockEndpointsSatisfied();
     }
 
     public void testRouteOther() throws Exception {
-        sendFiles();
 
         MockEndpoint mock = getMockEndpoint("mock:other");
         mock.expectedMessageCount(1);
@@ -71,6 +70,8 @@ public class FileContentBasedRouterTest extends ContextTestSupport {
         // so the type received should be a GenericFile (holder for the file)
         mock.message(0).body().isInstanceOf(GenericFile.class);
 
+        sendFiles();
+
         assertMockEndpointsSatisfied();
     }
 
@@ -79,7 +80,7 @@ public class FileContentBasedRouterTest extends ContextTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("file://target/cbr?noop=true")
+                from("file://target/cbr?noop=true&initialDelay=0&delay=10")
                     .choice()
                         .when(header("CamelFileName").isEqualTo("london.txt")).to("mock:london")
                         .when(header("CamelFileName").isEqualTo("paris.txt")).to("mock:paris")