The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

solomon_13000 (34) [Avatar] Offline
package org.test;
import org.apache.camel.builder.RouteBuilder;

public class DispatcherRouteBuilder extends RouteBuilder {
public void configure() throws Exception{


package org.test;
import org.apache.camel.CamelContext;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

public class DispatcherRouteBuilderTest extends CamelTestSupport {

ProducerTemplate template;

protected RouteBuilder createRouteBuilder() throws Exception{
return new DispatcherRouteBuilder();
public void setUpClass() throws Exception{
BrokerService brokerSvc = new BrokerService();
brokerSvc.setDataDirectory("C:\Program Files\db");
public void testConfigure() throws Exception{
CamelContext context = super.createCamelContext();
template = context.createProducerTemplate();


My IDE was displaying the following information:

Sep 26, 2012 10:10:45 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [TestCamel.xml]
636 [main] INFO - PListStore:Csmilierogram FilesdbTestBroker mp_storage started
647 [main] INFO - Using Persistence Adapter: KahaDBPersistenceAdapter[Csmilierogram FilesdbTestBrokerKahaDB]
1374 [main] INFO - KahaDB is version 3
1547 [main] INFO - Recovering from the journal ...
1565 [main] INFO - Recovery replayed 2 operations from the journal in 0.161 seconds.
1662 [main] INFO - ActiveMQ 5.5.0 JMS Message Broker (TestBroker) is starting
1662 [main] INFO - For help or more information please see:
1962 [main] INFO org.apache.activemq.transport.TransportServerThreadSupport - Listening for connections at: tcp://
1962 [main] INFO - Connector tcp:// Started
2001 [main] INFO - ActiveMQ JMS Message Broker (TestBroker, ID:Eugene-VAIO-52598-1348668647904-0:1) started
2724 [main] INFO org.apache.camel.impl.converter.DefaultTypeConverter - Loaded 175 type converters
3230 [main] INFO - JMX enabled.


It appears that at this like of the code:


the action is idle as in the 'Testing-2' is not displayed.
davsclaus (413) [Avatar] Offline
Re: template.sendBody idle
In your test method you are creating CamelContext again. You should not do that, as the CamelTestSupport class already does this for you.
davsclaus (413) [Avatar] Offline
Re: template.sendBody idle
Chapter 7 covers JMS. You may want to take a look at that, as the source code for this has examples with ActiveMQ, Camel and unit tests, eg how to do that.

And chapter 6 talks about testing, which would be a good read as well.