if (appendSupported()) { final AtomicInteger ctr = new AtomicInteger(); final AtomicReference<Exception> err = new AtomicReference<>();
if (appendSupported()) { final AtomicBoolean stop = new AtomicBoolean();
/** * Test create when parent is the root. * * @throws Exception If failed. */ @Test public void testAppendParentRoot() throws Exception { if (appendSupported()) { IgfsPath file = new IgfsPath("/" + FILE.name()); createFile(igfs, file, true, BLOCK_SIZE, chunk); appendFile(igfs, file, chunk); checkFile(igfs, igfsSecondary, file, chunk, chunk); } }
/** * Test subsequent "append" commands on the same file without closing the output streams. * * @throws Exception If failed. */ @Test public void testAppendNoClose() throws Exception { if (mode != PRIMARY) return; if (appendSupported()) { create(igfs, paths(DIR, SUBDIR), null); createFile(igfs, FILE, false); GridTestUtils.assertThrowsInherited(log(), new Callable<Object>() { @Override public Object call() throws Exception { IgfsOutputStream os1 = null; IgfsOutputStream os2 = null; try { os1 = igfs.append(FILE, false); os2 = igfs.append(FILE, false); } finally { U.closeQuiet(os1); U.closeQuiet(os2); } return null; } }, IgniteException.class, null); } }
/** * Test rename on the file when it was opened for write(append) and is not closed yet. * * @throws Exception If failed. */ @Test public void testAppendRenameNoClose() throws Exception { if (dual) return; if (appendSupported()) { create(igfs, paths(DIR, SUBDIR), null); createFile(igfs, FILE, false); IgfsOutputStream os = null; try { os = igfs.append(FILE, false); igfs.rename(FILE, FILE2); os.close(); } finally { U.closeQuiet(os); } } }
/** * Test rename on the file parent when it was opened for write(append) and is not closed yet. * * @throws Exception If failed. */ @Test public void testAppendRenameParentNoClose() throws Exception { if (dual) return; if (appendSupported()) { create(igfs, paths(DIR, SUBDIR), null); createFile(igfs, FILE, false); IgfsOutputStream os = null; try { os = igfs.append(FILE, false); igfs.rename(SUBDIR, SUBDIR2); os.close(); } finally { U.closeQuiet(os); } } }
/** * Test update on the file when it was opened for write(create) and is not closed yet. * * @throws Exception If failed. */ @Test public void testAppendUpdateNoClose() throws Exception { if (dual) return; if (appendSupported()) { Map<String, String> props = properties("owner", "group", "0555"); create(igfs, paths(DIR, SUBDIR), null); createFile(igfs, FILE, false); IgfsOutputStream os = null; try { os = igfs.append(FILE, false); if (permissionsSupported()) igfs.update(FILE, props); os.close(); } finally { U.closeQuiet(os); } } }
@Test public void testAppend() throws Exception { if (appendSupported()) { create(igfs, paths(DIR, SUBDIR), null);