Reputation: 21
in spring-integretion project,i have a hot folder that detects when a csv is placed in a folder and do some extra stuff, i have a inbound-channel-adapter connected with a channel.
inbound-channel-adapter -> channel. detects when a csv its placed receive the mns its connected with a service-activator what i what to do its test only that the channel its receiving the mns when a file its created
i am using this tutorial https://www.javacodegeeks.com/2013/05/spring-integration-file-polling-and-tests.html its very useful, but i can create the context
Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@57a4d5ee] to prepare test instance [proyect.integration.hotFolderTest@5af5def9] java.lang.IllegalStateException: Failed to load ApplicationContext
Upvotes: 0
Views: 219
Reputation: 121542
You need to show more stack trace on the matter, because right now it isn't clear what is your real issue.
Also would be great to share some code what you have so far and what you would like to do in the test case.
To verify a message presence in the channel you can configure a ChannelInterceptor
and implement its preSend()
.
However we also suggest something like @SpringIntegrationTest
with the MockIntegration
features. That way you can replace your real service activator with some MockIntegration.mockMessageHandler()
and perform verification on it.
You would need to configure a noAutoStartup
on the mentioned annotation do not poll directory until you prepare your mock and call a this.mockIntegrationContext.substituteMessageHandlerFor()
.
See more info in the Reference Manual: https://docs.spring.io/spring-integration/docs/current/reference/html/testing.html#test-context
Upvotes: 1