camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1049816 - in /camel/trunk/camel-core/src/test/java/org/apache/camel/component/file: FileConsumerPreMoveDeleteTest.java FileConsumerPreMoveNoopTest.java FileConsumerPreMoveTest.java
Date Thu, 16 Dec 2010 08:39:27 GMT
Author: davsclaus
Date: Thu Dec 16 08:39:26 2010
New Revision: 1049816

URL: http://svn.apache.org/viewvc?rev=1049816&view=rev
Log:
Fixed tests.

Modified:
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveDeleteTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveNoopTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveTest.java

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveDeleteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveDeleteTest.java?rev=1049816&r1=1049815&r2=1049816&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveDeleteTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveDeleteTest.java
Thu Dec 16 08:39:26 2010
@@ -51,18 +51,22 @@ public class FileConsumerPreMoveDeleteTe
 
     public void testPreMoveDeleteSameFileTwice() throws Exception {
         MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedBodiesReceivedInAnyOrder("Hello World", "Hello Again World");
+        mock.expectedBodiesReceived("Hello World");
 
         template.sendBodyAndHeader("file://target/premove", "Hello World", Exchange.FILE_NAME,
"hello.txt");
-        // give time for consumer to process this file before we drop the next file
-        Thread.sleep(100);
-        template.sendBodyAndHeader("file://target/premove", "Hello Again World", Exchange.FILE_NAME,
"hello.txt");
-        // give time for consumer to process this file before we drop the next file
 
         assertMockEndpointsSatisfied();
+        oneExchangeDone.matchesMockWaitTime();
+
+        // reset and drop the same file again
+        mock.reset();
+        oneExchangeDone.reset();
+        mock.expectedBodiesReceived("Hello Again World");
 
-        // and file should still be deleted
-        Thread.sleep(250);
+        template.sendBodyAndHeader("file://target/premove", "Hello Again World", Exchange.FILE_NAME,
"hello.txt");
+
+        assertMockEndpointsSatisfied();
+        oneExchangeDone.matchesMockWaitTime();
 
         File pre = new File("target/premove/work/hello.txt").getAbsoluteFile();
         assertFalse("Pre move file should have been deleted", pre.exists());

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveNoopTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveNoopTest.java?rev=1049816&r1=1049815&r2=1049816&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveNoopTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveNoopTest.java
Thu Dec 16 08:39:26 2010
@@ -21,6 +21,7 @@ import java.io.File;
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
+import org.apache.camel.builder.NotifyBuilder;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 
@@ -51,18 +52,22 @@ public class FileConsumerPreMoveNoopTest
 
     public void testPreMoveNoopSameFileTwice() throws Exception {
         MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedBodiesReceivedInAnyOrder("Hello World", "Hello Again World");
+        mock.expectedBodiesReceived("Hello World");
 
         template.sendBodyAndHeader("file://target/premove", "Hello World", Exchange.FILE_NAME,
"hello.txt");
-        // give time for consumer to process this file before we drop the next file
-        Thread.sleep(100);
-        template.sendBodyAndHeader("file://target/premove", "Hello Again World", Exchange.FILE_NAME,
"hello.txt");
-        // give time for consumer to process this file before we drop the next file
 
         assertMockEndpointsSatisfied();
+        oneExchangeDone.matchesMockWaitTime();
 
-        // and file should still be there in premove directory
-        Thread.sleep(250);
+        // reset and drop the same file again
+        mock.reset();
+        oneExchangeDone.reset();
+        mock.expectedBodiesReceived("Hello Again World");
+
+        template.sendBodyAndHeader("file://target/premove", "Hello Again World", Exchange.FILE_NAME,
"hello.txt");
+
+        assertMockEndpointsSatisfied();
+        oneExchangeDone.matchesMockWaitTime();
 
         File pre = new File("target/premove/work/hello.txt").getAbsoluteFile();
         assertTrue("Pre move file should exist", pre.exists());

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveTest.java?rev=1049816&r1=1049815&r2=1049816&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerPreMoveTest.java
Thu Dec 16 08:39:26 2010
@@ -46,13 +46,18 @@ public class FileConsumerPreMoveTest ext
 
     public void testPreMoveSameFileTwice() throws Exception {
         MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.expectedBodiesReceivedInAnyOrder("Hello World", "Hello Again World");
+        mock.expectedBodiesReceived("Hello World");
 
         template.sendBodyAndHeader("file://target/premove", "Hello World", Exchange.FILE_NAME,
"hello.txt");
-        // give time for consumer to process this file before we drop the next file
-        Thread.sleep(100);
+
+        assertMockEndpointsSatisfied();
+        oneExchangeDone.matchesMockWaitTime();
+
+        // reset and drop the same file again
+        mock.reset();
+        mock.expectedBodiesReceived("Hello Again World");
+
         template.sendBodyAndHeader("file://target/premove", "Hello Again World", Exchange.FILE_NAME,
"hello.txt");
-        // give time for consumer to process this file before we drop the next file
         assertMockEndpointsSatisfied();
     }
 



Mime
View raw message