@Test public void testCopyDirFromLocal() throws Exception { Path testRoot = new Path(testRootDir, "testPutDir"); lfs.delete(testRoot, true); lfs.mkdirs(testRoot); Path targetDir = new Path(testRoot, "target"); Path dirPath = new Path(testRoot, new Path("srcDir")); lfs.mkdirs(dirPath); lfs.create(new Path(dirPath, "srcFile")).close(); checkPut(dirPath, targetDir, false); }
@Test public void testCopyDirFromLocal() throws Exception { Path testRoot = new Path(testRootDir, "testPutDir"); lfs.delete(testRoot, true); lfs.mkdirs(testRoot); Path targetDir = new Path(testRoot, "target"); Path dirPath = new Path(testRoot, new Path("srcDir")); lfs.mkdirs(dirPath); lfs.create(new Path(dirPath, "srcFile")).close(); checkPut(dirPath, targetDir, false); }
@BeforeClass public static void setup() throws Exception { conf = new Configuration(); shell = new FsShell(conf); lfs = FileSystem.getLocal(conf); testRootDir = lfs.makeQualified(new Path( System.getProperty("test.build.data","test/build/data"), "testShellCopy")); lfs.mkdirs(testRootDir); srcPath = new Path(testRootDir, "srcFile"); dstPath = new Path(testRootDir, "dstFile"); }
@Test public void testRenameFileIntoDir() throws Exception { Path srcPath = new Path(TEST_ROOT_DIR, "testRenameSrc"); Path dstPath = new Path(TEST_ROOT_DIR, "testRenameDir"); localFs.mkdirs(dstPath); verifyRename(srcPath, dstPath, true); }
@Test public void testRenameFileIntoDir() throws Exception { Path srcPath = new Path(TEST_ROOT_DIR, "testRenameSrc"); Path dstPath = new Path(TEST_ROOT_DIR, "testRenameDir"); localFs.mkdirs(dstPath); verifyRename(srcPath, dstPath, true); }
@BeforeClass public static void setup() throws Exception { conf = new Configuration(); shell = new FsShell(conf); lfs = FileSystem.getLocal(conf); testRootDir = lfs.makeQualified(new Path( System.getProperty("test.build.data","test/build/data"), "testShellCopy")); lfs.mkdirs(testRootDir); srcPath = new Path(testRootDir, "srcFile"); dstPath = new Path(testRootDir, "dstFile"); }
@Test public void testCopyDirFromWindowsLocalPath() throws Exception { assumeTrue(Path.WINDOWS); String windowsTestRootPath = (new File(testRootDir.toUri().getPath() .toString())).getAbsolutePath(); Path testRoot = new Path(windowsTestRootPath, "testPutDir"); lfs.delete(testRoot, true); lfs.mkdirs(testRoot); Path targetDir = new Path(testRoot, "target"); Path dirPath = new Path(testRoot, new Path("srcDir")); lfs.mkdirs(dirPath); lfs.create(new Path(dirPath, "srcFile")).close(); checkPut(dirPath, targetDir, true); }
@Test public void testCopyFileFromLocal() throws Exception { Path testRoot = new Path(testRootDir, "testPutFile"); lfs.delete(testRoot, true); lfs.mkdirs(testRoot); Path targetDir = new Path(testRoot, "target"); Path filePath = new Path(testRoot, new Path("srcFile")); lfs.create(filePath).close(); checkPut(filePath, targetDir, false); }
@Test public void testCopyFileFromWindowsLocalPath() throws Exception { assumeTrue(Path.WINDOWS); String windowsTestRootPath = (new File(testRootDir.toUri().getPath() .toString())).getAbsolutePath(); Path testRoot = new Path(windowsTestRootPath, "testPutFile"); lfs.delete(testRoot, true); lfs.mkdirs(testRoot); Path targetDir = new Path(testRoot, "target"); Path filePath = new Path(testRoot, new Path("srcFile")); lfs.create(filePath).close(); checkPut(filePath, targetDir, true); }
@Test public void testCopyFileFromWindowsLocalPath() throws Exception { assumeTrue(Path.WINDOWS); String windowsTestRootPath = (new File(testRootDir.toUri().getPath() .toString())).getAbsolutePath(); Path testRoot = new Path(windowsTestRootPath, "testPutFile"); lfs.delete(testRoot, true); lfs.mkdirs(testRoot); Path targetDir = new Path(testRoot, "target"); Path filePath = new Path(testRoot, new Path("srcFile")); lfs.create(filePath).close(); checkPut(filePath, targetDir, true); }
@Test public void testCopyFileFromLocal() throws Exception { Path testRoot = new Path(testRootDir, "testPutFile"); lfs.delete(testRoot, true); lfs.mkdirs(testRoot); Path targetDir = new Path(testRoot, "target"); Path filePath = new Path(testRoot, new Path("srcFile")); lfs.create(filePath).close(); checkPut(filePath, targetDir, false); }
@Test public void testRenameFileIntoDirFile() throws Exception { Path srcPath = new Path(TEST_ROOT_DIR, "testRenameSrc"); Path dstPath = new Path(TEST_ROOT_DIR, "testRenameDir/testRenameDst"); assertTrue(localFs.mkdirs(dstPath)); verifyRename(srcPath, dstPath, false); }
@Test public void testRenameFileIntoDirFile() throws Exception { Path srcPath = new Path(TEST_ROOT_DIR, "testRenameSrc"); Path dstPath = new Path(TEST_ROOT_DIR, "testRenameDir/testRenameDst"); assertTrue(localFs.mkdirs(dstPath)); verifyRename(srcPath, dstPath, false); }
@Override public void setUp() throws Exception { LocalFileSystem fs = FileSystem.getLocal(conf); if (fs.exists(TEST_ROOT) && !fs.delete(TEST_ROOT, true)) { Assert.fail("Can't clean up test root dir"); } fs.mkdirs(TEST_ROOT); }
@Override public void setUp() throws Exception { LocalFileSystem fs = FileSystem.getLocal(conf); if (fs.exists(TEST_ROOT) && !fs.delete(TEST_ROOT, true)) { Assert.fail("Can't clean up test root dir"); } fs.mkdirs(TEST_ROOT); }
@Test public void testMoveDirFromLocal() throws Exception { Path testRoot = new Path(testRootDir, "testPutDir"); lfs.delete(testRoot, true); lfs.mkdirs(testRoot); Path srcDir = new Path(testRoot, "srcDir"); lfs.mkdirs(srcDir); Path targetDir = new Path(testRoot, "target"); int exit = shell.run(new String[]{ "-moveFromLocal", srcDir.toString(), targetDir.toString() }); assertEquals(0, exit); assertFalse(lfs.exists(srcDir)); assertTrue(lfs.exists(targetDir)); }
@Before public void setup() throws Exception { LocalFileSystem fs = FileSystem.getLocal(conf); if (fs.exists(TEST_DIR) && !fs.delete(TEST_DIR, true)) { Assert.fail("Can't clean up test root dir"); } fs.mkdirs(TEST_DIR); }
@Before public void setup() throws Exception { LocalFileSystem fs = FileSystem.getLocal(conf); if (fs.exists(TEST_DIR) && !fs.delete(TEST_DIR, true)) { Assert.fail("Can't clean up test root dir"); } fs.mkdirs(TEST_DIR); }
/** * Tests a simple rename of a directory. */ @Test public void testRenameDirectory() throws IOException { Path src = new Path(TEST_ROOT_DIR, "dir1"); Path dst = new Path(TEST_ROOT_DIR, "dir2"); fileSys.delete(src, true); fileSys.delete(dst, true); assertTrue(fileSys.mkdirs(src)); assertTrue(fileSys.rename(src, dst)); assertTrue(fileSys.exists(dst)); assertFalse(fileSys.exists(src)); }
/** * Tests a simple rename of a directory. */ @Test public void testRenameDirectory() throws IOException { Path src = new Path(TEST_ROOT_DIR, "dir1"); Path dst = new Path(TEST_ROOT_DIR, "dir2"); fileSys.delete(src, true); fileSys.delete(dst, true); assertTrue(fileSys.mkdirs(src)); assertTrue(fileSys.rename(src, dst)); assertTrue(fileSys.exists(dst)); assertFalse(fileSys.exists(src)); }