/******************************************************************************************************************* * * ******************************************************************************************************************/ private void generateLocalFileSystem() throws IOException { log.info("generateLocalFileSystem()"); if (!new File(rootPath).mkdirs()) // TODO: use NwFileSystem API { throw new IOException("Cannot create dirs for " + rootPath); } // FIXME: shouldn't be needed, but otherwise after a second call to this method won't find files targetProvider = new LocalFileSystemProvider(); targetProvider.setRootPath(rootPath); final ResourceFile targetRoot = targetProvider.getFileSystem().getRoot(); final String path = targetRoot.toFile().getAbsolutePath(); log.info(">>>> scratching {} ...", path); emptyFolder(targetRoot); log.info(">>>> copying files to {} ...", path); copyFolder(sourceProvider.getFileSystem().getRoot(), targetRoot); // targetProvider.getFileSystem().refresh(true); }
/******************************************************************************************************************* * * * ******************************************************************************************************************/ private void dump (final @Nonnull File file, final @Nonnull ResourceFileSystem fileSystem) throws IOException { final List<String> lines = new ArrayList<String>(); dump(lines, underTest.getFileSystem().getRoot()); Collections.sort(lines); FileUtils.writeLines(file, lines, "\n"); }