@Test(timeout=10000L) public void testUploadedDirectoryInChildNode() throws Exception { File dir = new File(TEST_TMP_DIR); dir.mkdirs(); BoxFolder folder = createBoxFolder(dir); File subdir = new File(dir, "subFolder"); new File(subdir, "subsubFolder").mkdirs(); new File(subdir, "subsubFile").createNewFile(); controller.uploadDirectory(dir.toPath(), testFolder); executeTransactions(); BoxNavigation newNav = nav.navigate(folder); assertThat(newNav.listFiles().size(), is(0)); assertThat(newNav.listFolders().size(), is(1)); assertThat(newNav.navigate("subFolder").listFolders().get(0).getName(), is("subsubFolder")); assertThat(newNav.navigate("subFolder").listFiles().get(0).getName(), is("subsubFile")); }
void uploadDirectory(Path source, BoxPath destination) throws IOException { Files.walkFileTree(source, new FileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { transferManager.addUpload(new ManualUpload(CREATE, volume, dir, resolveDestination(dir), true)); return FileVisitResult.CONTINUE; } private BoxPath resolveDestination(Path dir) { return destination.resolve(source.relativize(dir)); } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { transferManager.addUpload(new ManualUpload(CREATE, volume, file, resolveDestination(file), false)); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { return FileVisitResult.TERMINATE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { return FileVisitResult.CONTINUE; } }); }
RemoteFSController extends AbstractController implements Initializable { void uploadDirectory(Path source, BoxPath destination) throws IOException { Files.walkFileTree(source, new FileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { transferManager.addUpload(new ManualUpload(CREATE, volume, dir, resolveDestination(dir), true)); return FileVisitResult.CONTINUE; } private BoxPath resolveDestination(Path dir) { return destination.resolve(source.relativize(dir)); } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { transferManager.addUpload(new ManualUpload(CREATE, volume, file, resolveDestination(file), false)); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { return FileVisitResult.TERMINATE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { return FileVisitResult.CONTINUE; } }); } }
RemoteFSController extends AbstractController implements Initializable { void uploadDirectory(Path source, BoxPath destination) throws IOException { Files.walkFileTree(source, new FileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { transferManager.addUpload(new ManualUpload(CREATE, volume, dir, resolveDestination(dir), true)); return FileVisitResult.CONTINUE; } private BoxPath resolveDestination(Path dir) { return destination.resolve(source.relativize(dir)); } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { transferManager.addUpload(new ManualUpload(CREATE, volume, file, resolveDestination(file), false)); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { return FileVisitResult.TERMINATE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { return FileVisitResult.CONTINUE; } }); }  }
RemoteFSController extends AbstractController implements Initializable { void uploadDirectory(Path source, BoxPath destination) throws IOException { Files.walkFileTree(source, new FileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { transferManager.addUpload(new ManualUpload(CREATE, volume, dir, resolveDestination(dir), true)); return FileVisitResult.CONTINUE; } private BoxPath resolveDestination(Path dir) { return destination.resolve(source.relativize(dir)); } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { transferManager.addUpload(new ManualUpload(CREATE, volume, file, resolveDestination(file), false)); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { return FileVisitResult.TERMINATE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { return FileVisitResult.CONTINUE; } }); }  @Override void initialize(URL location, ResourceBundle resources); }
RemoteFSController extends AbstractController implements Initializable { void uploadDirectory(Path source, BoxPath destination) throws IOException { Files.walkFileTree(source, new FileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { transferManager.addUpload(new ManualUpload(CREATE, volume, dir, resolveDestination(dir), true)); return FileVisitResult.CONTINUE; } private BoxPath resolveDestination(Path dir) { return destination.resolve(source.relativize(dir)); } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { transferManager.addUpload(new ManualUpload(CREATE, volume, file, resolveDestination(file), false)); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { return FileVisitResult.TERMINATE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { return FileVisitResult.CONTINUE; } }); }  @Override void initialize(URL location, ResourceBundle resources); static final int OPTION_EDGE_SIZE; }