Announcement Announcement Module
No announcement yet.
How can I test a Spring Integration application? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How can I test a Spring Integration application?

    Hi all,

    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!


  • #2
    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


    • #3

      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


      • #4
        That's correct, the testcases aren't packaged with the distribution. You can find them in our repository:


        • #5
          Thanks! That's exactly what I was looking for. I'll look into it as soon as I find some time.