svn commit: r702548 - /activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteToFileTest.java

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r702548 - /activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteToFileTest.java

janstey-3
Author: janstey
Date: Tue Oct  7 10:08:47 2008
New Revision: 702548

URL: http://svn.apache.org/viewvc?rev=702548&view=rev
Log:
Remove the Thread.sleep that was causing this test to fail on slower machines.

Modified:
    activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteToFileTest.java

Modified: activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteToFileTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteToFileTest.java?rev=702548&r1=702547&r2=702548&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteToFileTest.java (original)
+++ activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteToFileTest.java Tue Oct  7 10:08:47 2008
@@ -24,6 +24,7 @@
 import org.apache.camel.CamelContext;
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.converter.IOConverter;
 
 import static org.apache.camel.component.jms.JmsComponent.jmsComponentClientAcknowledge;
@@ -36,13 +37,16 @@
     protected String componentName = "activemq";
 
     public void testRouteToFile() throws Exception {
+        MockEndpoint result = getMockEndpoint("mock:result");
+        result.expectedMessageCount(1);
+        
         deleteDirectory("target/routetofile");
 
         template.sendBody("activemq:queue:hello", "Hello World");
 
         // pause to let file producer save the file
-        Thread.sleep(1500);
-
+        result.assertIsSatisfied();
+        
         // do file assertions
         File dir = new File("./target/routetofile");
         assertTrue("Should be directory", dir.isDirectory());
@@ -64,7 +68,9 @@
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                from("activemq:queue:hello").to("file://target/routetofile");
+                // using mock endpoint here purely for testing. You would normally write this route as
+                // from("activemq:queue:hello").to("file://target/routetofile");
+                from("activemq:queue:hello").to("file://target/routetofile").to("mock:result");
             }
         };
     }