[ 
https://issues.apache.org/jira/browse/CAMEL-17690?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17497404#comment-17497404
 ] 

Claus Ibsen commented on CAMEL-17690:
-------------------------------------

Yeah lets wait with the hybrid mode, and focus on the annotation based first - 
that mirrors also practice from spring boot

> camel-test-main - Annotation based testing
> ------------------------------------------
>
>                 Key: CAMEL-17690
>                 URL: https://issues.apache.org/jira/browse/CAMEL-17690
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-test
>            Reporter: Claus Ibsen
>            Assignee: Nicolas Filotto
>            Priority: Major
>             Fix For: 3.x
>
>
> 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 Excpetion {
> }
> 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 {
> }
> 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
> }



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to