use of org.springframework.integration.support.PartialSuccessException in project spring-integration by spring-projects.
the class FtpServerOutboundTests method testMgetRecursivePartial.
@Test
public void testMgetRecursivePartial() throws Exception {
Session<FTPFile> session = spyOnSession();
doAnswer(invocation -> {
FTPFile[] files = (FTPFile[]) invocation.callRealMethod();
// add an extra file where the get will fail
files = Arrays.copyOf(files, files.length + 1);
FTPFile bogusFile = new FTPFile();
bogusFile.setName("bogus.txt");
bogusFile.setTimestamp(Calendar.getInstance());
files[files.length - 1] = bogusFile;
return files;
}).when(session).list("ftpSource/subFtpSource/");
String dir = "ftpSource/";
try {
this.inboundMGetRecursive.send(new GenericMessage<Object>(dir + "*"));
fail("expected exception");
} catch (PartialSuccessException e) {
assertEquals(4, e.getDerivedInput().size());
assertEquals(2, e.getPartialResults().size());
assertThat(e.getCause().getMessage(), containsString("/ftpSource/subFtpSource/bogus.txt: No such file or directory."));
}
}
Aggregations