Announcement Announcement Module
Collapse
No announcement yet.
How can I test a Spring Integration application? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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!

    Cheers,
    Stephan

  • #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 http://jira.springframework.org/browse/INT-144.

    Comment


    • #3
      Hi,

      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

      Comment


      • #4
        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/

        Comment


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

          Cheers,
          Stephan

          Comment

          Working...
          X