/** * Check that exception is thrown in case the path being updated doesn't exist remotely. * * @throws Exception If failed. */ @Test public void testUpdatePathDoesNotExist() throws Exception { final Map<String, String> props = properties("owner", "group", "0555"); assert igfs.update(SUBDIR, props) == null; checkNotExist(igfs, igfsSecondary, SUBDIR); }
/** * Ensure that rename doesn't occur in case source doesn't exist remotely. * * @throws Exception If failed. */ @Test public void testMoveRenameSourceDoesNotExist() throws Exception { create(igfs, paths(DIR, DIR_NEW), null); GridTestUtils.assertThrowsInherited(log, new Callable<Object>() { @Override public Object call() throws Exception { igfs.rename(SUBDIR, SUBDIR_NEW); return null; } }, IgfsException.class, null); checkNotExist(igfs, igfsSecondary, SUBDIR, SUBDIR_NEW); }
/** * Test rename in case both local and remote file systems have the same folder structure and the path being renamed * is a directory. * * @throws Exception If failed. */ @Test public void testRenameDirectory() throws Exception { create(igfs, paths(DIR, SUBDIR), null); igfs.rename(SUBDIR, SUBDIR2); checkExist(igfs, igfsSecondary, SUBDIR2); checkNotExist(igfs, igfsSecondary, SUBDIR); }
/** * Test delete when the path parent is the root. * * @throws Exception If failed. */ @Test public void testDeleteParentRoot() throws Exception { create(igfs, paths(DIR, SUBDIR, SUBSUBDIR), paths(FILE)); igfs.delete(DIR, true); checkNotExist(igfs, igfsSecondary, DIR, SUBDIR, SUBSUBDIR, FILE); }
/** * Test delete in case both local and remote file systems have the same folder structure. * * @throws Exception If failed. */ @Test public void testDelete() throws Exception { create(igfs, paths(DIR, SUBDIR, SUBSUBDIR), paths(FILE)); igfs.delete(SUBDIR, true); checkNotExist(igfs, igfsSecondary, SUBDIR, SUBSUBDIR, FILE); }
/** * Test move and rename in case both local and remote file systems have the same folder structure and the path * being renamed is a directory. * * @throws Exception If failed. */ @Test public void testMoveRenameDirectory() throws Exception { create(igfs, paths(DIR, SUBDIR, SUBSUBDIR, DIR_NEW, SUBDIR_NEW), null); igfs.rename(SUBSUBDIR, SUBSUBDIR_NEW); checkExist(igfs, igfsSecondary, SUBSUBDIR_NEW); checkNotExist(igfs, igfsSecondary, SUBSUBDIR); }
/** * Test rename in case both local and remote file systems have the same folder structure and the path being renamed * is a file. * * @throws Exception If failed. */ @Test public void testRenameFile() throws Exception { create(igfs, paths(DIR, SUBDIR), paths(FILE)); igfs.rename(FILE, FILE2); checkExist(igfs, igfsSecondary, FILE2); checkNotExist(igfs, igfsSecondary, FILE); }
/** * Test move and rename in case both local and remote file systems have the same folder structure and the path being * renamed is a file. * * @throws Exception If failed. */ @Test public void testMoveRenameFile() throws Exception { create(igfs, paths(DIR, SUBDIR, DIR_NEW, SUBDIR_NEW), paths(FILE)); igfs.rename(FILE, FILE_NEW); checkExist(igfs, igfsSecondary, FILE_NEW); checkNotExist(igfs, igfsSecondary, FILE); }
/** * Test directory move when destination is the root. * * @throws Exception If failed. */ @Test public void testMoveDirectoryDestinationRoot() throws Exception { create(igfs, paths(DIR, SUBDIR, SUBSUBDIR), null); igfs.rename(SUBSUBDIR, IgfsPath.ROOT); checkExist(igfs, igfsSecondary, new IgfsPath("/" + SUBSUBDIR.name())); checkNotExist(igfs, igfsSecondary, SUBSUBDIR); }
/** * Test file rename when parent folder is the root. * * @throws Exception If failed. */ @Test public void testRenameFileParentRoot() throws Exception { IgfsPath file1 = new IgfsPath("/file1"); IgfsPath file2 = new IgfsPath("/file2"); create(igfs, null, paths(file1)); igfs.rename(file1, file2); checkExist(igfs, igfsSecondary, file2); checkNotExist(igfs, igfsSecondary, file1); }
/** * Test directory move and rename when source parent is the root. * * @throws Exception If failed. */ @Test public void testMoveRenameDirectorySourceParentRoot() throws Exception { IgfsPath dir = new IgfsPath("/" + SUBSUBDIR_NEW.name()); create(igfs, paths(DIR_NEW, SUBDIR_NEW, dir), null); igfs.rename(dir, SUBSUBDIR_NEW); checkExist(igfs, igfsSecondary, SUBSUBDIR_NEW); checkNotExist(igfs, igfsSecondary, dir); }
/** * Test move in case both local and remote file systems have the same folder structure and the path being renamed is * a directory. * * @throws Exception If failed. */ @Test public void testMoveDirectory() throws Exception { create(igfs, paths(DIR, SUBDIR, SUBSUBDIR, DIR_NEW, SUBDIR_NEW), null); igfs.rename(SUBSUBDIR, SUBDIR_NEW); checkExist(igfs, igfsSecondary, new IgfsPath(SUBDIR_NEW, SUBSUBDIR.name())); checkNotExist(igfs, igfsSecondary, SUBSUBDIR); }
/** * Test directory move and rename when destination is the root. * * @throws Exception If failed. */ @Test public void testMoveRenameDirectoryDestinationRoot() throws Exception { IgfsPath dir = new IgfsPath("/" + SUBSUBDIR.name()); create(igfs, paths(DIR, SUBDIR, SUBSUBDIR), null); igfs.rename(SUBSUBDIR, dir); checkExist(igfs, igfsSecondary, dir); checkNotExist(igfs, igfsSecondary, SUBSUBDIR); }
/** * Test directory rename when parent folder is the root. * * @throws Exception If failed. */ @Test public void testRenameDirectoryParentRoot() throws Exception { IgfsPath dir1 = new IgfsPath("/dir1"); IgfsPath dir2 = new IgfsPath("/dir2"); create(igfs, paths(dir1), null); igfs.rename(dir1, dir2); checkExist(igfs, igfsSecondary, dir2); checkNotExist(igfs, igfsSecondary, dir1); }
/** * Test file move when destination is the root. * * @throws Exception If failed. */ @Test public void testMoveFileDestinationRoot() throws Exception { create(igfs, paths(DIR, SUBDIR), paths(FILE)); igfs.rename(FILE, IgfsPath.ROOT); checkExist(igfs, igfsSecondary, new IgfsPath("/" + FILE.name())); checkNotExist(igfs, igfsSecondary, FILE); }
/** * Test move in case both local and remote file systems have the same folder structure and the path being renamed is * a file. * * @throws Exception If failed. */ @Test public void testMoveFile() throws Exception { create(igfs, paths(DIR, SUBDIR, DIR_NEW, SUBDIR_NEW), paths(FILE)); igfs.rename(FILE, SUBDIR_NEW); checkExist(igfs, igfsSecondary, new IgfsPath(SUBDIR_NEW, FILE.name())); checkNotExist(igfs, igfsSecondary, FILE); }
/** * Test file move and rename when destination is the root. * * @throws Exception If failed. */ @Test public void testMoveRenameFileDestinationRoot() throws Exception { IgfsPath file = new IgfsPath("/" + FILE.name()); create(igfs, paths(DIR, SUBDIR), paths(FILE)); igfs.rename(FILE, file); checkExist(igfs, igfsSecondary, file); checkNotExist(igfs, igfsSecondary, FILE); }
/** * Test file move and rename when source parent is the root. * * @throws Exception If failed. */ @Test public void testMoveRenameFileSourceParentRoot() throws Exception { IgfsPath file = new IgfsPath("/" + FILE_NEW.name()); create(igfs, paths(DIR_NEW, SUBDIR_NEW), paths(file)); igfs.rename(file, FILE_NEW); checkExist(igfs, igfsSecondary, FILE_NEW); checkNotExist(igfs, igfsSecondary, file); }
/** * Test directory move when source parent is the root. * * @throws Exception If failed. */ @Test public void testMoveDirectorySourceParentRoot() throws Exception { IgfsPath dir = new IgfsPath("/" + SUBSUBDIR.name()); create(igfs, paths(DIR_NEW, SUBDIR_NEW, dir), null); igfs.rename(dir, SUBDIR_NEW); checkExist(igfs, igfsSecondary, new IgfsPath(SUBDIR_NEW, SUBSUBDIR.name())); checkNotExist(igfs, igfsSecondary, dir); }
/** * Test file move when source parent is the root. * * @throws Exception If failed. */ @Test public void testMoveFileSourceParentRoot() throws Exception { IgfsPath file = new IgfsPath("/" + FILE.name()); create(igfs, paths(DIR_NEW, SUBDIR_NEW), paths(file)); igfs.rename(file, SUBDIR_NEW); checkExist(igfs, igfsSecondary, new IgfsPath(SUBDIR_NEW, FILE.name())); checkNotExist(igfs, igfsSecondary, file); }