@Test public void testCreateFolder() throws Exception { final LocalSession session = new LocalSession(new Host(new LocalProtocol(), new LocalProtocol().getDefaultHostname())); session.open(Proxy.DIRECT, new DisabledHostKeyCallback(), new DisabledLoginCallback()); session.login(Proxy.DIRECT, new DisabledLoginCallback(), new DisabledCancelCallback()); final Path folder = new Path(new LocalHomeFinderFeature(session).find(), UUID.randomUUID().toString(), EnumSet.of(Path.Type.directory)); new LocalDirectoryFeature(session).mkdir(folder, null, new TransferStatus()); assertTrue(Files.exists(session.toPath(folder))); new LocalDeleteFeature(session).delete(Collections.singletonList(folder), new DisabledLoginCallback(), new Delete.DisabledCallback()); assertFalse(Files.exists(session.toPath(folder))); }
@Override public Path mkdir(final Path folder, final String region, final TransferStatus status) throws BackgroundException { try { Files.createDirectory(session.toPath(folder)); } catch(IOException e) { throw new LocalExceptionMappingService().map("Cannot create folder {0}", e, folder); } return new Path(folder.getParent(), folder.getName(), folder.getType(), new LocalAttributesFinderFeature(session).find(folder)); }
LocalDirectoryFeature implements Directory<Void> { @Override public Path mkdir(final Path folder, final String region, final TransferStatus status) throws BackgroundException { try { Files.createDirectory(session.toPath(folder)); } catch(IOException e) { throw new LocalExceptionMappingService().map("Cannot create folder {0}", e, folder); } return new Path(folder.getParent(), folder.getName(), folder.getType(), new LocalAttributesFinderFeature(session).find(folder)); } }
LocalDirectoryFeature implements Directory<Void> { @Override public Path mkdir(final Path folder, final String region, final TransferStatus status) throws BackgroundException { try { Files.createDirectory(session.toPath(folder)); } catch(IOException e) { throw new LocalExceptionMappingService().map("Cannot create folder {0}", e, folder); } return new Path(folder.getParent(), folder.getName(), folder.getType(), new LocalAttributesFinderFeature(session).find(folder)); } LocalDirectoryFeature(final LocalSession session); }
LocalDirectoryFeature implements Directory<Void> { @Override public Path mkdir(final Path folder, final String region, final TransferStatus status) throws BackgroundException { try { Files.createDirectory(session.toPath(folder)); } catch(IOException e) { throw new LocalExceptionMappingService().map("Cannot create folder {0}", e, folder); } return new Path(folder.getParent(), folder.getName(), folder.getType(), new LocalAttributesFinderFeature(session).find(folder)); } LocalDirectoryFeature(final LocalSession session); @Override Path mkdir(final Path folder, final String region, final TransferStatus status); @Override Directory<Void> withWriter(final Write<Void> writer); }
LocalDirectoryFeature implements Directory<Void> { @Override public Path mkdir(final Path folder, final String region, final TransferStatus status) throws BackgroundException { try { Files.createDirectory(session.toPath(folder)); } catch(IOException e) { throw new LocalExceptionMappingService().map("Cannot create folder {0}", e, folder); } return new Path(folder.getParent(), folder.getName(), folder.getType(), new LocalAttributesFinderFeature(session).find(folder)); } LocalDirectoryFeature(final LocalSession session); @Override Path mkdir(final Path folder, final String region, final TransferStatus status); @Override Directory<Void> withWriter(final Write<Void> writer);  }