Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Name

Description

Camel Test

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

Spring Testing

uses Spring Test together with either XML or Java Config to dependency inject your test classes

Guice

uses Guice to dependency inject your test classes

Blueprint Testing

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.

...