/** {@inheritDoc} */ @Override public void postHandleDir(String strPath) throws Exception { IgfsPath path = new IgfsPath(strPath); Collection<IgfsPath> lst = fs.listPaths(path); assert lst != null : "List of paths must not be null"; } }
/** * Dump IGFS content. * * @param igfs IGFS. * @param path Path. * @throws Exception If failed. */ private static void dumpIgfs(IgniteFileSystem igfs, IgfsPath path) throws Exception { IgfsFile file = igfs.info(path); assert file != null; System.out.println(file.path()); if (file.isDirectory()) { for (IgfsPath child : igfs.listPaths(path)) dumpIgfs(igfs, child); } else { try (BufferedReader br = new BufferedReader(new InputStreamReader(igfs.open(path)))) { String line = br.readLine(); while (line != null) { System.out.println(line); line = br.readLine(); } } } }
/** * Test file creation. * * @throws Exception In case of exception. */ @Test public void testCreateFile() throws Exception { IgfsPath path = new IgfsPath("/asdf"); long max = 100L * CFG_BLOCK_SIZE / WRITING_THREADS_CNT; for (long size = 0; size <= max; size = size * 15 / 10 + 1) { assertTrue(F.isEmpty(fs.listPaths(IgfsPath.ROOT))); testCreateFile(path, size, new Random().nextInt()); } }
Collection<IgfsPath> paths = igfs.listPaths(path("/")); paths = igfs.listPaths(path("/A")); paths = igfs.listPaths(path("/A/B1")); assertNull(igfs.info(path("/A1/B1/C3"))); assertTrue(F.isEmpty(igfs.listPaths(path("/A1/B1")))); assertTrue(F.isEmpty(igfs.listPaths(path("/A2")))); assertEquals(Arrays.asList(path("/A"), path("/A1"), path("/A2")), sorted(igfs.listPaths(path("/")))); igfs.delete(path("/A2"), true); assertTrue(F.isEmpty(igfs.listPaths(path("/")))); igfs.delete(path("/"), true); assertTrue(F.isEmpty(igfs.listPaths(path("/"))));