@Test public void testSymlink() throws Exception { final SFTPHomeDirectoryService workdir = new SFTPHomeDirectoryService(session); final Path target = new Path(workdir.find(), UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); new SFTPTouchFeature(session).touch(target, new TransferStatus()); final Path link = new Path(workdir.find(), UUID.randomUUID().toString(), EnumSet.of(Path.Type.file, AbstractPath.Type.symboliclink)); new SFTPSymlinkFeature(session).symlink(link, target.getName()); assertTrue(new SFTPFindFeature(session).find(link)); assertEquals(EnumSet.of(Path.Type.file, AbstractPath.Type.symboliclink), new SFTPListService(session).list(workdir.find(), new DisabledListProgressListener()).get(link).getType()); new SFTPDeleteFeature(session).delete(Collections.singletonList(link), new DisabledLoginCallback(), new Delete.DisabledCallback()); assertFalse(new SFTPFindFeature(session).find(link)); assertTrue(new SFTPFindFeature(session).find(target)); new SFTPDeleteFeature(session).delete(Collections.singletonList(target), new DisabledLoginCallback(), new Delete.DisabledCallback()); }
@Override public void symlink(final Path file, String target) throws BackgroundException { try { session.sftp().symlink(target, file.getAbsolute()); } catch(IOException e) { throw new SFTPExceptionMappingService().map("Cannot create file {0}", e, file); } }
SFTPSymlinkFeature implements Symlink { @Override public void symlink(final Path file, String target) throws BackgroundException { try { session.sftp().symlink(target, file.getAbsolute()); } catch(IOException e) { throw new SFTPExceptionMappingService().map("Cannot create file {0}", e, file); } } }
SFTPSymlinkFeature implements Symlink { @Override public void symlink(final Path file, String target) throws BackgroundException { try { session.sftp().symlink(target, file.getAbsolute()); } catch(IOException e) { throw new SFTPExceptionMappingService().map("Cannot create file {0}", e, file); } } SFTPSymlinkFeature(final SFTPSession session); }
SFTPSymlinkFeature implements Symlink { @Override public void symlink(final Path file, String target) throws BackgroundException { try { session.sftp().symlink(target, file.getAbsolute()); } catch(IOException e) { throw new SFTPExceptionMappingService().map("Cannot create file {0}", e, file); } } SFTPSymlinkFeature(final SFTPSession session); @Override void symlink(final Path file, String target); }
SFTPSymlinkFeature implements Symlink { @Override public void symlink(final Path file, String target) throws BackgroundException { try { session.sftp().symlink(target, file.getAbsolute()); } catch(IOException e) { throw new SFTPExceptionMappingService().map("Cannot create file {0}", e, file); } } SFTPSymlinkFeature(final SFTPSession session); @Override void symlink(final Path file, String target);  }