camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem jiang <willem.ji...@gmail.com>
Subject Re: Confused : ModelCamelContext Vs CamelContext and RouteDefinition Vs Route?
Date Tue, 26 Feb 2013 01:25:24 GMT
Hi,

CamelContext is a SPI of Camel , we add to ModelCamelContext to make the API clean.  
ModelCamelContext provides the Model level options those could be used across Java DSL, Spring
DSL, Scala DSL etc.


RouteDefinition is same with the ModelCamelContext, is a part of Camel modeling data, if you
want to access the internal Camel model information, you should use it.

I'm not sure which version of Camel are you using, but you could use context to access the
ModelCamelContext from the CamelTestSupport in the last released Camel.  

--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Tuesday, February 26, 2013 at 6:05 AM, shyenuganti wrote:

> I am trying to write tests to my route.
>  
> CamelTestSupport has camel context which is of type ModelCamelContext. We
> have a method in that : ModelCamelContext.getRouteDefinitions().
>  
> When I try that using a regular CamelContext like
> CamelContext.getRouteDefinitions(), it says the method is deprecated.  
>  
> What is the difference between ModelCamelContext and CamelContext ?  
>  
> I am trying to use Route.adviceWith() method to replace the JMS endpoint on
> the fly with a mock to test my route. This way I can test my production
> route without having to use mocks. But this method is deprecaated. I see a
> similar method in RouteDefinition.adviceWith().  
>  
> What is the difference between "RouteDefinition" and a "Route"? What are the
> specific uses of each? If I want to use "adviceWith() " inside a test class
> that does not extend CamelSpringTestSupport, how can I use it as I will not
> have access to ModelCamelContext here.
>  
> My test class looks like this  
>  
> @ContextConfiguration(locations =
> "classpath:META-INF/spring/testCamelContext.xml")
> @RunWith(CamelSpringJUnit4ClassRunner.class)
> @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD)
> public class EventListenerRouteTest{
>  
> @Autowired
> protected CamelContext camelContext;
>  
> @EndpointInject(uri = "mock:JMSMock", context = "camelContext")
> protected MockEndpoint mock;
>  
> @Produce(uri = "direct:eventMessageList", context = "camelContext")
> protected ProducerTemplate producer;
>  
> ..........
> ....
> ..
>  
> }
>  
>  
>  
> Please help. fyi : I am very new to camel :)
>  
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Confused-ModelCamelContext-Vs-CamelContext-and-RouteDefinition-Vs-Route-tp5728129.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).




Mime
View raw message