Last active
August 29, 2020 11:06
-
-
Save iainporter/83066c6a8223f7b56332103bb5d48dc5 to your computer and use it in GitHub Desktop.
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
@Test | |
public void pollIgnoresFileAlreadySeen() throws Exception { | |
final CountDownLatch stopLatch = new CountDownLatch(1); | |
filePollingChannel.addInterceptor(new ChannelInterceptor() { | |
@Override | |
public void postSend(Message<?> message, MessageChannel channel, boolean sent) { | |
stopLatch.countDown(); | |
} | |
}); | |
copy(TestUtils.locateClasspathResource(TestUtils.FILE_FIXTURE_PATH), new File(inboundReadDirectory, TestUtils.FILE_FIXTURE_NAME )); | |
//wait for stopLatch before asserting | |
assertThat(stopLatch.await(5, TimeUnit.SECONDS), is(true)); | |
assertThatDirectoryHasFiles(inboundProcessedDirectory, 1); | |
assertThatDirectoryHasFiles(inboundOutDirectory, 1); | |
assertThatDirectoryIsEmpty(inboundReadDirectory); | |
assertThatDirectoryIsEmpty(inboundFailedDirectory); | |
copy(TestUtils.locateClasspathResource(TestUtils.FILE_FIXTURE_PATH), new File(inboundReadDirectory, TestUtils.FILE_FIXTURE_NAME )); | |
Thread.sleep(2000); //wait longer than the polling period | |
assertThatDirectoryIsEmpty(inboundFailedDirectory); | |
assertThatDirectoryHasFiles(inboundReadDirectory, 1); | |
assertThatDirectoryHasFiles(inboundProcessedDirectory, 1); | |
assertThatDirectoryHasFiles(inboundOutDirectory, 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment