2008/11/28 James Strachan <[EMAIL PROTECTED]>: > 2008/11/28 Martin Gilday <[EMAIL PROTECTED]>: >> --- I wonder - what is it about the Spring Testing approach that you >> don't >> --- like? e.g. you should be able to test out individual routes using >> this >> --- approach? >> >> I can test out individual routes of the complete route config using that >> just fine. But when I am writing test cases to demonstrate to >> colleagues (and myself) how certain Camel components interact with our >> existing systems loading the whole "live" RouteBuilder is too much. It >> is nice just to write a specific set of routes just for that test, as >> Camel commmiters are doing in the test suite. > > BTW I started off doing that too - using CamelContextSupport; after a > while I found it just much cleaner & simpler to just use the Spring > Testing approach - I find it much cleaner & more elegant. > > The downside though is that you need to write 1 test class and 1 XML > file per test case / demo. > > >> Then in the single file >> you can see what routes exist, change things to mocks. Otherwise I need >> to write a seperate Spring config file per test case, and I prefer the >> Java DSL. I think part of this is becuase at the moment we writing test >> cases in sort of a TDD design way rather than writing integration tests >> for a complete system. > > I hear you. I prefer using the no-XML approach with the Guice testing > - then everything is inside a single Java file and much easier to > navigate/grok. > > I might try creating some example tests using the Java Config of > spring to see if that would suit?
BTW I raised this JIRA to track this issue... https://issues.apache.org/activemq/browse/CAMEL-1128 I've hacked up an example test case using Spring Test along with Spring Java Config. The results are similar to using Guice. https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-spring-javaconfig/ e.g. https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/examples/ here's the test case https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/examples/FilterTest.java the configuration is here https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-spring-javaconfig/src/test/java/org/apache/camel/spring/javaconfig/examples/FilterConfig.java Unfortunately it doesn't work :( due to a bug where BeanPostProcessors don't seem to be invoked on test classes http://jira.springframework.org/browse/SJC-248 BTW please vote for these issues to help us add better support for Spring Java Config with Spring Test... http://jira.springframework.org/browse/SJC-248 http://jira.springframework.org/browse/SJC-238 -- James ------- http://macstrac.blogspot.com/ Open Source Integration http://fusesource.com/
