@Override public Object call() throws Exception { IgfsAbstractSelfTest.create(igfs, new IgfsPath[]{new IgfsPath("/dir")}, null); return null; } }, IgfsException.class, "Failed to execute operation because there are no IGFS metadata nodes.");
/** * Test regular file open. * * @throws Exception If failed. */ @Test public void testOpen() throws Exception { create(igfs, paths(DIR, SUBDIR), null); createFile(igfs, FILE, true, chunk); checkFileContent(igfs, FILE, chunk); // Read again when the whole file is in memory. checkFileContent(igfs, FILE, chunk); }
/** * Test existence check when the path exists both locally and remotely. * * @throws Exception If failed. */ @Test public void testExists() throws Exception { create(igfs, paths(DIR), null); checkExist(igfs, igfsSecondary, DIR); }
/** * 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 info routine when the path exists both locally and remotely. * * @throws Exception If failed. */ @Test public void testInfo() throws Exception { create(igfs, paths(DIR), null); IgfsFile info = igfs.info(DIR); assert info != null; assertEquals(DIR, info.path()); }
/** * 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 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 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 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 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 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 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 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 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 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 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 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); }