Skip to content

Instantly share code, notes, and snippets.

@iainporter
Created August 29, 2020 10:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iainporter/2ac43c8419e8143ea4a21d3d4e4536e4 to your computer and use it in GitHub Desktop.
Save iainporter/2ac43c8419e8143ea4a21d3d4e4536e4 to your computer and use it in GitHub Desktop.
RollbackMovesFileToFailed
@Test
public void rollbackMovesFileToFailed() throws Exception {
final CountDownLatch stopLatch = new CountDownLatch(1);
filePollingChannel.addInterceptor(new ChannelInterceptor() {
@Override
public Message<?> preSend(Message<?> message, MessageChannel channel) {
stopLatch.countDown();
throw new RuntimeException("Forcing an Exception to trigger rollback");
}
});
copy(TestUtils.locateClasspathResource(TestUtils.FILE_FIXTURE_PATH), new File(inboundReadDirectory, TestUtils.FILE_FIXTURE_NAME ));
assertThat(stopLatch.await(5, TimeUnit.SECONDS), is(true));
assertThatDirectoryIsEmpty(inboundReadDirectory);
assertThatDirectoryIsEmpty(inboundProcessedDirectory);
assertThatDirectoryIsEmpty(inboundOutDirectory);
assertThatDirectoryHasFiles(inboundFailedDirectory, 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment