@Test public void testMoveToTrash() throws IOException { Path hadoopUtilsTestDir = new Path(Files.createTempDir().getAbsolutePath(), "HadoopUtilsTestDir"); Configuration conf = new Configuration(); conf.set("fs.trash.interval", "10"); FileSystem fs = FileSystem.getLocal(conf); Trash trash = new Trash(fs, conf); TrashPolicy trashPolicy = TrashPolicy.getInstance(conf, fs, fs.getHomeDirectory()); Path trashPath = trashPolicy.getCurrentTrashDir(); fs.mkdirs(hadoopUtilsTestDir); Assert.assertTrue(fs.exists(hadoopUtilsTestDir)); trash.moveToTrash(hadoopUtilsTestDir.getParent()); Assert.assertFalse(fs.exists(hadoopUtilsTestDir)); Assert.assertTrue(fs.exists(trashPath)); }
public static void moveToTrash(FileSystem fs, Path path) throws IOException { Trash trash = new Trash(fs, new Configuration()); trash.moveToTrash(path); }
HadoopUtils { public static void moveToTrash(FileSystem fs, Path path) throws IOException { Trash trash = new Trash(fs, new Configuration()); trash.moveToTrash(path); } }
HadoopUtils { public static void moveToTrash(FileSystem fs, Path path) throws IOException { Trash trash = new Trash(fs, new Configuration()); trash.moveToTrash(path); }  }
HadoopUtils { public static void moveToTrash(FileSystem fs, Path path) throws IOException { Trash trash = new Trash(fs, new Configuration()); trash.moveToTrash(path); }  static Configuration newConfiguration(); @Deprecated static List<FileStatus> listStatusRecursive(FileSystem fileSystem, Path path); static String toUriPath(Path path); static void deletePath(FileSystem fs, Path f, boolean recursive); static void deleteDirectories(FileSystem fs, List<String> directoriesToDelete, boolean recursive, boolean moveToTrash); static void deleteIfExists(FileSystem fs, Path path, boolean recursive); static void deletePathAndEmptyAncestors(FileSystem fs, Path f, boolean recursive); static void deletePathByRegex(FileSystem fs, final Path path, final String regex); static void moveToTrash(FileSystem fs, Path path); static boolean renamePathHandleLocalFSRace(FileSystem fs, Path src, Path dst); static void renamePath(FileContext fc, Path oldName, Path newName); static void renamePath(FileContext fc, Path oldName, Path newName, boolean overwrite); static void renamePath(FileSystem fs, Path oldName, Path newName); static void renamePath(FileSystem fs, Path oldName, Path newName, boolean overwrite); static void movePath(FileSystem srcFs, Path src, FileSystem dstFs, Path dst, Configuration conf); static void movePath(FileSystem srcFs, Path src, FileSystem dstFs, Path dst, boolean overwrite,
      Configuration conf); static void copyPath(FileSystem srcFs, Path src, FileSystem dstFs, Path dst, Configuration conf); static void copyPath(FileSystem srcFs, Path src, FileSystem dstFs, Path dst, boolean overwrite,
      Configuration conf); static void copyFile(FileSystem srcFs, Path src, FileSystem dstFs, Path dst, Path tmp, boolean overwriteDst,
      Configuration conf); static void copyFile(FileSystem srcFs, Path src, FileSystem dstFs, Path dst, boolean overwrite,
      Configuration conf); static void renameRecursively(FileSystem fileSystem, Path from, Path to); static FileSystem getOptionallyThrottledFileSystem(FileSystem fs, State state); static FileSystem getOptionallyThrottledFileSystem(FileSystem fs, int qpsLimit); synchronized static boolean safeRenameIfNotExists(FileSystem fs, Path from, Path to); static boolean unsafeRenameIfNotExists(FileSystem fs, Path from, Path to); static void safeRenameRecursively(FileSystem fileSystem, Path from, Path to); static Configuration getConfFromState(State state); static Configuration getConfFromState(State state, Optional<String> encryptedPath); static Configuration getConfFromProperties(Properties properties); static State getStateFromConf(Configuration conf); static void setGroup(FileSystem fs, Path path, String group); static String serializeToString(Writable writable); static Writable deserializeFromString(Class<? extends Writable> writableClass, String serializedWritableStr); static Writable deserializeFromString(Class<? extends Writable> writableClass, String serializedWritableStr,
      Configuration configuration); static void serializeWriterFilePermissions(State state, int numBranches, int branchId,
      FsPermission fsPermissions); static void serializeWriterDirPermissions(State state, int numBranches, int branchId,
      FsPermission fsPermissions); static void setWriterFileOctalPermissions(State state, int numBranches, int branchId,
      String octalPermissions); static void setWriterDirOctalPermissions(State state, int numBranches, int branchId, String octalPermissions); static FsPermission deserializeWriterFilePermissions(State state, int numBranches, int branchId); static FsPermission deserializeWriterDirPermissions(State state, int numBranches, int branchId); static FsPermission deserializeFsPermission(State props, String propName, FsPermission defaultPermission); static String sanitizePath(String path, String substitute); static Path sanitizePath(Path path, String substitute); static void setPermissions(Path location, Optional<String> owner, Optional<String> group, FileSystem fs,
      FsPermission permission); static boolean hasContent(FileSystem fs, Path path); static void addGobblinSite(); static FileSystem getSourceFileSystem(State state); static FileSystem getWriterFileSystem(State state, int numBranches, int branchId); }
