template.sendBodyAndHeader(getFtpUrl(), "C", Exchange.FILE_NAME, "bar/c.txt");
FtpEndpoint endpoint = context.getEndpoint(getFtpUrl() + "&recursive=true&sortBy=file:name", FtpEndpoint.class);
assertNotNull(endpoint);
MemoryIdempotentRepository repo = (MemoryIdempotentRepository) endpoint.getInProgressRepository();
assertEquals(0, repo.getCacheSize());
@SuppressWarnings("unchecked")
List<Exchange> list = endpoint.getExchanges();
assertNotNull(list);
assertEquals(3, list.size());
assertEquals("a.txt", list.get(0).getIn().getHeader(Exchange.FILE_NAME));
assertEquals("c.txt", list.get(1).getIn().getHeader(Exchange.FILE_NAME_ONLY));
assertEquals("b.txt", list.get(2).getIn().getHeader(Exchange.FILE_NAME_ONLY));
// the in progress repo should not leak
assertEquals(0, repo.getCacheSize());
// and the files is still there
File fileA = new File(FTP_ROOT_DIR + "/browse/a.txt");
assertTrue("File should exist " + fileA, fileA.exists());
File fileB = new File(FTP_ROOT_DIR + "/browse/foo/b.txt");