/** {@inheritDoc} */ @Override public boolean delete(IgfsPath path, boolean recursive) { return igfs.delete(path, recursive); }
@Override public Boolean call() throws Exception { U.awaitQuiet(barrier); try { return igfs.delete(DIR, true); } catch (IgniteException ignored) { return false; } } });
@Override public Boolean call() throws Exception { U.awaitQuiet(barrier); return igfs.delete(SUBDIR, true); } });
@Override public Boolean call() throws Exception { U.awaitQuiet(barrier); try { return igfs.delete(SUBDIR, true); } catch (IgniteException ignored) { return false; } } });
@Override public Boolean call() throws Exception { U.awaitQuiet(barrier); return igfs.delete(SUBDIR_NEW, true); } });
@Override public Boolean call() throws Exception { U.awaitQuiet(barrier); try { return igfs.delete(SUBDIR, true); } catch (IgniteException ignored) { return false; } } });
@Override public Boolean call() throws Exception { U.awaitQuiet(barrier); try { return igfs.delete(SUBSUBDIR, true); } catch (IgniteException ignored) { return false; } } });
@Override public Boolean call() throws Exception { U.awaitQuiet(barrier); try { return igfs.delete(SUBDIR_NEW, true); } catch (IgniteException ignored) { return false; } } });
@Override public Boolean call() throws Exception { U.awaitQuiet(barrier); try { igfs.delete(SUBDIR, true); return true; } catch (IgniteException ignored) { return false; } } });
@Override public Boolean call() throws Exception { U.awaitQuiet(barrier); try { igfs.delete(SUBSUBDIR, true); return true; } catch (IgniteException ignored) { return false; } } });
@Override public void run() { try { int lvl = rand.nextInt(lvlCnt) + 1; IgfsPath path = rand.nextInt(childrenDirPerLvl + childrenFilePerLvl) < childrenDirPerLvl ? dirPaths.get(lvl).get(rand.nextInt(dirPaths.get(lvl).size())) : filePaths.get(lvl).get(rand.nextInt(filePaths.get(lvl).size())); U.awaitQuiet(barrier); igfs.delete(path, true); } catch (IgniteException ignore) { // No-op. } } };
@Override public Object call() throws Exception { IgfsPath FILE = new IgfsPath(new IgfsPath("/dir"), "file"); igfs.delete(FILE, false); return null; } }, IgfsException.class, "Failed to execute operation because there are no IGFS metadata nodes.");
/** * * @throws Exception If failed. */ @Test public void testDeleteSymlinkDir() throws Exception { if (U.isWindows()) return; createSymlinks(); // Only symlink must be deleted. Destination content must be exist. igfs.delete(DIR, true); assertTrue(fileLinkDest.exists()); }
/** * * @throws Exception If failed. */ @Test public void testDeleteSymlinkDir() throws Exception { if (U.isWindows()) return; createSymlinks(); // Only symlink must be deleted. Destination content must be exist. igfs.delete(DIR, true); assertTrue(fileLinkDest.exists()); }
/** * 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 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 when the path parent is the root and the path is missing locally. * * @throws Exception If failed. */ @Test public void testDeleteParentRootPathMissing() throws Exception { create(igfsSecondary, paths(DIR, SUBDIR, SUBSUBDIR), paths(FILE)); create(igfs, null, null); igfs.delete(DIR, true); checkNotExist(igfs, igfsSecondary, DIR, SUBDIR, SUBSUBDIR, FILE); }
/** * Test delete in case parent exists remotely, but no parents exist locally. * * @throws Exception If failed. */ @Test public void testDeletePathMissing() throws Exception { create(igfsSecondary, paths(DIR, SUBDIR, SUBSUBDIR), paths(FILE)); create(igfs, null, null); igfs.delete(SUBDIR, true); checkExist(igfs, DIR); checkNotExist(igfs, igfsSecondary, SUBDIR, SUBSUBDIR, FILE); }
/** * Test delete in case parent exists remotely, but some part of the parent path doesn't exist locally. * * @throws Exception If failed. */ @Test public void testDeletePathMissingPartially() throws Exception { create(igfsSecondary, paths(DIR, SUBDIR, SUBSUBDIR), paths(FILE)); create(igfs, paths(DIR), null); igfs.delete(SUBDIR, true); checkExist(igfs, DIR); checkNotExist(igfs, igfsSecondary, SUBDIR, SUBSUBDIR, FILE); }
/** * Ensure that delete will not be successful in non-empty directory when recursive flag is set to {@code false}. * * @throws Exception If failed. */ @Test public void testDeleteDirectoryNotEmpty() throws Exception { create(igfs, paths(DIR, SUBDIR, SUBSUBDIR), paths(FILE)); checkExist(igfs, igfsSecondary, SUBDIR, SUBSUBDIR, FILE); try { boolean ok = igfs.delete(SUBDIR, false); assertFalse(ok); } catch (IgfsDirectoryNotEmptyException ignore) { // No-op, expected. } checkExist(igfs, igfsSecondary, SUBDIR, SUBSUBDIR, FILE); }