@Test @Ignore public void testRetainStickyBits() throws Exception { final Path test = new Path(new SFTPHomeDirectoryService(session).find(), UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); new SFTPTouchFeature(session).touch(test, new TransferStatus()); final SFTPUnixPermissionFeature feature = new SFTPUnixPermissionFeature(session); feature.setUnixPermission(test, new Permission(Permission.Action.all, Permission.Action.read, Permission.Action.read, true, false, false)); assertEquals(new Permission(Permission.Action.all, Permission.Action.read, Permission.Action.read, true, false, false), new SFTPListService(session).list(test.getParent(), new DisabledListProgressListener()).get( test).attributes().getPermission()); feature.setUnixPermission(test, new Permission(Permission.Action.all, Permission.Action.read, Permission.Action.read, false, true, false)); assertEquals(new Permission(Permission.Action.all, Permission.Action.read, Permission.Action.read, false, true, false), new SFTPListService(session).list(test.getParent(), new DisabledListProgressListener()).get( test).attributes().getPermission()); feature.setUnixPermission(test, new Permission(Permission.Action.all, Permission.Action.read, Permission.Action.read, false, false, true)); assertEquals(new Permission(Permission.Action.all, Permission.Action.read, Permission.Action.read, false, false, true), new SFTPListService(session).list(test.getParent(), new DisabledListProgressListener()).get( test).attributes().getPermission()); new SFTPDeleteFeature(session).delete(Collections.<Path>singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback()); }
@Override public void setUnixPermission(final Path file, final Permission permission) throws BackgroundException { final FileAttributes attr = new FileAttributes.Builder() .withPermissions(Integer.parseInt(permission.getMode(), 8)) .build(); try { session.sftp().setAttributes(file.getAbsolute(), attr); } catch(IOException e) { throw new SFTPExceptionMappingService().map("Failure to write attributes of {0}", e, file); } }
SFTPUnixPermissionFeature extends DefaultUnixPermissionFeature implements UnixPermission { @Override public void setUnixPermission(final Path file, final Permission permission) throws BackgroundException { final FileAttributes attr = new FileAttributes.Builder() .withPermissions(Integer.parseInt(permission.getMode(), 8)) .build(); try { session.sftp().setAttributes(file.getAbsolute(), attr); } catch(IOException e) { throw new SFTPExceptionMappingService().map("Failure to write attributes of {0}", e, file); } } }
SFTPUnixPermissionFeature extends DefaultUnixPermissionFeature implements UnixPermission { @Override public void setUnixPermission(final Path file, final Permission permission) throws BackgroundException { final FileAttributes attr = new FileAttributes.Builder() .withPermissions(Integer.parseInt(permission.getMode(), 8)) .build(); try { session.sftp().setAttributes(file.getAbsolute(), attr); } catch(IOException e) { throw new SFTPExceptionMappingService().map("Failure to write attributes of {0}", e, file); } } SFTPUnixPermissionFeature(final SFTPSession session); }
SFTPUnixPermissionFeature extends DefaultUnixPermissionFeature implements UnixPermission { @Override public void setUnixPermission(final Path file, final Permission permission) throws BackgroundException { final FileAttributes attr = new FileAttributes.Builder() .withPermissions(Integer.parseInt(permission.getMode(), 8)) .build(); try { session.sftp().setAttributes(file.getAbsolute(), attr); } catch(IOException e) { throw new SFTPExceptionMappingService().map("Failure to write attributes of {0}", e, file); } } SFTPUnixPermissionFeature(final SFTPSession session); @Override void setUnixOwner(final Path file, final String owner); @Override void setUnixGroup(final Path file, final String group); @Override Permission getUnixPermission(final Path file); @Override void setUnixPermission(final Path file, final Permission permission); }
SFTPUnixPermissionFeature extends DefaultUnixPermissionFeature implements UnixPermission { @Override public void setUnixPermission(final Path file, final Permission permission) throws BackgroundException { final FileAttributes attr = new FileAttributes.Builder() .withPermissions(Integer.parseInt(permission.getMode(), 8)) .build(); try { session.sftp().setAttributes(file.getAbsolute(), attr); } catch(IOException e) { throw new SFTPExceptionMappingService().map("Failure to write attributes of {0}", e, file); } } SFTPUnixPermissionFeature(final SFTPSession session); @Override void setUnixOwner(final Path file, final String owner); @Override void setUnixGroup(final Path file, final String group); @Override Permission getUnixPermission(final Path file); @Override void setUnixPermission(final Path file, final Permission permission);  }