/** {@inheritDoc} */ @Override public void preHandleDir(String strPath) throws Exception { IgfsPath path = new IgfsPath(strPath); if (!fs.exists(path)) { System.out.println("path " + path.toString() + " not exist"); throw new IgniteException("path " + path.toString() + " not exist"); } } }
/** {@inheritDoc} */ @Override public void preHandleDir(String strPath) throws Exception { IgfsPath path = new IgfsPath(strPath); if (fs.exists(path)) throw new IgniteException("path " + path.toString() + " already exists"); try { fs.mkdirs(path); } catch (IgniteException ex) { throw ex; } } }
/** * Test format operation on non-empty file system. * * @throws Exception If failed. */ @Test public void testFormatNonEmpty() throws Exception { String dirPath = "/A/B/C"; igfs.mkdirs(path(dirPath)); String filePath = "/someFile"; create(filePath, false, "Some text."); igfs.clear(); assert !igfs.exists(path(dirPath)); assert !igfs.exists(path(filePath)); GridTestUtils.waitForCondition(new GridAbsPredicate() { @Override public boolean apply() { int metaSize = 0; for (Object metaId : grid(0).cachex(igfs.configuration().getMetaCacheConfiguration().getName()) .keySet()) { if (!IgfsUtils.isRootOrTrashId((IgniteUuid)metaId)) metaSize++; } return metaSize == 0; } }, 5000); }
assert igfs.exists(path("/A/B1/C1"));