/** {@inheritDoc} */ @Override public boolean exists(IgfsPath path) { return igfs.exists(path); }
/** * Ensure that the given paths exist in the given IGFS. * * @param igfs IGFS. * @param paths Paths. * @throws IgniteCheckedException If failed. */ protected static void checkExist(IgfsImpl igfs, IgfsPath... paths) throws IgniteCheckedException { for (IgfsPath path : paths) assert igfs.exists(path) : "Path doesn't exist [igfs=" + igfs.name() + ", path=" + path + ']'; }
/** * Ensure that the given paths don't exist in the given IGFS. * * @param igfs IGFS. * @param paths Paths. * @throws Exception If failed. */ protected void checkNotExist(IgfsImpl igfs, IgfsPath... paths) throws Exception { for (IgfsPath path : paths) assert !igfs.exists(path) : "Path exists [igfs=" + igfs.name() + ", path=" + path + ']'; }
/** * Test existence check when the path doesn't exist remotely. * * @throws Exception If failed. */ @Test public void testExistsPathDoesNotExist() throws Exception { assert !igfs.exists(DIR); }
/** * Test existence check when the path exists only remotely. * * @throws Exception If failed. */ @Test public void testExistsPathMissing() throws Exception { create(igfsSecondary, paths(DIR), null); assert igfs.exists(DIR); }
/** * Checks simple write. * * @throws Exception On error. */ @Test public void testSimpleWrite() throws Exception { IgfsPath path = new IgfsPath("/file1"); IgfsOutputStream os = igfs.create(path, 128, true/*overwrite*/, null, 0, 256, null); os.write(chunk); os.close(); assert igfs.exists(path); checkFileContent(igfs, path, chunk); os = igfs.create(path, 128, true/*overwrite*/, null, 0, 256, null); assert igfs.exists(path); os.write(chunk); assert igfs.exists(path); os.write(chunk); assert igfs.exists(path); os.close(); assert igfs.exists(path); checkFileContent(igfs, path, chunk, chunk); }
@Override public void run() { int idx = ctr.incrementAndGet(); final IgfsPath path = new IgfsPath("/file" + idx); try { for (int i = 0; i < REPEAT_CNT; i++) { IgfsOutputStream os = igfs.create(path, 128, true/*overwrite*/, null, 0, 256, null); os.write(chunk); os.close(); assert igfs.exists(path); } awaitFileClose(igfs, path); checkFileContent(igfs, path, chunk); } catch (IOException | IgniteCheckedException e) { err.compareAndSet(null, e); // Log the very first error. } } }, threadCnt);
@Override public void run() { int idx = ctr.getAndIncrement(); IgfsPath path = new IgfsPath("/file" + idx); try { byte[][] chunks = new byte[REPEAT_CNT][]; for (int i = 0; i < REPEAT_CNT; i++) { chunks[i] = chunk; IgfsOutputStream os = igfs.append(path, false); os.write(chunk); os.close(); assert igfs.exists(path); } awaitFileClose(igfs, path); checkFileContent(igfs, path, chunks); } catch (IOException | IgniteCheckedException e) { err.compareAndSet(null, e); // Log the very first error. } } }, threadCnt);
assertFalse(igfs.exists(dir.parent()));
assertTrue(igfs.exists(new IgfsPath(dir.parent(), file.name())));
/** {@inheritDoc} */ @Override public boolean exists(IgfsPath path) { return igfs.exists(path); }
create(igfs, paths(DIR, SUBDIR), null); assert igfs.exists(SUBDIR);