Here is a sample route written in Camel for our application. This is our
first ever route in camel. 

This route reads Event Table in Oracle and AS400 systems, extracts an XML
message from the record and send the message to JMS queue.

All the JDBC and JMS endpoints are based on JNDI Lookup.

This is working fine. Now I am a bit confused on how to write
unit/integration tests for this route. Can anyone help me with  a sample
unit test methods for this route? 

Do we have to use "mocks" for testing? Cant we replace the components with
mocks on the fly ? Should we have multiple application context files in
test/resources thaat mocks the JPA and jms endpoints for testing ? 


Any comments on the route structure or any refactoring/best practice ideas
are welcome. Please assist.


public class EventListenerRoute 
        extends RouteBuilder
        implements InitializingBean, DisposableBean{
                
                public void configure() throws Exception {
                        
                
from("as400Jpa://org.model.EventQueue?consumeDelete=false&consumer.delay=5000")
                        .id("AS400ReaderEndpoint")
                        .convertBodyTo(org.model.EventQueue.class)
                        .to("direct:eventMessageList");
                         
                
from("oracleJpa://org.model.EventQueue?consumeDelete=false&consumer.delay=5000")
                        .id("OracleReaderEndpoint")
                        .convertBodyTo(org.model.EventQueue.class)
                        .to("direct:eventMessageList");
                        
                        from("direct:eventMessageList").id("PseudoEventQueue")
                        .log("Sending Message to Queue: jbossEventQueue")
                        
.to("jms:queue/jbossEventQueue?messageConverter=#myMessageConverter")
                        .log("Sent message to jbossEventQueue");

}



--
View this message in context: 
http://camel.465427.n5.nabble.com/My-First-Camel-Route-Need-help-unit-testing-and-refactoring-tp5728122.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to