...
Using org.apache.camel.test.junit4.CamelSpringJUnit4ClassRunner runner with the @RunWith annotation or extending org.apache.camel.testng.AbstractCamelTestNGSpringContextTests provides the full feature set of Spring Test with support for the feature set provided in the CamelTestSupport classes. A number of Camel specific annotations have been developed in order to provide for declarative manipulation of the Camel context(s) involved in the test. These annotations free your test classes from having to inherit from the CamelSpringTestSupport classes and also reduce the amount of code required to customize the tests.\
Annotation Class | Applies To | Description | Default Behavioir If Not Present | Default Behavior If Present |
---|---|---|---|---|
org.apache.camel.test.spring.DisableJmx | Class | Indicates if JMX should be globally disabled in the CamelContexts that are bootstrapped during the test through the use of Spring Test loaded application contexts. | JMX is disabled | JMX is disabled |
org.apache.camel.test.spring.ExcludeRoutes | Class | Indicates if certain route builder classes should be excluded from discovery. Initializes a org.apache.camel.spi.PackageScanClassResolver to exclude a set of given classes from being resolved. Typically this is used at test time to exclude certain routes, which might otherwise be just noisy, from being discovered and initialized. | Not enabled and no routes are excluded | No routes are excluded |
org.apache.camel.test.spring.LazyLoadTypeConverters (Deprecated) | Class | Indicates if the CamelContexts that are bootstrapped during the test through the use of Spring Test loaded application contexts should use lazy loading of type converters. | Type converters are not lazy loaded | Type converters are not lazy loaded |
org.apache.camel.test.spring.MockEndpoints | Class | Triggers the auto-mocking of endpoints whose URIs match the provided filter. The default filter is "*" which matches all endpoints. See org.apache.camel.impl.InterceptSendToMockEndpointStrategy for more details on the registration of the mock endpoints. | Not enabled | All endpoints are sniffed and recorded in a mock endpoint. |
org.apache.camel.test.spring.ProvidesBreakpoint | Method | Indicates that the annotated method returns an org.apache.camel.spi.Breakpoint for use in the test. Useful for intercepting traffic to all endpoints or simply for setting a break point in an IDE for debugging. The method must be public, static, take no arguments, and return org.apache.camel.spi.Breakpoint. | N/A | The returned Breakpoint is registered in the CamelContext(s) |
org.apache.camel.test.spring.ShutdownTimeout | Class | Indicates to set the shutdown timeout of all CamelContexts instantiated through the use of Spring Test loaded application contexts. If no annotation is used, the timeout is automatically reduced to 10 seconds by the test framework. | 10 seconds | 10 seconds |
org.apache.camel.test.spring.UseAdviceWith | Class | Indicates the use of adviceWith() within the test class. If a class is annotated with this annotation and UseAdviceWith#value() returns true, any CamelContexts bootstrapped during the test through the use of Spring Test loaded application contexts will not be started automatically. The test author is responsible for injecting the Camel contexts into the test and executing CamelContext#start() on them at the appropriate time after any advice has been applied to the routes in the CamelContext(s). | CamelContexts do not automatically start. | CamelContexts do not automatically start. |
...