@Test public void testNonDefaultFS() throws IOException { FileSystem fs = cluster.getFileSystem(); Configuration conf = fs.getConf(); conf.set(DFSConfigKeys.FS_DEFAULT_NAME_KEY, fs.getUri().toString()); TestTrash.trashNonDefaultFS(conf); }
public void testFileDeleteWithTrash() throws IOException { Configuration conf = new Configuration(); conf.set("fs.trash.interval", "10"); // 10 minute // create cluster MiniDFSCluster cluster = new MiniDFSCluster(conf, 1, true, null); FileSystem fs = null; try { cluster.waitActive(); fs = cluster.getFileSystem(); // create file1. Path dir = new Path("/foo"); Path file1 = new Path(dir, "file1"); createFile(fs, file1); System.out.println("testFileCreationDeleteParent: " + "Created file " + file1); fs.delete(file1, true); // create file2. Path file2 = new Path("/tmp", "file2"); createFile(fs, file2); System.out.println("testFileCreationDeleteParent: " + "Created file " + file2); fs.delete(file2, true); TrashPolicy trashPolicy = TrashPolicy.getInstance(conf, fs, fs.getHomeDirectory()); Path trashRoot = trashPolicy.getCurrentTrashDir(); TestTrash.checkTrash(fs, trashRoot, file1); TestTrash.checkNotInTrash(fs, trashRoot, file2.toString()); } finally { fs.close(); cluster.shutdown(); } }
@Test public void testTrash() throws IOException { TestTrash.trashShell(conf, fileSystemTestHelper.getTestRootPath(fsView), fsTarget, new Path(fsTarget.getHomeDirectory(), ".Trash/Current")); }
@Test public void testTrash() throws IOException { TestTrash.trashShell(cluster.getFileSystem(), new Path("/")); }