May 23rd, 2011, 09:32 AM
Testing the a full pipeline
I have a spring context file that builds a file processing pipe:
file:inbound-channel-adapter (to receive the file)
integration:transformer (to transform the file)
integration:transformer (secondary transformer)
file:outbound-channel-adapter (to move file to a 'done' directory)
The output of the transformation is handled outside of this 'context', I have multiple file processing pipes which all provide the same output format, the idea of having them in separate context files allows me to 'hook' them up to some other input channel elsewhere in a parent context.
So, for a single file processing pipe, I want to:
- Place file into input directory
- Listen on output channel of final transformer for result
- Assert result, based on original file content
I am aware that I can use @ContextConfiguration to import the context, however I wish to 'override' certain parts of the config with test specific data, for example:
- Replace the 'directory' of the inbound channel adapter to a temporary test directory
- Replace the 'directory' of the outbound channel adapter to a temporary test directory
I can't see a way of doing this in the XML configuration. My only thinking up to this point is to @Autowire the channel adapters in the test, then use reflection to set the private directory field, I've not tried this idea as I don't really like is.
May 23rd, 2011, 09:38 AM
This is a typical case for Spring's PropertyPlaceholders http://static.springsource.org/sprin...postprocessors, where each environment is bootstrapped with a property file or system property specific to the environment.
May 23rd, 2011, 10:44 AM
Ahh yes, next time I'll RTFM