/** * Validate passed map is empty. * * @param map Map to validate it is empty. */ private void assertEmpty(Map map) { assertEquals(Collections.emptyMap(), map); }
/** * Test expected failures for 'move file' operation. */ private void expectsRenameFail(final String src, final String dst) { Throwable err = assertThrowsInherited(log, new Callable() { @Override public Object call() throws Exception { mgr.move(new IgfsPath(src), new IgfsPath(dst)); return null; } }, IgfsException.class, null); assertTrue("Unexpected cause: " + err, err instanceof IgfsException); } }
assertEmpty(mgr.directoryListing(ROOT_ID)); assertEquals(rootInfo, mgr.info(ROOT_ID)); assertEquals(F.asMap(ROOT_ID, rootInfo), mgr.infos(Arrays.asList(ROOT_ID))); IgfsEntryInfo a = mkdirsAndGetInfo("/a"); IgfsEntryInfo b = mkdirsAndGetInfo("/a/b"); IgfsEntryInfo k = mkdirsAndGetInfo("/a/b/k"); IgfsEntryInfo z = mkdirsAndGetInfo("/a/k"); IgfsEntryInfo f1 = createFileAndGetInfo("/f1"); IgfsEntryInfo f2 = createFileAndGetInfo("/a/f2"); IgfsEntryInfo f3 = createFileAndGetInfo("/a/b/f3"); assertEquals(F.asMap("a", new IgfsListingEntry(a), "f1", new IgfsListingEntry(f1)), mgr.directoryListing(ROOT_ID)); assertEquals(F.asMap("b", new IgfsListingEntry(b), "f2", new IgfsListingEntry(f2), "k", new IgfsListingEntry(z)), mgr.directoryListing(a.id())); assertEquals(F.asMap("f3", new IgfsListingEntry(f3), "k", new IgfsListingEntry(k)), mgr.directoryListing(b.id())); assertEmpty(mgr.directoryListing(info.id())); assertEquals(info, mgr.info(info.id())); assertEquals(F.asMap(info.id(), info), mgr.infos(Arrays.asList(info.id()))); assertEquals(ROOT_ID, mgr.fileId(IgfsPath.ROOT)); assertEquals(a.id(), mgr.fileId(new IgfsPath("/a")));
assertEmpty(mgr.directoryListing(ROOT_ID)); assertTrue(mgr.mkdirs(new IgfsPath("/dir"), IgfsImpl.DFLT_DIR_META)); assertNotNull(mgr.create(new IgfsPath("/file"), null, false, 400, null, false, null, null)); assertNotNull(dirEntry); assertTrue(dirEntry.isDirectory()); IgfsEntryInfo dir = mgr.info(dirEntry.fileId()); assertNotNull(fileEntry); assertTrue(!fileEntry.isDirectory()); IgfsEntryInfo file = mgr.info(fileEntry.fileId()); assertEquals(2, mgr.directoryListing(ROOT_ID).size()); expectsUpdatePropertiesFail(fileId, props, AssertionError.class, "Expects not-empty file's properties"); assertNull("Unexpected stored properties: " + info, info.properties().get(key1)); assertNull("Unexpected stored properties: " + info, info.properties().get(key2)); assertEquals("Unexpected stored properties: " + info, "1", info.properties().get(key1)); assertEquals("Unexpected stored properties: " + info, "1", info.properties().get(key1)); assertEquals("Unexpected stored properties: " + info, "2", info.properties().get(key2)); assertEquals("Unexpected stored properties: " + info, "2", info.properties().get(key2)); assertNull("Unexpected stored properties: " + info, info.properties().get(key1)); assertNull("Unexpected stored properties: " + info, info.properties().get(key2));
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); FileSystemConfiguration igfsCfg = new FileSystemConfiguration(); igfsCfg.setMetaCacheConfiguration(cacheConfiguration(META_CACHE_NAME)); igfsCfg.setDataCacheConfiguration(cacheConfiguration(DATA_CACHE_NAME)); igfsCfg.setName("igfs"); cfg.setFileSystemConfiguration(igfsCfg); return cfg; }
/** {@inheritDoc} */ protected CacheConfiguration cacheConfiguration(@NotNull String cacheName) { CacheConfiguration cacheCfg = defaultCacheConfiguration(); cacheCfg.setName(cacheName); if (META_CACHE_NAME.equals(cacheName)) cacheCfg.setCacheMode(REPLICATED); else { cacheCfg.setCacheMode(PARTITIONED); cacheCfg.setNearConfiguration(null); cacheCfg.setBackups(0); cacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128)); } cacheCfg.setWriteSynchronizationMode(FULL_SYNC); cacheCfg.setAtomicityMode(TRANSACTIONAL); return cacheCfg; }