...
Name | Description |
---|---|
is a library letting you easily create Camel test cases using a single Java class for all your configuration and routing without using Spring or Guice for Dependency Injection which does not require an in depth knowledge of Spring+SpringTest or Guice | |
uses Spring Test together with either XML or Java Config to dependency inject your test classes | |
uses Guice to dependency inject your test classes | |
provides the ability to do unit testing on blueprint configurations |
In all approaches the test classes look pretty much the same in that they all reuse the Camel binding and injection annotations.
...
Its totally optional but for the ContextConfig implementation we derive from SingleRouteCamelConfiguration which is a helper Spring Java Config class which will configure the CamelContext for us and then register the RouteBuilder we create.
Blueprint Test
Here is the Blueprint Testing example using XML Config.
Wiki Markup |
---|
{snippet:lang=java|id=example|url=camel/trunk/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/DebugBlueprintTest.java} |
Also notice the use of getBlueprintDescriptors
to indicate that by default we should look for the camelContext.xml in the package to configure the test case which looks like this
Wiki Markup |
---|
{snippet:lang=xml|id=example|url=camel/trunk/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/camelContext.xml} |
Testing endpoints
Camel provides a number of endpoints which can make testing easier.
...