Post on 28-Jul-2015
Agenda• Test Kit Overview• Simple testing with JUnit• Testing with Spring• Testing with Blueprint• Q & A
Test Kit Overview• Testing Mechanisms
– camel-test– camel-testng– camel-test-spring– camel-test-blueprint
http://camel.apache.org/testing.html
Simple Testing• You need the camel-test module• Your test should extend the CamelTestSupport class and…• Typically you will need to override the createRouteBuilder() method• JNDI Registry
http://camel.apache.org/camel-test.html
Spring Testing• You need the camel-test-spring module• Use the @RunWith(SpringJUnit4ClassRunner.class) annotation• Provide your configuration using an XML file…
– src/test/java/org/istabg/camel/examples/SpringFilterTest.java– src/test/java/org/istabg/camel/examples/SpringFilterTest-context.xml
• or use the Java DSL with a configuration loader
http://camel.apache.org/spring-testing.html
Blueprint Testing• You need the camel-test-blueprint module• Your test should extend the CamelBlueprintTestSupport class and…• Specify the Blueprint descriptor location
http://camel.apache.org/blueprint-testing.html
Testing Endpoints• Mock – Allows assertions to be added to an endpoint.• Test – Pulls expected message bodies from an endpoint, e.g. file.• DataSet – Used for load & soak testing.