use of nl.nn.adapterframework.ftp.FTPFileRef in project iaf by ibissource.
the class FtpFileSystem method findFile.
private FTPFile findFile(FTPFile file) throws IOException {
FTPFile[] files = null;
if (file instanceof FTPFileRef) {
FTPFileRef fileRef = (FTPFileRef) file;
files = ftpClient.listFiles(fileRef.getFolder(), f -> f.getName().equals(fileRef.getFileName()));
} else {
files = ftpClient.listFiles(file.getName(), f -> f.getName().equals(file.getName()));
}
if (files != null && files.length > 0) {
return files[0];
}
return null;
}
use of nl.nn.adapterframework.ftp.FTPFileRef in project iaf by ibissource.
the class FtpFileSystemTest method testFTPFileRefWindowsSlash.
@Test
public void testFTPFileRefWindowsSlash() {
FTPFileRef ref2 = new FTPFileRef("folder1\\test123");
ref2.setFolder("folder2");
assertEquals("folder2/folder1/test123", ref2.getName());
}
use of nl.nn.adapterframework.ftp.FTPFileRef in project iaf by ibissource.
the class FtpFileSystemTest method testFTPFileRefSetFolder.
@Test
public void testFTPFileRefSetFolder() {
FTPFileRef ref1 = new FTPFileRef("test123");
ref1.setFolder("folder");
assertEquals("folder/test123", ref1.getName());
}
use of nl.nn.adapterframework.ftp.FTPFileRef in project iaf by ibissource.
the class FtpFileSystemTest method testFTPFileRefRelativeWithSetFolder.
@Test
public void testFTPFileRefRelativeWithSetFolder() {
FTPFileRef ref2 = new FTPFileRef("folder1/test123");
ref2.setFolder("folder2");
assertEquals("folder2/folder1/test123", ref2.getName());
}
use of nl.nn.adapterframework.ftp.FTPFileRef in project iaf by ibissource.
the class FtpFileSystem method toFile.
@Override
public FTPFile toFile(String folder, String filename) throws FileSystemException {
FTPFileRef ftpFile = new FTPFileRef();
ftpFile.setName(filename);
ftpFile.setFolder(folder);
return ftpFile;
}
Aggregations