Versions Compared

Key

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

...

Name

Component

Description

Camel Test

camel-test

Is a standalone Java 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 + Spring Test or Guice.  Supports JUnit 3.x (deprecated) and JUnit 4.x based tests.

Spring Testing

camel-test-spring

Supports JUnit 3.x (deprecated) or JUnit 4.x based tests that bootstrap a test environment using Spring without needing to be familiar with Spring Test.  The  plain JUnit 3.x/4.x based tests work very similar to the test support classes in camel-test.  Also supports Spring Test based tests that use the declarative style of test configuration and injection common in Spring Test.  The Spring Test based tests provide feature parity with the plain JUnit 3.x/4.x based testing approach.  Notice camel-test-spring is a new component in Camel 2.10 onwards. For older Camel release use camel-test which has built-in Spring Testing.

Blueprint Testing

camel-test-blueprint

Camel 2.10: Provides the ability to do unit testing on blueprint configurations

Guice

camel-guice

Uses Guice to dependency inject your test classes

Camel TestNG

camel-testng

Supports plain TestNG based tests with or without Spring or Guice for Dependency Injection which does not require an in-depth knowledge of Spring + Spring Test or Guice.  Also from Camel 2.10 onwards, this component supports Spring Test based tests that use the declarative style of test configuration and injection common in Spring Test.

...

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.

Spring Test with XML Config and Declarative Configuration Example

Here is a Camel test support enhanced Spring Testing example using XML Config and pure Spring Test based configuration of the Camel Context.

Wiki Markup
{snippet:lang=java|id=e1|url=camel/trunk/components/camel-test-spring/src/test/java/org/apache/camel/test/junit4/CamelSpringJUnit4ClassRunnerPlainTest.java}

Notice how a custom test runner is used with the @RunWith annotation to support the features of CamelTestSupport through annotations on the test class.

Blueprint Test

Here is the Blueprint Testing example using XML Config.

...