Nov 13th, 2010, 05:24 PM
How can i check if i ran the job using the functional test?
In our spring batch project, we have our functional tests in the src/main/test package
My problem is, there is a bit of code in one of our classes that is only needed for the functional tests
but when we have deployed our project, this bit of code is obviously getting called too. And we dont want it to get called as it curently causes an 8 second delay and is only needed for the functional tests.
How can I make changes so that code only executes for the functional tests?
Nov 16th, 2010, 02:35 AM
That's really a matter of taste, and not really anything to do with Spring Batch, I would say. Some people would use a simple boolean flag and check it before calling the extra block, others might abstract the behaviour into an interface and provide two implementations (one for prod and one for dev). Spring then provides a number of mechanisms for modifying the application context according to the environment (Spring 3.1 will have a richer feature set still). The most commonly used are PropertyPlaceholderConfigurer and bean overrides (importing an extra configuratio nfile whose location depends on the environment).
You could find out more by asking in the main Spring forum.