I've read the testing page but it doesnt give any good eaxmple of using spring xml routes
Can you point me to an example of CamelSpringTestSupport ? I cant see any docs on it's usage? Thanks, Tom On Mon, Mar 28, 2011 at 4:27 PM, Claus Ibsen <[email protected]> wrote: > Hi > > Check out this page > http://camel.apache.org/testing > > You can then use any IoC means to inject the mocks, such as > @EndpointInjected or any of the Spring or the new @Resource from JDK6 > etc. > > Also you can extend CamelSpringTestSupport which allows you to load a > Spring XML file. > Thats often what we do to test Camel as CamelXXTestSupport is easy to > get mocks, producer template and whatnot without having to IoC them. > > > On Mon, Mar 28, 2011 at 5:11 PM, Tom Howe <[email protected]> wrote: > > I have a routes defined in CamelRoutes.xml and I would like to test them > by > > using the wrapping technique described at the bottom of > > http://camel.apache.org/mock.html. > > > > My CamelRoutes.xml > > <route autoStartup="true" xmlns=" > http://camel.apache.org/schema/spring > > "> > > <from uri="direct:start"/> > > <to uri="direct:end"/> > > </route> > > > > So I created CamelRoutesTest.xml containing: > > > > <import resource="CamelRoutes.xml"/> > > <bean id="mockAllEndpoints" > > class="org.apache.camel.impl.InterceptSendToMockEndpointStrategy"/> > > > > but I am not sure how to create a test that both loads the spring xml AND > > provides access to the mock endpoints. > > > > If I use.. > > > > @ContextConfiguration( locations=("/CamelRoutesTest")) > > public class CamelTest extends AbstractJUnit38SpringContextTests > > > > } > > > > then I have no idea how to *get* the mock endpoints > > > > If I use.. > > > > public class CamelTest extends CamelTestSupport > > > > } > > > > then I dont know how to load my camel context.. > > > > > > I can't seem to find an example test on the website that uses > > CamelTestSupport AND loads routes from spring xml. > > > > thanks, Tom > > > > > > -- > Claus Ibsen > ----------------- > FuseSource > Email: [email protected] > Web: http://fusesource.com > Twitter: davsclaus > Blog: http://davsclaus.blogspot.com/ > Author of Camel in Action: http://www.manning.com/ibsen/ >
