...
This test will load a Spring XML configuration file called MyCamelTest-context.xml from the classpath in the same package structure as the MyCamelTest class and initialize it along with any Camel routes we define inside it, then inject the CamelContext instance into our test case.
For instance, like this maven folder layout:
Code Block |
---|
src/main/java/com/mycompany/MyCamelTest.class
src/main/resources/com/mycompany/MyCamelTest-context.xml
|
You can overload the method createApplicationContext
to provide the Spring ApplicationContext that isn't following the above default. For instance:
Code Block | ||||
---|---|---|---|---|
| ||||
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("/config/MySpringConfig.xml");
}
|
Then the test method will then run which invokes the MockEndpoint.assertIsSatisfied(camelContext) method which asserts that all of the Mock and Test endpoints have their expectations met.
...