HadoopUtils { public static void moveToTrash(FileSystem fs, Path path) throws IOException { Trash trash = new Trash(fs, new Configuration()); trash.moveToTrash(path); }  static Configuration newConfiguration(); @Deprecated static List<FileStatus> listStatusRecursive(FileSystem fileSystem, Path path); static String toUriPath(Path path); static void deletePath(FileSystem fs, Path f, boolean recursive); static void deleteDirectories(FileSystem fs, List<String> directoriesToDelete, boolean recursive, boolean moveToTrash); static void deleteIfExists(FileSystem fs, Path path, boolean recursive); static void deletePathAndEmptyAncestors(FileSystem fs, Path f, boolean recursive); static void deletePathByRegex(FileSystem fs, final Path path, final String regex); static void moveToTrash(FileSystem fs, Path path); static boolean renamePathHandleLocalFSRace(FileSystem fs, Path src, Path dst); static void renamePath(FileContext fc, Path oldName, Path newName); static void renamePath(FileContext fc, Path oldName, Path newName, boolean overwrite); static void renamePath(FileSystem fs, Path oldName, Path newName); static void renamePath(FileSystem fs, Path oldName, Path newName, boolean overwrite); static void movePath(FileSystem srcFs, Path src, FileSystem dstFs, Path dst, Configuration conf); static void movePath(FileSystem srcFs, Path src, FileSystem dstFs, Path dst, boolean overwrite,
      Configuration conf); static void copyPath(FileSystem srcFs, Path src, FileSystem dstFs, Path dst, Configuration conf); static void copyPath(FileSystem srcFs, Path src, FileSystem dstFs, Path dst, boolean overwrite,
      Configuration conf); static void copyFile(FileSystem srcFs, Path src, FileSystem dstFs, Path dst, Path tmp, boolean overwriteDst,
      Configuration conf); static void copyFile(FileSystem srcFs, Path src, FileSystem dstFs, Path dst, boolean overwrite,
      Configuration conf); static void renameRecursively(FileSystem fileSystem, Path from, Path to); static FileSystem getOptionallyThrottledFileSystem(FileSystem fs, State state); static FileSystem getOptionallyThrottledFileSystem(FileSystem fs, int qpsLimit); synchronized static boolean safeRenameIfNotExists(FileSystem fs, Path from, Path to); static boolean unsafeRenameIfNotExists(FileSystem fs, Path from, Path to); static void safeRenameRecursively(FileSystem fileSystem, Path from, Path to); static Configuration getConfFromState(State state); static Configuration getConfFromState(State state, Optional<String> encryptedPath); static Configuration getConfFromProperties(Properties properties); static State getStateFromConf(Configuration conf); static void setGroup(FileSystem fs, Path path, String group); static String serializeToString(Writable writable); static Writable deserializeFromString(Class<? extends Writable> writableClass, String serializedWritableStr); static Writable deserializeFromString(Class<? extends Writable> writableClass, String serializedWritableStr,
      Configuration configuration); static void serializeWriterFilePermissions(State state, int numBranches, int branchId,
      FsPermission fsPermissions); static void serializeWriterDirPermissions(State state, int numBranches, int branchId,
      FsPermission fsPermissions); static void setWriterFileOctalPermissions(State state, int numBranches, int branchId,
      String octalPermissions); static void setWriterDirOctalPermissions(State state, int numBranches, int branchId, String octalPermissions); static FsPermission deserializeWriterFilePermissions(State state, int numBranches, int branchId); static FsPermission deserializeWriterDirPermissions(State state, int numBranches, int branchId); static FsPermission deserializeFsPermission(State props, String propName, FsPermission defaultPermission); static String sanitizePath(String path, String substitute); static Path sanitizePath(Path path, String substitute); static void setPermissions(Path location, Optional<String> owner, Optional<String> group, FileSystem fs,
      FsPermission permission); static boolean hasContent(FileSystem fs, Path path); static void addGobblinSite(); static FileSystem getSourceFileSystem(State state); static FileSystem getWriterFileSystem(State state, int numBranches, int branchId); static final String HDFS_ILLEGAL_TOKEN_REGEX; static final Collection<String> FS_SCHEMES_NON_ATOMIC; static final String MAX_FILESYSTEM_QPS; }