Details
-
New Feature
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
Unknown
Description
Historically testing with camel is based on extending CamelTestSupport which gives you all the testing features from the base class.
When using spring boot, you can use spring boot style testing with annotations, or extend CamelSpringTestSupport.
For camel-main-test then we can also have a set of annotations as I think users will relate to this coming from spring boot world.
@CamelMainTest(MyApp.class) public class MyAppTest { @BeanInject CamelContext camelContext; @Test public void testFoo() throws Exception { // my test content here } }
And also a variation where you can refer to classes and properties to set as initial properties on the properties component
@CamelMainTest(class = MyApp.class, properties = {"camel.component.xxx=123", "period=1000", "hi=World"}) public class MyAppTest { @BeanInject CamelContext camelContext; @Test public void testFoo() throws Exception { // my test content here } }
Take a look at the @SpringBootTest annotation and its features as inspiration.
And you can also extend the base class but use the annotations to make it stand out and also configure the main class etc
@CamelMainTest(class = MyApp.class, properties = {"camel.component.xxx=123", "period=1000", "hi=World"}) public class MyAppTest extends CamelMainTest { @Test public void testFoo() throws Exception { // camelContext is avail from the base class so no need for @BeanInject } }
Attachments
Issue Links
- is related to
-
CAMEL-17574 camel-test-main - Test module for camel-main applications
- Resolved
- links to