Results 1 to 5 of 5

Thread: How can I test a Spring Integration application?

  1. #1
    Join Date
    Mar 2009
    Location
    Germany
    Posts
    18

    Default 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. #2
    Join Date
    May 2007
    Location
    Netherlands
    Posts
    614

    Default

    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.

  3. #3
    Join Date
    Mar 2009
    Location
    Germany
    Posts
    18

    Default

    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

  4. #4
    Join Date
    May 2007
    Location
    Netherlands
    Posts
    614

    Default

    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/

  5. #5
    Join Date
    Mar 2009
    Location
    Germany
    Posts
    18

    Default

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

    Cheers,
    Stephan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •