camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen" <>
Subject Re: ContextTestSupport
Date Mon, 01 Dec 2008 20:20:08 GMT

Much better.

Is hamcrest needed as a dep? its in the pom.xml?
And log4j. as well. It could be optional, for those few end users that
use java util logging.

/Claus Ibsen
Apache Camel Committer

On Mon, Dec 1, 2008 at 9:02 PM, James Strachan <> wrote:
> 2008/12/1 James Strachan <>:
>> 2008/11/29 Claus Ibsen <>:
>>> Hi
>>> Actually I would love the we also supported the non bleeding edge
>>> developers that are *not* using Guice, Hamcrest and spring testing.
>>> I really understand Martins use-cases with rapid unit testing and
>>> having it all in a simple plain java file. I am not to keen on the
>>> java + spring xml for unit testing as you need two artifacts for this,
>>> and the files are not located in the same folder, so you need to
>>> navigate from src/test/java/.... to the same folder in
>>> src/test/resources. I know IDE support can help here but sometimes you
>>> actually browse using a plain text editor.
>>> So if CamelContextSupport or some other easy going can be used for
>>> easy plain old junit 3.8 testing in a single file then, and easy for
>>> end users to use then that has a big +1 for me
>> I totally hear you and agree! Its just that CamelContextSupport is
>> pretty basic (e.g. no support for Camel annotations). I find myself
>> using loads of magic helper methods or boiler plate code when Spring
>> Test and the Camel annotations gets rid of them all.
>> In general terms I think the best solution going forward is going to
>> be to use either Spring Test + JavaConfig really (when it works) or
>> Guice which will allow a single Java class to define the test, be
>> injected via Camel and Guice/Spring annotations with all its
>> dependencies - while supporting JUnit 3.x, 4.x and TestNG etc.
>> Though I also agree that learning Spring Test + JavaConfig or Guice is
>> maybe a bit too much for some folks who just want a simple base class.
>> I'm putting together a little test package right now as a simple
>> alternative - will check it in shortly...
> OK here's an example - see what you think?
> I've introduced a new class; CamelTestSupport as a base class. Its
> pretty much the same as ContextTestSupport but its got a better name,
> depends on just camel-core and camel-spring - and also supports Camel
> annotation injection; but does not require Spring or Guice for
> dependency injection.
> Its good for simple stuff; as things get more complex using an IoC
> framework like Spring or Guice definitely has lots of benefits.
> --
> James
> -------
> Open Source Integration

View raw message