Apr 28th, 2009, 02:19 AM
How can I test a Spring Integration application?
currently I'm trying to build a small sample application with Spring Integration. A typical use case is reading a file from a directory and putting it into a JMS queue.
The program works well but I don't have a clue how I can write a JUnit test case to verify that everything works.
The main problem is that the components that I define in the SI xml file, e. g. <file:inbound-channel-adapter> work independently from the code in my unit tests. It happens that the application context shuts down while the channel adapter is still reading the file.
Any hints how I can write such unit tests would be appreciated!
May 1st, 2009, 02:04 PM
You should look at how I did it in our source code . The basic idea is that if you do a receive (blocking) on the output channel of your test at the end you don't have this problem.
If you have ideas about how to make this work better you could comment on http://jira.springframework.org/browse/INT-144.
May 4th, 2009, 08:53 AM
where can I find these tests in the source code?
I searched the source code for Spring Integration and the samples. But I cannot find any example that could help me solve the problem.
Thanks in advance, Stephan
May 5th, 2009, 04:56 AM
That's correct, the testcases aren't packaged with the distribution. You can find them in our repository: https://src.springframework.org/svn/...gration/trunk/
May 5th, 2009, 06:24 AM
Thanks! That's exactly what I was looking for. I'll look into it as soon as I find some time.