Versions Compared

Key

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

...

In all approaches the test classes look pretty much the same in that they all reuse the Camel binding and injection annotations.

TODO - show examples

Testing endpoints

Camel provides a number of endpoints which can make testing easier.

Name

Description

DataSet

For load & soak testing this endpoint provides a way to create huge numbers of messages for sending to Components and asserting that they are consumed correctly

Mock

For testing routes and mediation rules using mocks and allowing assertions to be added to an endpoint

Test

Creates a Mock endpoint which expects to receive all the message bodies that could be polled from the given underlying endpoint

The main endpoint is the Mock endpoint which allows expectations to be added to different endpoints; you can then run your tests and assert that your expectations are met at the end.

Mocking out physical transport technologies

If you wish to test out a route but want to avoid actually using a real physical transport (for example to unit test a transformation route rather than performing a full integration test) then the following endpoints can be useful.

Name

Description

Direct

Direct invocation of the consumer from the producer so that single threaded (non-SEDA) in VM invocation is performed which can be useful to mock out physical transports

SEDA

Delivers messages asynchonously to consumers via a java.util.concurrent.BlockingQueue which is good for testing asynchronous transports