Last active
August 29, 2020 09:57
-
-
Save iainporter/99900a26e98bb889bfe0f8666b85140d to your computer and use it in GitHub Desktop.
test for validating file was read
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Autowired | |
@Qualifier(ApplicationConfiguration.INBOUND_CHANNEL) | |
public DirectChannel filePollingChannel; | |
@Test | |
public void pollFindsValidFile() throws Exception { | |
final CountDownLatch latch = new CountDownLatch(1); | |
filePollingChannel.addInterceptor(new ChannelInterceptor() { | |
@Override | |
public void postSend(Message<?> message, MessageChannel channel, boolean sent) { | |
latch.countDown(); | |
} | |
}); | |
copy(TestUtils.locateClasspathResource(TestUtils.FILE_FIXTURE_PATH), new File(inboundReadDirectory, TestUtils.FILE_FIXTURE_NAME )); | |
assertThat(latch.await(5, TimeUnit.SECONDS), is(true)); | |
assertThatDirectoryIsEmpty(inboundReadDirectory); | |
assertThatDirectoryIsEmpty(inboundFailedDirectory); | |
assertThatDirectoryHasFiles(inboundOutDirectory, 1); | |
assertThatDirectoryHasFiles(inboundProcessedDirectory, 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment