activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r520215 - /activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/jms/JmsRouteTest.java
Date Tue, 20 Mar 2007 02:03:19 GMT
Author: jstrachan
Date: Mon Mar 19 19:03:18 2007
New Revision: 520215

URL: http://svn.apache.org/viewvc?view=rev&rev=520215
Log:
made test case actually fail if we don't receive the message from JMS after routing from one
destination to another :)

Modified:
    activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/jms/JmsRouteTest.java

Modified: activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/jms/JmsRouteTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/jms/JmsRouteTest.java?view=diff&rev=520215&r1=520214&r2=520215
==============================================================================
--- activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/jms/JmsRouteTest.java (original)
+++ activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/jms/JmsRouteTest.java Mon
Mar 19 19:03:18 2007
@@ -27,16 +27,18 @@
 import org.springframework.jms.core.JmsTemplate;
 
 import javax.jms.Session;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
 
 /**
  * @version $Revision$
  */
 public class JmsRouteTest extends TestCase {
     public void testJmsRoute() throws Exception {
+        final CountDownLatch latch = new CountDownLatch(1);
+
         CamelContainer container = new CamelContainer();
 
-        System.out.println("Created container: " + container);
-        
         // lets configure some componnets
         JmsTemplate template = new JmsTemplate(new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false"));
         template.setSessionAcknowledgeMode(Session.AUTO_ACKNOWLEDGE);
@@ -51,6 +53,7 @@
                 from("jms:activemq:test.b").process(new Processor<JmsExchange>() {
                     public void onExchange(JmsExchange exchange) {
                         System.out.println("Received exchange: " + exchange.getRequest());
+                        latch.countDown();
                     }
                 });
             }
@@ -64,7 +67,8 @@
         endpoint.send(exchange2);
 
         // now lets sleep for a while
-        Thread.sleep(3000);
+        boolean received = latch.await(5, TimeUnit.SECONDS);
+        assertTrue("Did not recieve the message!", received);
 
         // TODO
         //container.stop();



Mime
View raw message