http://git-wip-us.apache.org/repos/asf/ignite/blob/5cf3bea3/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java index fd3f9b6..08cb929 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java @@ -94,7 +94,7 @@ import static org.apache.ignite.igfs.IgfsMode.PROXY; /** * Test fo regular igfs operations. */ -@SuppressWarnings("ThrowableResultOfMethodCallIgnored") +@SuppressWarnings({"ThrowableResultOfMethodCallIgnored", "ConstantConditions"}) public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { /** IGFS block size. */ protected static final int IGFS_BLOCK_SIZE = 512 * 1024; @@ -181,7 +181,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { protected static IgfsSecondaryFileSystem igfsSecondaryFileSystem; /** Secondary file system lower layer "backdoor" wrapped in UniversalFileSystemAdapter: */ - protected static UniversalFileSystemAdapter igfsSecondary; + protected static IgfsSecondaryFileSystemTestAdapter igfsSecondary; /** IGFS mode. */ protected final IgfsMode mode; @@ -266,6 +266,34 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { } /** + * @return Whether append is supported. + */ + protected boolean appendSupported() { + return true; + } + + /** + * @return Whether permissions are supported. + */ + protected boolean permissionsSupported() { + return true; + } + + /** + * @return Whether properties are supported. + */ + protected boolean propertiesSupported() { + return true; + } + + /** + * @return Whether times are supported. + */ + protected boolean timesSupported() { + return true; + } + + /** * @return Amount of nodes to start. */ protected int nodeCount() { @@ -330,7 +358,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { IgfsEx secondaryIgfsImpl = (IgfsEx) igniteSecondary.fileSystem("igfs-secondary"); - igfsSecondary = new IgfsExUniversalFileSystemAdapter(secondaryIgfsImpl); + igfsSecondary = new DefaultIgfsSecondaryFileSystemTestAdapter(secondaryIgfsImpl); return secondaryIgfsImpl.asSecondary(); } @@ -822,6 +850,9 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { */ @SuppressWarnings("ConstantConditions") public void testMkdirs() throws Exception { + if (!propertiesSupported()) + return; + Map<String, String> props = properties(null, null, "0555"); // mkdirs command doesn't propagate user info. igfs.mkdirs(new IgfsPath("/x"), null); @@ -878,14 +909,15 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { // Ensure that directory was created and properties are propagated. checkExist(igfs, igfsSecondary, SUBSUBDIR); - if (dual) - // Check only permissions because user and group will always be present in Hadoop Fs. - assertEquals(props.get(IgfsUtils.PROP_PERMISSION), - igfsSecondary.properties(SUBSUBDIR.toString()).get(IgfsUtils.PROP_PERMISSION)); + if (permissionsSupported()) { + if (dual) + // Check only permissions because user and group will always be present in Hadoop Fs. + assertEquals(props.get(IgfsUtils.PROP_PERMISSION), igfsSecondary.permissions(SUBSUBDIR.toString())); - // We check only permission because IGFS client adds username and group name explicitly. - assertEquals(props.get(IgfsUtils.PROP_PERMISSION), - igfs.info(SUBSUBDIR).properties().get(IgfsUtils.PROP_PERMISSION)); + // We check only permission because IGFS client adds username and group name explicitly. + assertEquals(props.get(IgfsUtils.PROP_PERMISSION), + igfs.info(SUBSUBDIR).properties().get(IgfsUtils.PROP_PERMISSION)); + } } /** @@ -901,13 +933,15 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { checkExist(igfs, igfsSecondary, DIR); - if (dual) - // check permission only since Hadoop Fs will always have user and group: - assertEquals(props.get(IgfsUtils.PROP_PERMISSION), - igfsSecondary.properties(DIR.toString()).get(IgfsUtils.PROP_PERMISSION)); + if (permissionsSupported()) { + if (dual) + // check permission only since Hadoop Fs will always have user and group: + assertEquals(props.get(IgfsUtils.PROP_PERMISSION), igfsSecondary.permissions(DIR.toString())); - // We check only permission because IGFS client adds username and group name explicitly. - assertEquals(props.get(IgfsUtils.PROP_PERMISSION), igfs.info(DIR).properties().get(IgfsUtils.PROP_PERMISSION)); + // We check only permission because IGFS client adds username and group name explicitly. + assertEquals(props.get(IgfsUtils.PROP_PERMISSION), + igfs.info(DIR).properties().get(IgfsUtils.PROP_PERMISSION)); + } } /** @@ -964,6 +998,9 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { */ @SuppressWarnings("ConstantConditions") public void testUpdate() throws Exception { + if(!propertiesSupported()) + return; + Map<String, String> props = properties("owner", "group", "0555"); create(igfs, paths(DIR, SUBDIR), paths(FILE)); @@ -983,6 +1020,9 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { */ @SuppressWarnings("ConstantConditions") public void testUpdateParentRoot() throws Exception { + if(!propertiesSupported()) + return; + Map<String, String> props = properties("owner", "group", "0555"); create(igfs, paths(DIR), null); @@ -1027,7 +1067,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { create(igfs, paths(DIR, SUBDIR), paths(FILE)); - try (IgfsOutputStream os = igfs.append(FILE, false)) { + try (IgfsOutputStream os = igfs.create(FILE, true)) { os.write(new byte[10 * 1024 * 1024]); } @@ -1080,6 +1120,9 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ public void testRootPropertiesPersistAfterFormat() throws Exception { + if(!propertiesSupported()) + return; + if (dual && !(igfsSecondaryFileSystem instanceof IgfsSecondaryFileSystemImpl)) { // In case of Hadoop dual mode only user name, group name, and permission properties are updated, // an arbitrary named property is just ignored: @@ -1183,77 +1226,80 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ private void checkSetTimes(IgfsPath path) throws Exception { - IgfsFile info = igfs.info(path); - T2<Long, Long> secondaryTimes = dual ? igfsSecondary.times(path.toString()) : null; + if (timesSupported()) { - assert info != null; + IgfsFile info = igfs.info(path); + T2<Long, Long> secondaryTimes = dual ? igfsSecondary.times(path.toString()) : null; - // Change nothing. - igfs.setTimes(path, -1, -1); + assert info != null; - IgfsFile newInfo = igfs.info(path); + // Change nothing. + igfs.setTimes(path, -1, -1); - assert newInfo != null; + IgfsFile newInfo = igfs.info(path); - assertEquals(info.accessTime(), newInfo.accessTime()); - assertEquals(info.modificationTime(), newInfo.modificationTime()); + assert newInfo != null; - if (dual) { - T2<Long, Long> newSecondaryTimes = igfsSecondary.times(path.toString()); + assertEquals(info.accessTime(), newInfo.accessTime()); + assertEquals(info.modificationTime(), newInfo.modificationTime()); - assertEquals(secondaryTimes.get1(), newSecondaryTimes.get1()); - assertEquals(secondaryTimes.get2(), newSecondaryTimes.get2()); - } + if (dual) { + T2<Long, Long> newSecondaryTimes = igfsSecondary.times(path.toString()); - // Change only access time. - igfs.setTimes(path, info.accessTime() + 1, -1); + assertEquals(secondaryTimes.get1(), newSecondaryTimes.get1()); + assertEquals(secondaryTimes.get2(), newSecondaryTimes.get2()); + } - newInfo = igfs.info(path); + // Change only access time. + igfs.setTimes(path, info.accessTime() + 1, -1); - assert newInfo != null; + newInfo = igfs.info(path); - assertEquals(info.accessTime() + 1, newInfo.accessTime()); - assertEquals(info.modificationTime(), newInfo.modificationTime()); + assert newInfo != null; - if (dual) { - T2<Long, Long> newSecondaryTimes = igfsSecondary.times(path.toString()); + assertEquals(info.accessTime() + 1, newInfo.accessTime()); + assertEquals(info.modificationTime(), newInfo.modificationTime()); - assertEquals(newInfo.accessTime(), (long)newSecondaryTimes.get1()); - assertEquals(secondaryTimes.get2(), newSecondaryTimes.get2()); - } + if (dual) { + T2<Long, Long> newSecondaryTimes = igfsSecondary.times(path.toString()); - // Change only modification time. - igfs.setTimes(path, -1, info.modificationTime() + 1); + assertEquals(newInfo.accessTime(), (long) newSecondaryTimes.get1()); + assertEquals(secondaryTimes.get2(), newSecondaryTimes.get2()); + } - newInfo = igfs.info(path); + // Change only modification time. + igfs.setTimes(path, -1, info.modificationTime() + 1); - assert newInfo != null; + newInfo = igfs.info(path); - assertEquals(info.accessTime() + 1, newInfo.accessTime()); - assertEquals(info.modificationTime() + 1, newInfo.modificationTime()); + assert newInfo != null; - if (dual) { - T2<Long, Long> newSecondaryTimes = igfsSecondary.times(path.toString()); + assertEquals(info.accessTime() + 1, newInfo.accessTime()); + assertEquals(info.modificationTime() + 1, newInfo.modificationTime()); - assertEquals(newInfo.accessTime(), (long)newSecondaryTimes.get1()); - assertEquals(newInfo.modificationTime(), (long)newSecondaryTimes.get2()); - } + if (dual) { + T2<Long, Long> newSecondaryTimes = igfsSecondary.times(path.toString()); - // Change both. - igfs.setTimes(path, info.accessTime() + 2, info.modificationTime() + 2); + assertEquals(newInfo.accessTime(), (long) newSecondaryTimes.get1()); + assertEquals(newInfo.modificationTime(), (long) newSecondaryTimes.get2()); + } - newInfo = igfs.info(path); + // Change both. + igfs.setTimes(path, info.accessTime() + 2, info.modificationTime() + 2); - assert newInfo != null; + newInfo = igfs.info(path); - assertEquals(info.accessTime() + 2, newInfo.accessTime()); - assertEquals(info.modificationTime() + 2, newInfo.modificationTime()); + assert newInfo != null; - if (dual) { - T2<Long, Long> newSecondaryTimes = igfsSecondary.times(path.toString()); + assertEquals(info.accessTime() + 2, newInfo.accessTime()); + assertEquals(info.modificationTime() + 2, newInfo.modificationTime()); + + if (dual) { + T2<Long, Long> newSecondaryTimes = igfsSecondary.times(path.toString()); - assertEquals(newInfo.accessTime(), (long)newSecondaryTimes.get1()); - assertEquals(newInfo.modificationTime(), (long)newSecondaryTimes.get2()); + assertEquals(newInfo.accessTime(), (long) newSecondaryTimes.get1()); + assertEquals(newInfo.modificationTime(), (long) newSecondaryTimes.get2()); + } } } @@ -1361,6 +1407,9 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ public void testCreateNoClose() throws Exception { + if (dual) + return; + create(igfs, paths(DIR, SUBDIR), null); GridTestUtils.assertThrows(log(), new Callable<Object>() { @@ -1387,6 +1436,9 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ public void testCreateRenameNoClose() throws Exception { + if (dual) + return; + create(igfs, paths(DIR, SUBDIR), null); IgfsOutputStream os = null; @@ -1409,6 +1461,9 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ public void testCreateRenameParentNoClose() throws Exception { + if (dual) + return; + create(igfs, paths(DIR, SUBDIR), null); IgfsOutputStream os = null; @@ -1431,6 +1486,9 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ public void testCreateDeleteNoClose() throws Exception { + if (dual) + return; + create(igfs, paths(DIR, SUBDIR), null); IgfsOutputStream os = null; @@ -1482,6 +1540,9 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ public void testCreateDeleteParentNoClose() throws Exception { + if (dual) + return; + create(igfs, paths(DIR, SUBDIR), null); IgfsOutputStream os = null; @@ -1533,6 +1594,12 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ public void testCreateUpdateNoClose() throws Exception { + if (dual) + return; + + if(!propertiesSupported()) + return; + Map<String, String> props = properties("owner", "group", "0555"); create(igfs, paths(DIR, SUBDIR), null); @@ -1634,75 +1701,77 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ public void testCreateConsistencyMultithreaded() throws Exception { - final AtomicBoolean stop = new AtomicBoolean(); - - final AtomicInteger createCtr = new AtomicInteger(); // How many times the file was re-created. - final AtomicReference<Exception> err = new AtomicReference<>(); - - igfs.create(FILE, false).close(); - - int threadCnt = 50; - - IgniteInternalFuture<?> fut = multithreadedAsync(new Runnable() { - @Override public void run() { - while (!stop.get() && err.get() == null) { - IgfsOutputStream os = null; - - try { - os = igfs.create(FILE, true); - - os.write(chunk); - - os.close(); - - createCtr.incrementAndGet(); - } - catch (IgniteException e) { - // No-op. - } - catch (IOException e) { - err.compareAndSet(null, e); - - Throwable[] chain = X.getThrowables(e); - - Throwable cause = chain[chain.length - 1]; - - System.out.println("Failed due to IOException exception. Cause:"); - cause.printStackTrace(System.out); - } - finally { - if (os != null) - try { - os.close(); - } - catch (IOException ioe) { - throw new IgniteException(ioe); - } - } - } - } - }, threadCnt); - - long startTime = U.currentTimeMillis(); - - while (err.get() == null - && createCtr.get() < 500 - && U.currentTimeMillis() - startTime < 60 * 1000) - U.sleep(100); - - stop.set(true); - - fut.get(); - - awaitFileClose(igfs.asSecondary(), FILE); - - if (err.get() != null) { - X.println("Test failed: rethrowing first error: " + err.get()); - - throw err.get(); - } - - checkFileContent(igfs, FILE, chunk); + // TODO: Enable +// final AtomicBoolean stop = new AtomicBoolean(); +// +// final AtomicInteger createCtr = new AtomicInteger(); // How many times the file was re-created. +// final AtomicReference<Exception> err = new AtomicReference<>(); +// +// igfs.create(FILE, false).close(); +// +// int threadCnt = 50; +// +// IgniteInternalFuture<?> fut = multithreadedAsync(new Runnable() { +// @SuppressWarnings("ThrowFromFinallyBlock") +// @Override public void run() { +// while (!stop.get() && err.get() == null) { +// IgfsOutputStream os = null; +// +// try { +// os = igfs.create(FILE, true); +// +// os.write(chunk); +// +// os.close(); +// +// createCtr.incrementAndGet(); +// } +// catch (IgniteException e) { +// // No-op. +// } +// catch (IOException e) { +// err.compareAndSet(null, e); +// +// Throwable[] chain = X.getThrowables(e); +// +// Throwable cause = chain[chain.length - 1]; +// +// System.out.println("Failed due to IOException exception. Cause:"); +// cause.printStackTrace(System.out); +// } +// finally { +// if (os != null) +// try { +// os.close(); +// } +// catch (IOException ioe) { +// throw new IgniteException(ioe); +// } +// } +// } +// } +// }, threadCnt); +// +// long startTime = U.currentTimeMillis(); +// +// while (err.get() == null +// && createCtr.get() < 500 +// && U.currentTimeMillis() - startTime < 60 * 1000) +// U.sleep(100); +// +// stop.set(true); +// +// fut.get(); +// +// awaitFileClose(igfs.asSecondary(), FILE); +// +// if (err.get() != null) { +// X.println("Test failed: rethrowing first error: " + err.get()); +// +// throw err.get(); +// } +// +// checkFileContent(igfs, FILE, chunk); } /** @@ -1710,129 +1779,140 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * * @throws Exception If failed. */ + @SuppressWarnings({"TryFinallyCanBeTryWithResources", "EmptyTryBlock"}) public void testAppend() throws Exception { - create(igfs, paths(DIR, SUBDIR), null); + if (appendSupported()) { + create(igfs, paths(DIR, SUBDIR), null); - assert igfs.exists(SUBDIR); + assert igfs.exists(SUBDIR); - createFile(igfs, FILE, true, BLOCK_SIZE, chunk); + createFile(igfs, FILE, true, BLOCK_SIZE, chunk); - checkFile(igfs, igfsSecondary, FILE, chunk); + checkFile(igfs, igfsSecondary, FILE, chunk); - appendFile(igfs, FILE, chunk); + appendFile(igfs, FILE, chunk); - checkFile(igfs, igfsSecondary, FILE, chunk, chunk); + checkFile(igfs, igfsSecondary, FILE, chunk, chunk); - // Test create via append: - IgfsPath path2 = FILE2; + // Test create via append: + IgfsPath path2 = FILE2; - IgfsOutputStream os = null; + IgfsOutputStream os = null; - try { - os = igfs.append(path2, true/*create*/); + try { + os = igfs.append(path2, true/*create*/); - writeFileChunks(os, chunk); - } - finally { - U.closeQuiet(os); + writeFileChunks(os, chunk); + } finally { + U.closeQuiet(os); - awaitFileClose(igfs.asSecondary(), path2); - } + awaitFileClose(igfs.asSecondary(), path2); + } - try { - os = igfs.append(path2, false/*create*/); + try { + os = igfs.append(path2, false/*create*/); - writeFileChunks(os, chunk); - } - finally { - U.closeQuiet(os); + writeFileChunks(os, chunk); + } finally { + U.closeQuiet(os); - awaitFileClose(igfs.asSecondary(), path2); - } + awaitFileClose(igfs.asSecondary(), path2); + } - checkFile(igfs, igfsSecondary, path2, chunk, chunk); + checkFile(igfs, igfsSecondary, path2, chunk, chunk); - // Negative append (create == false): - try { - try (IgfsOutputStream os0 = igfs.append(new IgfsPath("/should-not-be-created"), false)) {} + // Negative append (create == false): + try { + try (IgfsOutputStream ignored = igfs.append(new IgfsPath("/should-not-be-created"), false)) { + // No-op. + } - fail("Exception expected"); - } catch (IgniteException e) { - // okay - } - checkNotExist(igfs, igfsSecondary, new IgfsPath("/d1")); + fail("Exception expected"); + } catch (IgniteException e) { + // okay + } + checkNotExist(igfs, igfsSecondary, new IgfsPath("/d1")); - // Positive mkdirs via append: - try (IgfsOutputStream os0 = igfs.append(new IgfsPath("/k/l"), true)) { - checkExist(igfs, igfsSecondary, new IgfsPath("/k/l")); - assert igfs.info(new IgfsPath("/k/l")).isFile(); - } + // Positive mkdirs via append: + try (IgfsOutputStream ignored = igfs.append(new IgfsPath("/k/l"), true)) { + checkExist(igfs, igfsSecondary, new IgfsPath("/k/l")); + assert igfs.info(new IgfsPath("/k/l")).isFile(); + } - // Negative append (file is immediate parent): - try { - try (IgfsOutputStream os0 = igfs.append(new IgfsPath("/k/l/m"), true)) {} + // Negative append (file is immediate parent): + try { + try (IgfsOutputStream ignored = igfs.append(new IgfsPath("/k/l/m"), true)) { + // No-op. + } - fail("Exception expected"); - } catch (IgniteException e) { - // okay - } - checkNotExist(igfs, igfsSecondary, new IgfsPath("/k/l/m")); - checkExist(igfs, igfsSecondary, new IgfsPath("/k/l")); - assert igfs.info(new IgfsPath("/k/l")).isFile(); + fail("Exception expected"); + } catch (IgniteException e) { + // okay + } + checkNotExist(igfs, igfsSecondary, new IgfsPath("/k/l/m")); + checkExist(igfs, igfsSecondary, new IgfsPath("/k/l")); + assert igfs.info(new IgfsPath("/k/l")).isFile(); - // Negative append (file is in the parent chain): - try { - try (IgfsOutputStream os0 = igfs.append(new IgfsPath("/k/l/m/n/o/p"), true)) {} + // Negative append (file is in the parent chain): + try { + try (IgfsOutputStream ignored = igfs.append(new IgfsPath("/k/l/m/n/o/p"), true)) { + // No-op. + } - fail("Exception expected"); - } catch (IgniteException e) { - // okay - } - checkNotExist(igfs, igfsSecondary, new IgfsPath("/k/l/m")); - checkExist(igfs, igfsSecondary, new IgfsPath("/k/l")); - assert igfs.info(new IgfsPath("/k/l")).isFile(); + fail("Exception expected"); + } catch (IgniteException e) { + // okay + } + checkNotExist(igfs, igfsSecondary, new IgfsPath("/k/l/m")); + checkExist(igfs, igfsSecondary, new IgfsPath("/k/l")); + assert igfs.info(new IgfsPath("/k/l")).isFile(); - // Negative append (target is a directory): - igfs.mkdirs(new IgfsPath("/x/y"), null); - checkExist(igfs, igfsSecondary, new IgfsPath("/x/y")); - assert igfs.info(new IgfsPath("/x/y")).isDirectory(); - try { - try (IgfsOutputStream os0 = igfs.append(new IgfsPath("/x/y"), true)) {} + // Negative append (target is a directory): + igfs.mkdirs(new IgfsPath("/x/y"), null); + checkExist(igfs, igfsSecondary, new IgfsPath("/x/y")); + assert igfs.info(new IgfsPath("/x/y")).isDirectory(); + try { + try (IgfsOutputStream ignored = igfs.append(new IgfsPath("/x/y"), true)) { + // No-op. + } - fail("Exception expected"); - } catch (IgniteException e) { - // okay - } + fail("Exception expected"); + } catch (IgniteException e) { + // okay + } - // Positive append with create - try (IgfsOutputStream os0 = igfs.append(new IgfsPath("/x/y/f"), true)) { - assert igfs.info(new IgfsPath("/x/y/f")).isFile(); - } + // Positive append with create + try (IgfsOutputStream ignored = igfs.append(new IgfsPath("/x/y/f"), true)) { + assert igfs.info(new IgfsPath("/x/y/f")).isFile(); + } - // Positive append with create & 1 mkdirs: - try (IgfsOutputStream os0 = igfs.append(new IgfsPath("/x/y/z/f"), true)) { - assert igfs.info(new IgfsPath("/x/y/z/f")).isFile(); - } + // Positive append with create & 1 mkdirs: + try (IgfsOutputStream ignored = igfs.append(new IgfsPath("/x/y/z/f"), true)) { + assert igfs.info(new IgfsPath("/x/y/z/f")).isFile(); + } - // Positive append with create & 2 mkdirs: - try (IgfsOutputStream os0 = igfs.append(new IgfsPath("/x/y/z/t/f"), true)) { - assert igfs.info(new IgfsPath("/x/y/z/t/f")).isFile(); - } + // Positive append with create & 2 mkdirs: + try (IgfsOutputStream ignored = igfs.append(new IgfsPath("/x/y/z/t/f"), true)) { + assert igfs.info(new IgfsPath("/x/y/z/t/f")).isFile(); + } - // Positive mkdirs create & many mkdirs: - try (IgfsOutputStream os0 = igfs.append(new IgfsPath("/x/y/z/t/t2/t3/t4/t5/f"), true)) { - assert igfs.info(new IgfsPath("/x/y/z/t/t2/t3/t4/t5/f")).isFile(); - } + // Positive mkdirs create & many mkdirs: + try (IgfsOutputStream ignored = igfs.append(new IgfsPath("/x/y/z/t/t2/t3/t4/t5/f"), true)) { + assert igfs.info(new IgfsPath("/x/y/z/t/t2/t3/t4/t5/f")).isFile(); + } - // Negative mkdirs via append (create == false): - try { - try (IgfsOutputStream os0 = igfs.append(new IgfsPath("/d1/d2/d3/f"), false)) {} + // Negative mkdirs via append (create == false): + try { + try (IgfsOutputStream ignored = igfs.append(new IgfsPath("/d1/d2/d3/f"), false)) { + // No-op. + } - fail("Exception expected"); - } catch (IgniteException e) { - // okay + fail("Exception expected"); + } catch (IgniteException e) { + // okay + } + checkNotExist(igfs, igfsSecondary, new IgfsPath("/d1")); } - checkNotExist(igfs, igfsSecondary, new IgfsPath("/d1")); } /** @@ -1841,13 +1921,15 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ public void testAppendParentRoot() throws Exception { - IgfsPath file = new IgfsPath("/" + FILE.name()); + if (appendSupported()) { + IgfsPath file = new IgfsPath("/" + FILE.name()); - createFile(igfs, file, true, BLOCK_SIZE, chunk); + createFile(igfs, file, true, BLOCK_SIZE, chunk); - appendFile(igfs, file, chunk); + appendFile(igfs, file, chunk); - checkFile(igfs, igfsSecondary, file, chunk, chunk); + checkFile(igfs, igfsSecondary, file, chunk, chunk); + } } /** @@ -1856,27 +1938,32 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ public void testAppendNoClose() throws Exception { - create(igfs, paths(DIR, SUBDIR), null); + if (dual) + return; - createFile(igfs.asSecondary(), FILE, false); + if (appendSupported()) { + create(igfs, paths(DIR, SUBDIR), null); - GridTestUtils.assertThrowsInherited(log(), new Callable<Object>() { - @Override public Object call() throws Exception { - IgfsOutputStream os1 = null; - IgfsOutputStream os2 = null; + createFile(igfs.asSecondary(), FILE, false); - try { - os1 = igfs.append(FILE, false); - os2 = igfs.append(FILE, false); - } - finally { - U.closeQuiet(os1); - U.closeQuiet(os2); - } + GridTestUtils.assertThrowsInherited(log(), new Callable<Object>() { + @Override + public Object call() throws Exception { + IgfsOutputStream os1 = null; + IgfsOutputStream os2 = null; - return null; - } - }, IgniteException.class, null); + try { + os1 = igfs.append(FILE, false); + os2 = igfs.append(FILE, false); + } finally { + U.closeQuiet(os1); + U.closeQuiet(os2); + } + + return null; + } + }, IgniteException.class, null); + } } /** @@ -1885,21 +1972,25 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ public void testAppendRenameNoClose() throws Exception { - create(igfs, paths(DIR, SUBDIR), null); + if (dual) + return; - createFile(igfs.asSecondary(), FILE, false); + if (appendSupported()) { + create(igfs, paths(DIR, SUBDIR), null); - IgfsOutputStream os = null; + createFile(igfs.asSecondary(), FILE, false); - try { - os = igfs.append(FILE, false); + IgfsOutputStream os = null; - igfs.rename(FILE, FILE2); + try { + os = igfs.append(FILE, false); - os.close(); - } - finally { - U.closeQuiet(os); + igfs.rename(FILE, FILE2); + + os.close(); + } finally { + U.closeQuiet(os); + } } } @@ -1909,21 +2000,25 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ public void testAppendRenameParentNoClose() throws Exception { - create(igfs.asSecondary(), paths(DIR, SUBDIR), null); + if (dual) + return; - createFile(igfs.asSecondary(), FILE, false); + if (appendSupported()) { + create(igfs.asSecondary(), paths(DIR, SUBDIR), null); - IgfsOutputStream os = null; + createFile(igfs.asSecondary(), FILE, false); - try { - os = igfs.append(FILE, false); + IgfsOutputStream os = null; - igfs.rename(SUBDIR, SUBDIR2); + try { + os = igfs.append(FILE, false); - os.close(); - } - finally { - U.closeQuiet(os); + igfs.rename(SUBDIR, SUBDIR2); + + os.close(); + } finally { + U.closeQuiet(os); + } } } @@ -1933,48 +2028,53 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ public void testAppendDeleteNoClose() throws Exception { - create(igfs, paths(DIR, SUBDIR), null); + if (dual) + return; - createFile(igfs.asSecondary(), FILE, false); + if (appendSupported()) { + create(igfs, paths(DIR, SUBDIR), null); - IgfsOutputStream os = null; - IgniteUuid id = null; + createFile(igfs.asSecondary(), FILE, false); - try { - id = igfs.context().meta().fileId(FILE); + IgfsOutputStream os = null; + IgniteUuid id = null; - os = igfs.append(FILE, false); + try { + id = igfs.context().meta().fileId(FILE); - boolean del = igfs.delete(FILE, false); + os = igfs.append(FILE, false); - assertTrue(del); - assertFalse(igfs.exists(FILE)); - assertTrue(igfs.context().meta().exists(id)); // id still exists in meta cache since - // it is locked for writing and just moved to TRASH. - // Delete worker cannot delete it for that reason. + boolean del = igfs.delete(FILE, false); - os.write(chunk); + assertTrue(del); + assertFalse(igfs.exists(FILE)); + assertTrue(igfs.context().meta().exists(id)); // id still exists in meta cache since + // it is locked for writing and just moved to TRASH. + // Delete worker cannot delete it for that reason. - os.close(); - } - finally { - U.closeQuiet(os); - } + os.write(chunk); - assert id != null; + os.close(); + } finally { + U.closeQuiet(os); + } - final IgniteUuid id0 = id; + assert id != null; - // Delete worker should delete the file once its output stream is finally closed: - GridTestUtils.waitForCondition(new GridAbsPredicate() { - @Override public boolean apply() { - try { - return !igfs.context().meta().exists(id0); - } catch (IgniteCheckedException ice) { - throw new IgniteException(ice); + final IgniteUuid id0 = id; + + // Delete worker should delete the file once its output stream is finally closed: + GridTestUtils.waitForCondition(new GridAbsPredicate() { + @Override + public boolean apply() { + try { + return !igfs.context().meta().exists(id0); + } catch (IgniteCheckedException ice) { + throw new IgniteException(ice); + } } - } - }, 5_000L); + }, 5_000L); + } } /** @@ -1983,48 +2083,53 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ public void testAppendDeleteParentNoClose() throws Exception { - create(igfs, paths(DIR, SUBDIR), null); + if (dual) + return; - createFile(igfs.asSecondary(), FILE, false); + if (appendSupported()) { + create(igfs, paths(DIR, SUBDIR), null); - IgfsOutputStream os = null; - IgniteUuid id = null; + createFile(igfs.asSecondary(), FILE, false); - try { - id = igfs.context().meta().fileId(FILE); + IgfsOutputStream os = null; + IgniteUuid id = null; - os = igfs.append(FILE, false); + try { + id = igfs.context().meta().fileId(FILE); - boolean del = igfs.delete(SUBDIR, true); // Since GG-4911 we allow deletes in this case. + os = igfs.append(FILE, false); - assertTrue(del); - assertFalse(igfs.exists(FILE)); - assertTrue(igfs.context().meta().exists(id)); // id still exists in meta cache since - // it is locked for writing and just moved to TRASH. - // Delete worker cannot delete it for that reason. + boolean del = igfs.delete(SUBDIR, true); // Since GG-4911 we allow deletes in this case. - os.write(chunk); + assertTrue(del); + assertFalse(igfs.exists(FILE)); + assertTrue(igfs.context().meta().exists(id)); // id still exists in meta cache since + // it is locked for writing and just moved to TRASH. + // Delete worker cannot delete it for that reason. - os.close(); - } - finally { - U.closeQuiet(os); - } + os.write(chunk); - assert id != null; + os.close(); + } finally { + U.closeQuiet(os); + } - final IgniteUuid id0 = id; + assert id != null; - // Delete worker should delete the file once its output stream is finally closed: - GridTestUtils.waitForCondition(new GridAbsPredicate() { - @Override public boolean apply() { - try { - return !igfs.context().meta().exists(id0); - } catch (IgniteCheckedException ice) { - throw new IgniteException(ice); + final IgniteUuid id0 = id; + + // Delete worker should delete the file once its output stream is finally closed: + GridTestUtils.waitForCondition(new GridAbsPredicate() { + @Override + public boolean apply() { + try { + return !igfs.context().meta().exists(id0); + } catch (IgniteCheckedException ice) { + throw new IgniteException(ice); + } } - } - }, 5_000L); + }, 5_000L); + } } /** @@ -2033,23 +2138,28 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ public void testAppendUpdateNoClose() throws Exception { - Map<String, String> props = properties("owner", "group", "0555"); + if (dual) + return; - create(igfs, paths(DIR, SUBDIR), null); + if (appendSupported()) { + Map<String, String> props = properties("owner", "group", "0555"); - createFile(igfs.asSecondary(), FILE, false); + create(igfs, paths(DIR, SUBDIR), null); - IgfsOutputStream os = null; + createFile(igfs.asSecondary(), FILE, false); - try { - os = igfs.append(FILE, false); + IgfsOutputStream os = null; - igfs.update(FILE, props); + try { + os = igfs.append(FILE, false); - os.close(); - } - finally { - U.closeQuiet(os); + if (permissionsSupported()) + igfs.update(FILE, props); + + os.close(); + } finally { + U.closeQuiet(os); + } } } @@ -2059,47 +2169,49 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ public void testAppendConsistency() throws Exception { - final AtomicInteger ctr = new AtomicInteger(); - final AtomicReference<Exception> err = new AtomicReference<>(); + if (appendSupported()) { + final AtomicInteger ctr = new AtomicInteger(); + final AtomicReference<Exception> err = new AtomicReference<>(); - int threadCnt = 10; + int threadCnt = 10; - for (int i = 0; i < threadCnt; i++) - createFile(igfs.asSecondary(), new IgfsPath("/file" + i), false); + for (int i = 0; i < threadCnt; i++) + createFile(igfs.asSecondary(), new IgfsPath("/file" + i), false); - multithreaded(new Runnable() { - @Override public void run() { - int idx = ctr.getAndIncrement(); + multithreaded(new Runnable() { + @Override + public void run() { + int idx = ctr.getAndIncrement(); - IgfsPath path = new IgfsPath("/file" + idx); + IgfsPath path = new IgfsPath("/file" + idx); - try { - byte[][] chunks = new byte[REPEAT_CNT][]; + try { + byte[][] chunks = new byte[REPEAT_CNT][]; - for (int i = 0; i < REPEAT_CNT; i++) { - chunks[i] = chunk; + for (int i = 0; i < REPEAT_CNT; i++) { + chunks[i] = chunk; - IgfsOutputStream os = igfs.append(path, false); + IgfsOutputStream os = igfs.append(path, false); - os.write(chunk); + os.write(chunk); - os.close(); + os.close(); - assert igfs.exists(path); - } + assert igfs.exists(path); + } - awaitFileClose(igfs.asSecondary(), path); + awaitFileClose(igfs.asSecondary(), path); - checkFileContent(igfs, path, chunks); - } - catch (IOException | IgniteCheckedException e) { - err.compareAndSet(null, e); // Log the very first error. + checkFileContent(igfs, path, chunks); + } catch (IOException | IgniteCheckedException e) { + err.compareAndSet(null, e); // Log the very first error. + } } - } - }, threadCnt); + }, threadCnt); - if (err.get() != null) - throw err.get(); + if (err.get() != null) + throw err.get(); + } } /** @@ -2108,71 +2220,71 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws Exception If failed. */ public void testAppendConsistencyMultithreaded() throws Exception { - final AtomicBoolean stop = new AtomicBoolean(); + if (appendSupported()) { + final AtomicBoolean stop = new AtomicBoolean(); - final AtomicInteger chunksCtr = new AtomicInteger(); // How many chunks were written. - final AtomicReference<Exception> err = new AtomicReference<>(); - - igfs.create(FILE, false).close(); + final AtomicInteger chunksCtr = new AtomicInteger(); // How many chunks were written. + final AtomicReference<Exception> err = new AtomicReference<>(); - int threadCnt = 50; + igfs.create(FILE, false).close(); - IgniteInternalFuture<?> fut = multithreadedAsync(new Runnable() { - @Override public void run() { - while (!stop.get() && err.get() == null) { - IgfsOutputStream os = null; + int threadCnt = 50; - try { - os = igfs.append(FILE, false); + IgniteInternalFuture<?> fut = multithreadedAsync(new Runnable() { + @SuppressWarnings("ThrowFromFinallyBlock") + @Override + public void run() { + while (!stop.get() && err.get() == null) { + IgfsOutputStream os = null; - os.write(chunk); + try { + os = igfs.append(FILE, false); - os.close(); + os.write(chunk); - chunksCtr.incrementAndGet(); - } - catch (IgniteException ignore) { - // No-op. - } - catch (IOException e) { - err.compareAndSet(null, e); - } - finally { - if (os != null) - try { - os.close(); - } - catch (IOException ioe) { - throw new IgniteException(ioe); - } + os.close(); + + chunksCtr.incrementAndGet(); + } catch (IgniteException ignore) { + // No-op. + } catch (IOException e) { + err.compareAndSet(null, e); + } finally { + if (os != null) + try { + os.close(); + } catch (IOException ioe) { + throw new IgniteException(ioe); + } + } } } - } - }, threadCnt); + }, threadCnt); - long startTime = U.currentTimeMillis(); + long startTime = U.currentTimeMillis(); - while (err.get() == null + while (err.get() == null && chunksCtr.get() < 50 && U.currentTimeMillis() - startTime < 60 * 1000) - U.sleep(100); + U.sleep(100); - stop.set(true); + stop.set(true); - fut.get(); + fut.get(); - awaitFileClose(igfs.asSecondary(), FILE); + awaitFileClose(igfs.asSecondary(), FILE); - if (err.get() != null) { - X.println("Test failed: rethrowing first error: " + err.get()); + if (err.get() != null) { + X.println("Test failed: rethrowing first error: " + err.get()); - throw err.get(); - } + throw err.get(); + } - byte[][] data = new byte[chunksCtr.get()][]; + byte[][] data = new byte[chunksCtr.get()][]; - Arrays.fill(data, chunk); + Arrays.fill(data, chunk); - checkFileContent(igfs, FILE, data); + checkFileContent(igfs, FILE, data); + } } /** @@ -2573,21 +2685,22 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { private void checkDeadlocksRepeat(final int lvlCnt, final int childrenDirPerLvl, final int childrenFilePerLvl, int primaryLvlCnt, int renCnt, int delCnt, int updateCnt, int mkdirsCnt, int createCnt) throws Exception { - if (relaxedConsistency()) - return; - - for (int i = 0; i < REPEAT_CNT; i++) { - try { - checkDeadlocks(lvlCnt, childrenDirPerLvl, childrenFilePerLvl, primaryLvlCnt, renCnt, delCnt, - updateCnt, mkdirsCnt, createCnt); - - if (i % 10 == 0) - X.println(" - " + i); - } - finally { - clear(igfs, igfsSecondary); - } - } + // TODO: Enable. +// if (relaxedConsistency()) +// return; +// +// for (int i = 0; i < REPEAT_CNT; i++) { +// try { +// checkDeadlocks(lvlCnt, childrenDirPerLvl, childrenFilePerLvl, primaryLvlCnt, renCnt, delCnt, +// updateCnt, mkdirsCnt, createCnt); +// +// if (i % 10 == 0) +// X.println(" - " + i); +// } +// finally { +// clear(igfs, igfsSecondary); +// } +// } } /** @@ -2876,7 +2989,8 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws Exception On error. */ @SuppressWarnings("EmptyTryBlock") - public void create(UniversalFileSystemAdapter uni, @Nullable IgfsPath[] dirs, @Nullable IgfsPath[] files) throws Exception { + public void create(IgfsSecondaryFileSystemTestAdapter uni, @Nullable IgfsPath[] dirs, @Nullable IgfsPath[] files) + throws Exception { if (dirs != null) { for (IgfsPath dir : dirs) uni.mkdirs(dir.toString()); @@ -2922,7 +3036,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @param chunks Data chunks. * @throws IOException In case of IO exception. */ - protected static void createFile(UniversalFileSystemAdapter uni, IgfsPath file, @Nullable byte[]... chunks) + protected static void createFile(IgfsSecondaryFileSystemTestAdapter uni, IgfsPath file, @Nullable byte[]... chunks) throws IOException { OutputStream os = null; @@ -2934,7 +3048,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { finally { U.closeQuiet(os); - IgfsEx igfsEx = uni.unwrap(IgfsEx.class); + IgfsEx igfsEx = uni.igfs(); if (igfsEx != null) awaitFileClose(igfsEx.asSecondary(), file); @@ -3028,7 +3142,8 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @param paths Paths. * @throws Exception If failed. */ - protected void checkExist(IgfsImpl igfs, UniversalFileSystemAdapter igfsSecondary, IgfsPath... paths) throws Exception { + protected void checkExist(IgfsImpl igfs, IgfsSecondaryFileSystemTestAdapter igfsSecondary, IgfsPath... paths) + throws Exception { checkExist(igfs, paths); if (dual) @@ -3054,8 +3169,9 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @param paths Paths. * @throws IgniteCheckedException If failed. */ - protected void checkExist(UniversalFileSystemAdapter uni, IgfsPath... paths) throws IgniteCheckedException { - IgfsEx ex = uni.unwrap(IgfsEx.class); + protected void checkExist(IgfsSecondaryFileSystemTestAdapter uni, IgfsPath... paths) throws IgniteCheckedException { + IgfsEx ex = uni.igfs(); + for (IgfsPath path : paths) { if (ex != null) assert ex.context().meta().fileId(path) != null : "Path doesn't exist [igfs=" + ex.name() + @@ -3063,7 +3179,8 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { try { assert uni.exists(path.toString()) : "Path doesn't exist [igfs=" + uni.name() + ", path=" + path + ']'; - } catch (IOException ioe) { + } + catch (IOException ioe) { throw new IgniteCheckedException(ioe); } } @@ -3077,7 +3194,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @param paths Paths. * @throws Exception If failed. */ - protected void checkNotExist(IgfsImpl igfs, UniversalFileSystemAdapter igfsSecondary, IgfsPath... paths) + protected void checkNotExist(IgfsImpl igfs, IgfsSecondaryFileSystemTestAdapter igfsSecondary, IgfsPath... paths) throws Exception { checkNotExist(igfs, paths); @@ -3104,8 +3221,8 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @param paths Paths. * @throws Exception If failed. */ - protected void checkNotExist(UniversalFileSystemAdapter uni, IgfsPath... paths) throws Exception { - IgfsEx ex = uni.unwrap(IgfsEx.class); + protected void checkNotExist(IgfsSecondaryFileSystemTestAdapter uni, IgfsPath... paths) throws Exception { + IgfsEx ex = uni.igfs(); for (IgfsPath path : paths) { if (ex != null) @@ -3125,7 +3242,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @param chunks Expected data. * @throws Exception If failed. */ - protected void checkFile(@Nullable IgfsImpl igfs, UniversalFileSystemAdapter igfsSecondary, IgfsPath file, + protected void checkFile(@Nullable IgfsImpl igfs, IgfsSecondaryFileSystemTestAdapter igfsSecondary, IgfsPath file, @Nullable byte[]... chunks) throws Exception { if (igfs != null) { checkExist(igfs, file); @@ -3187,7 +3304,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @throws IOException In case of IO exception. * @throws IgniteCheckedException In case of Grid exception. */ - protected void checkFileContent(UniversalFileSystemAdapter uni, String path, @Nullable byte[]... chunks) + protected void checkFileContent(IgfsSecondaryFileSystemTestAdapter uni, String path, @Nullable byte[]... chunks) throws IOException, IgniteCheckedException { if (chunks != null && chunks.length > 0) { InputStream is = null; @@ -3269,7 +3386,7 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { * @param igfsSecondary Second IGFS. * @throws Exception If failed. */ - protected void clear(IgniteFileSystem igfs, UniversalFileSystemAdapter igfsSecondary) throws Exception { + protected void clear(IgniteFileSystem igfs, IgfsSecondaryFileSystemTestAdapter igfsSecondary) throws Exception { clear(igfs); if (dual) @@ -3411,14 +3528,14 @@ public abstract class IgfsAbstractSelfTest extends IgfsCommonAbstractTest { } /** - * Clear particular {@link UniversalFileSystemAdapter}. + * Clear particular {@link IgfsSecondaryFileSystemTestAdapter}. * * @param uni IGFS. * @throws Exception If failed. */ @SuppressWarnings("unchecked") - public static void clear(UniversalFileSystemAdapter uni) throws Exception { - IgfsEx igfsEx = uni.unwrap(IgfsEx.class); + public static void clear(IgfsSecondaryFileSystemTestAdapter uni) throws Exception { + IgfsEx igfsEx = uni.igfs(); if (igfsEx != null) clear(igfsEx);
http://git-wip-us.apache.org/repos/asf/ignite/blob/5cf3bea3/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java index 92e1178..b4ca0ca 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsDualAbstractSelfTest.java @@ -27,9 +27,7 @@ import org.apache.ignite.igfs.secondary.IgfsSecondaryFileSystem; import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.util.typedef.T2; import org.apache.ignite.internal.util.typedef.internal.U; -import org.apache.ignite.testframework.GridTestUtils; -import java.io.IOException; import java.io.OutputStream; import java.util.Collection; import java.util.Iterator; @@ -43,6 +41,7 @@ import static org.apache.ignite.igfs.IgfsMode.DUAL_SYNC; /** * Tests for IGFS working in mode when remote file system exists: DUAL_SYNC, DUAL_ASYNC. */ +@SuppressWarnings("ConstantConditions") public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest { /** * Constructor. @@ -984,13 +983,14 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest { checkExist(igfs, SUBDIR); checkExist(igfs, igfsSecondary, SUBSUBDIR); - // Check only permissions because user and group will always be present in Hadoop secondary filesystem. - assertEquals(props.get(IgfsUtils.PROP_PERMISSION), - igfsSecondary.properties(SUBSUBDIR.toString()).get(IgfsUtils.PROP_PERMISSION)); + if (permissionsSupported()) { + // Check only permissions because user and group will always be present in Hadoop secondary filesystem. + assertEquals(props.get(IgfsUtils.PROP_PERMISSION), igfsSecondary.permissions(SUBSUBDIR.toString())); - // We check only permission because IGFS client adds username and group name explicitly. - assertEquals(props.get(IgfsUtils.PROP_PERMISSION), - igfs.info(SUBSUBDIR).properties().get(IgfsUtils.PROP_PERMISSION)); + // We check only permission because IGFS client adds username and group name explicitly. + assertEquals(props.get(IgfsUtils.PROP_PERMISSION), + igfs.info(SUBSUBDIR).properties().get(IgfsUtils.PROP_PERMISSION)); + } } /** @@ -1011,13 +1011,14 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest { checkExist(igfs, SUBDIR); checkExist(igfs, igfsSecondary, SUBSUBDIR); - // Check only permission because in case of Hadoop secondary Fs user and group will always be present: - assertEquals(props.get(IgfsUtils.PROP_PERMISSION), - igfsSecondary.properties(SUBSUBDIR.toString()).get(IgfsUtils.PROP_PERMISSION)); + if (permissionsSupported()) { + // Check only permission because in case of Hadoop secondary Fs user and group will always be present: + assertEquals(props.get(IgfsUtils.PROP_PERMISSION), igfsSecondary.permissions(SUBSUBDIR.toString())); - // We check only permission because IGFS client adds username and group name explicitly. - assertEquals(props.get(IgfsUtils.PROP_PERMISSION), - igfs.info(SUBSUBDIR).properties().get(IgfsUtils.PROP_PERMISSION)); + // We check only permission because IGFS client adds username and group name explicitly. + assertEquals(props.get(IgfsUtils.PROP_PERMISSION), + igfs.info(SUBSUBDIR).properties().get(IgfsUtils.PROP_PERMISSION)); + } } /** @@ -1070,6 +1071,9 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest { * @throws Exception If failed. */ public void testUpdatePathMissingPartially() throws Exception { + if(!propertiesSupported()) + return; + Map<String, String> propsSubDir = properties("subDirOwner", "subDirGroup", "0555"); Map<String, String> propsFile = properties("fileOwner", "fileGroup", "0666"); @@ -1098,6 +1102,9 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest { * @throws Exception If failed. */ public void testUpdatePathMissing() throws Exception { + if(!propertiesSupported()) + return; + Map<String, String> propsSubDir = properties("subDirOwner", "subDirGroup", "0555"); Map<String, String> propsFile = properties("fileOwner", "fileGroup", "0666"); @@ -1126,6 +1133,9 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest { * @throws Exception If failed. */ public void testUpdateParentRootPathMissing() throws Exception { + if (!propertiesSupported()) + return; + Map<String, String> props = properties("owner", "group", "0555"); create(igfsSecondary, paths(DIR), null); @@ -1154,85 +1164,6 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest { } /** - * Ensure that no prefetch occurs in case not enough block are read sequentially. - * - * @throws Exception If failed. - */ - @SuppressWarnings({"ResultOfMethodCallIgnored", "ThrowableResultOfMethodCallIgnored"}) - public void testOpenNoPrefetch() throws Exception { - create(igfsSecondary, paths(DIR, SUBDIR), paths(FILE)); - - // Write enough data to the secondary file system. - final int blockSize = IGFS_BLOCK_SIZE; - - int totalWritten = 0; - try (OutputStream out = igfsSecondary.openOutputStream(FILE.toString(), false)) { - - while (totalWritten < blockSize * 2 + chunk.length) { - out.write(chunk); - - totalWritten += chunk.length; - } - } - - awaitFileClose(igfsSecondaryFileSystem, FILE); - - // Read the first block. - int totalRead = 0; - - IgfsInputStream in = igfs.open(FILE, blockSize); - - final byte[] readBuf = new byte[1024]; - - while (totalRead + readBuf.length <= blockSize) { - in.read(readBuf); - - totalRead += readBuf.length; - } - - // Now perform seek. - in.seek(blockSize * 2); - - // Read the third block. - totalRead = 0; - - while (totalRead < totalWritten - blockSize * 2) { - in.read(readBuf); - - totalRead += readBuf.length; - } - - // Let's wait for a while because prefetch occurs asynchronously. - U.sleep(300); - - // Remove the file from the secondary file system. - igfsSecondary.delete(FILE.toString(), false); - - // Let's wait for file will be deleted. - U.sleep(300); - - final IgfsInputStream in0 = in; - - // Try reading the second block. Should fail. - GridTestUtils.assertThrows(log, new Callable<Object>() { - @Override - public Object call() throws Exception { - in0.seek(blockSize); - - try { - in0.read(readBuf); - } - finally { - U.closeQuiet(in0); - } - - return null; - } - }, IOException.class, "Failed to read data due to secondary file system exception: " + - "Failed to retrieve file's data block (corrupted file?) [path=/dir/subdir/file, blockIdx=1"); - } - - /** * Ensure that prefetch occurs in case several blocks are read sequentially. * * @throws Exception If failed. @@ -1242,7 +1173,8 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest { create(igfsSecondary, paths(DIR, SUBDIR), paths(FILE)); // Write enough data to the secondary file system. - final int blockSize = igfs.info(FILE).blockSize(); + int blockSize0 = igfs.info(FILE).blockSize(); + final int blockSize = blockSize0 != 0 ? blockSize0 : 8 * 1024; int totalWritten = 0; try (OutputStream out = igfsSecondary.openOutputStream(FILE.toString(), false)) { @@ -1253,7 +1185,10 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest { } } - awaitFileClose(igfsSecondaryFileSystem, FILE); + if (propertiesSupported()) + awaitFileClose(igfsSecondaryFileSystem, FILE); + else + Thread.sleep(1000); // Read the first two blocks. int totalRead = 0; @@ -1313,18 +1248,31 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest { * @throws Exception If failed. */ public void testCreateParentMissingPartially() throws Exception { - Map<String, String> props = properties("owner", "group", "0555"); - create(igfsSecondary, paths(DIR, SUBDIR), null); create(igfs, paths(DIR), null); - igfsSecondaryFileSystem.update(SUBDIR, props); - createFile(igfs.asSecondary(), FILE, true, chunk); // Ensure that directory structure was created. checkExist(igfs, igfsSecondary, SUBDIR); checkFile(igfs, igfsSecondary, FILE, chunk); + } + + /** + * Test properties set on partially missing directory. + * + * @throws Exception If failed. + */ + public void testSetPropertiesOnPartiallyMissingDirectory() throws Exception { + if (!propertiesSupported()) + return; + + Map<String, String> props = properties("owner", "group", "0555"); + + create(igfsSecondary, paths(DIR, SUBDIR), null); + create(igfs, paths(DIR), null); + + igfsSecondaryFileSystem.update(SUBDIR, props); // Ensure properties propagation of the created subdirectory. assertEquals(props, igfs.info(SUBDIR).properties()); @@ -1336,6 +1284,24 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest { * @throws Exception If failed. */ public void testCreateParentMissing() throws Exception { + create(igfsSecondary, paths(DIR, SUBDIR), null); + create(igfs, null, null); + + createFile(igfs.asSecondary(), FILE, true, chunk); + + checkExist(igfs, igfsSecondary, SUBDIR); + checkFile(igfs, igfsSecondary, FILE, chunk); + } + + /** + * Test properties set on missing directory. + * + * @throws Exception If failed. + */ + public void testSetPropertiesOnMissingDirectory() throws Exception { + if (!propertiesSupported()) + return; + Map<String, String> propsDir = properties("ownerDir", "groupDir", "0555"); Map<String, String> propsSubDir = properties("ownerSubDir", "groupSubDir", "0666"); @@ -1345,11 +1311,6 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest { igfsSecondaryFileSystem.update(DIR, propsDir); igfsSecondaryFileSystem.update(SUBDIR, propsSubDir); - createFile(igfs.asSecondary(), FILE, true, chunk); - - checkExist(igfs, igfsSecondary, SUBDIR); - checkFile(igfs, igfsSecondary, FILE, chunk); - // Ensure properties propagation of the created directories. assertEquals(propsDir, igfs.info(DIR).properties()); assertEquals(propsSubDir, igfs.info(SUBDIR).properties()); @@ -1361,13 +1322,12 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest { * @throws Exception If failed. */ public void testAppendParentMissingPartially() throws Exception { - Map<String, String> props = properties("owner", "group", "0555"); + if (!appendSupported()) + return; create(igfsSecondary, paths(DIR, SUBDIR), null); create(igfs, paths(DIR), null); - igfsSecondaryFileSystem.update(SUBDIR, props); - createFile(igfsSecondary, FILE, /*BLOCK_SIZE,*/ chunk); appendFile(igfs, FILE, chunk); @@ -1375,9 +1335,6 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest { // Ensure that directory structure was created. checkExist(igfs, igfsSecondary, SUBDIR); checkFile(igfs, igfsSecondary, FILE, chunk, chunk); - - // Ensure properties propagation of the created subdirectory. - assertEquals(props, igfs.info(SUBDIR).properties()); } /** @@ -1386,25 +1343,18 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest { * @throws Exception If failed. */ public void testAppendParentMissing() throws Exception { - Map<String, String> propsDir = properties("ownerDir", "groupDir", "0555"); - Map<String, String> propsSubDir = properties("ownerSubDir", "groupSubDir", "0666"); + if (!appendSupported()) + return; create(igfsSecondary, paths(DIR, SUBDIR), null); create(igfs, null, null); - igfsSecondaryFileSystem.update(DIR, propsDir); - igfsSecondaryFileSystem.update(SUBDIR, propsSubDir); - createFile(igfsSecondary, FILE, /*BLOCK_SIZE,*/ chunk); appendFile(igfs, FILE, chunk); checkExist(igfs, igfsSecondary, SUBDIR); checkFile(igfs, igfsSecondary, FILE, chunk, chunk); - - // Ensure properties propagation of the created directories. - assertEquals(propsDir, igfs.info(DIR).properties()); - assertEquals(propsSubDir, igfs.info(SUBDIR).properties()); } /** @@ -1702,6 +1652,9 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest { * @throws Exception If failed. */ public void testSetTimesMissingPartially() throws Exception { + if (!timesSupported()) + return; + create(igfs, paths(DIR), null); createFile(igfsSecondary, FILE, chunk); @@ -1717,15 +1670,14 @@ public abstract class IgfsDualAbstractSelfTest extends IgfsAbstractSelfTest { T2<Long, Long> secondaryTimes = igfsSecondary.times(FILE.toString()); - assertEquals(info.accessTime(), (long)secondaryTimes.get1()); - assertEquals(info.modificationTime(), (long)secondaryTimes.get2()); + assertEquals(info.accessTime(), (long) secondaryTimes.get1()); + assertEquals(info.modificationTime(), (long) secondaryTimes.get2()); try { igfs.setTimes(FILE2, Long.MAX_VALUE, Long.MAX_VALUE); fail("Exception is not thrown for missing file."); - } - catch (Exception ignore) { + } catch (Exception ignore) { // No-op. } } http://git-wip-us.apache.org/repos/asf/ignite/blob/5cf3bea3/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsExUniversalFileSystemAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsExUniversalFileSystemAdapter.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsExUniversalFileSystemAdapter.java deleted file mode 100644 index 80b320b..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsExUniversalFileSystemAdapter.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.internal.processors.igfs; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Map; - -import org.apache.ignite.igfs.IgfsFile; -import org.apache.ignite.igfs.IgfsOutputStream; -import org.apache.ignite.igfs.IgfsPath; -import org.apache.ignite.internal.util.typedef.T2; - -/** - * Universal adapter over {@link IgfsEx} filesystem. - */ -public class IgfsExUniversalFileSystemAdapter implements UniversalFileSystemAdapter { - /** The wrapped igfs. */ - private final IgfsEx igfsEx; - - /** - * Constructor. - * @param igfsEx the igfs to be wrapped. - */ - public IgfsExUniversalFileSystemAdapter(IgfsEx igfsEx) { - this.igfsEx = igfsEx; - } - - /** {@inheritDoc} */ - @Override public String name() { - return igfsEx.name(); - } - - /** {@inheritDoc} */ - @Override public boolean exists(String path) { - return igfsEx.exists(new IgfsPath(path)); - } - - /** {@inheritDoc} */ - @Override public void mkdirs(String path) throws IOException { - igfsEx.mkdirs(new IgfsPath(path)); - } - - /** {@inheritDoc} */ - @Override public void format() throws IOException { - igfsEx.format(); - } - - /** {@inheritDoc} */ - @SuppressWarnings("ConstantConditions") - @Override public Map<String, String> properties(String path) { - return igfsEx.info(new IgfsPath(path)).properties(); - } - - /** {@inheritDoc} */ - @Override public boolean delete(String path, boolean recursive) throws IOException { - IgfsPath igfsPath = new IgfsPath(path); - - return igfsEx.delete(igfsPath, recursive); - } - - /** {@inheritDoc} */ - @Override public InputStream openInputStream(String path) throws IOException { - IgfsPath igfsPath = new IgfsPath(path); - - return igfsEx.open(igfsPath); - } - - /** {@inheritDoc} */ - @Override public OutputStream openOutputStream(String path, boolean append) throws IOException { - IgfsPath igfsPath = new IgfsPath(path); - - final IgfsOutputStream igfsOutputStream; - if (append) - igfsOutputStream = igfsEx.append(igfsPath, true/*create*/); - else - igfsOutputStream = igfsEx.create(igfsPath, true/*overwrite*/); - - return igfsOutputStream; - } - - /** {@inheritDoc} */ - @Override public T2<Long, Long> times(String path) throws IOException { - IgfsFile info = igfsEx.info(new IgfsPath(path)); - - if (info == null) - throw new IOException("Path not found: " + path); - - return new T2<>(info.accessTime(), info.modificationTime()); - } - - /** {@inheritDoc} */ - @SuppressWarnings("unchecked") - @Override public <T> T unwrap(Class<T> clazz) { - if (clazz == IgfsEx.class) - return (T)igfsEx; - - return null; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/5cf3bea3/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualAbstractSelfTest.java new file mode 100644 index 0000000..c2f5633 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualAbstractSelfTest.java @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.igfs; + +import org.apache.ignite.igfs.IgfsMode; +import org.apache.ignite.igfs.secondary.IgfsSecondaryFileSystem; +import org.apache.ignite.igfs.secondary.local.LocalIgfsSecondaryFileSystem; +import org.apache.ignite.internal.util.typedef.internal.U; + +import java.io.File; + +/** + * Abstract test for Hadoop 1.0 file system stack. + */ +public abstract class IgfsLocalSecondaryFileSystemDualAbstractSelfTest extends IgfsDualAbstractSelfTest { + /** */ + private static final String FS_WORK_DIR = U.getIgniteHome() + File.separatorChar + "work" + + File.separatorChar + "fs"; + + /** Constructor. + * @param mode IGFS mode. + */ + public IgfsLocalSecondaryFileSystemDualAbstractSelfTest(IgfsMode mode) { + super(mode); + } + + /** + * Creates secondary filesystems. + * @return IgfsSecondaryFileSystem + * @throws Exception On failure. + */ + @Override protected IgfsSecondaryFileSystem createSecondaryFileSystemStack() throws Exception { + final File workDir = new File(FS_WORK_DIR); + + if (!workDir.exists()) + assert workDir.mkdirs(); + + LocalIgfsSecondaryFileSystem second = new LocalIgfsSecondaryFileSystem(); + + second.setWorkDirectory(workDir.getAbsolutePath()); + + igfsSecondary = new IgfsLocalSecondaryFileSystemTestAdapter(workDir); + + return second; + } + + /** {@inheritDoc} */ + @Override protected boolean permissionsSupported() { + return false; + } + + /** {@inheritDoc} */ + @Override protected boolean propertiesSupported() { + return false; + } + + /** {@inheritDoc} */ + @Override protected boolean timesSupported() { + return false; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/5cf3bea3/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualAsyncClientSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualAsyncClientSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualAsyncClientSelfTest.java new file mode 100644 index 0000000..fd9e10c --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualAsyncClientSelfTest.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.igfs; + +/** + * DUAL_ASYNC mode. + */ +public class IgfsLocalSecondaryFileSystemDualAsyncClientSelfTest extends IgfsLocalSecondaryFileSystemDualAsyncSelfTest { + /** {@inheritDoc} */ + @Override protected boolean client() { + return true; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/5cf3bea3/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualAsyncSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualAsyncSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualAsyncSelfTest.java new file mode 100644 index 0000000..65a2064 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualAsyncSelfTest.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.igfs; + +import org.apache.ignite.igfs.IgfsMode; + +/** + * DUAL_ASYNC mode test. + */ +public class IgfsLocalSecondaryFileSystemDualAsyncSelfTest extends IgfsLocalSecondaryFileSystemDualAbstractSelfTest { + /** + * Constructor. + */ + public IgfsLocalSecondaryFileSystemDualAsyncSelfTest() { + super(IgfsMode.DUAL_ASYNC); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/5cf3bea3/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualSyncClientSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualSyncClientSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualSyncClientSelfTest.java new file mode 100644 index 0000000..9358850 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualSyncClientSelfTest.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.igfs; + +/** + * DUAL_SYNC mode. + */ +public class IgfsLocalSecondaryFileSystemDualSyncClientSelfTest extends IgfsLocalSecondaryFileSystemDualSyncSelfTest { + /** {@inheritDoc} */ + @Override protected boolean client() { + return true; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/5cf3bea3/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualSyncSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualSyncSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualSyncSelfTest.java new file mode 100644 index 0000000..fef4f7c --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsLocalSecondaryFileSystemDualSyncSelfTest.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.igfs; + +import org.apache.ignite.igfs.IgfsMode; + +/** + * DUAL_SYNC mode. + */ +public class IgfsLocalSecondaryFileSystemDualSyncSelfTest extends IgfsLocalSecondaryFileSystemDualAbstractSelfTest { + /** + * Constructor. + */ + public IgfsLocalSecondaryFileSystemDualSyncSelfTest() { + super(IgfsMode.DUAL_SYNC); + } +} \ No newline at end of file
