You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Josef Karasek <ka...@gmail.com> on 2015/03/13 20:32:00 UTC

Re: Would like to work on CAMEL-6070

Working on the runner, issues how to provide customization to users have
emerged.
CamelTestSupport has plenty of methods, that can be overridden.
Because of the declarative manner of JUnit runners, providing users with
methods which they can
override is not possible and therefore the level of customization is
limited.

E.g. if user wants to create custom CamelContext or add property to the
default one.
The way that I see is to provide extra annotations, that are relevant for
testing only.

Use case #1: User wants to customize the default Context:

@RunWith(Camel.class)
public class TestCase {

    @Context
    public Context context;

    @Before
    public void usingContext() {
        context.addLifecycleStrategy(myStrategy);
        //Whatever you need...
    }
}

Use case #2: User wants to create entirely new Context:

@RunWith(Camel.class)
public class TestCase {

    @Context
    public Context myContext() {
        return new Context( {
            // The new context
        } );
    }
}

CamelContext is of course just an example. There are many more objects
needed for test
customization (Template...)

*Any feedback appreciated.*



--
View this message in context: http://camel.465427.n5.nabble.com/Would-like-to-work-on-CAMEL-6070-tp5763192p5764115.html
Sent from the Camel Development mailing list archive at Nabble.com.