@Override public Object call() throws Exception { for (int cur = cnt.incrementAndGet(); cur < max; cur = cnt.incrementAndGet()) igfs.mkdirs(path(cur)); return null; } }, threads, "grid-test-make-directories");
/** * Perform startup. * * @param dfltIgniteInstanceName Default Ignite instance name. * @param dfltIgfsName Default IGFS name. * @throws Exception If failed. */ private void startUp(boolean dfltIgniteInstanceName, boolean dfltIgfsName) throws Exception { Ignite ignite = G.start(gridConfiguration(dfltIgniteInstanceName)); IgniteFileSystem igfs = ignite.fileSystem(dfltIgfsName ? "" : IGFS_NAME); igfs.mkdirs(PATH); }
/** * @throws Exception If failed. */ private void beforeJob() throws Exception { IgniteFileSystem igfs = grid(0).fileSystem(HadoopAbstractSelfTest.igfsName); igfs.clear(); igfs.mkdirs(new IgfsPath(PATH_INPUT)); try (BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(igfs.create( new IgfsPath(PATH_INPUT + "/test.file"), true)))) { bw.write("word"); } }
/** {@inheritDoc} */ @Override public void preHandleDir(String strPath) throws Exception { IgfsPath path = new IgfsPath(strPath); if (fs.exists(path)) throw new IgniteException("path " + path.toString() + " already exists"); try { fs.mkdirs(path); } catch (IgniteException ex) { throw ex; } } }
/** * @throws Exception If failed. */ @Test public void testCacheStart() throws Exception { Ignite g0 = G.start(config(true, 0)); String dataCacheName = ((IgniteEx)g0).igfsx("igfs").configuration().getDataCacheConfiguration().getName(); String metaCacheName = ((IgniteEx)g0).igfsx("igfs").configuration().getMetaCacheConfiguration().getName(); checkIgfsCaches(g0, dataCacheName, metaCacheName); Ignite g1 = G.start(config(false, 1)); checkIgfsCaches(g1, dataCacheName, metaCacheName); IgniteFileSystem igfs = g0.fileSystem("igfs"); igfs.mkdirs(new IgfsPath("/test")); try (BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(igfs.create( new IgfsPath("/test/test.file"), true)))) { for (int i = 0; i < 1000; i++) bw.write("test-" + i); } }
igfs.mkdirs(path("/A/B1/C1"));
IgniteFileSystem igfs = grid(0).fileSystem(HadoopAbstractSelfTest.igfsName); igfs.mkdirs(new IgfsPath(PATH_INPUT));
/** * Test format operation on non-empty file system. * * @throws Exception If failed. */ @Test public void testFormatNonEmpty() throws Exception { String dirPath = "/A/B/C"; igfs.mkdirs(path(dirPath)); String filePath = "/someFile"; create(filePath, false, "Some text."); igfs.clear(); assert !igfs.exists(path(dirPath)); assert !igfs.exists(path(filePath)); GridTestUtils.waitForCondition(new GridAbsPredicate() { @Override public boolean apply() { int metaSize = 0; for (Object metaId : grid(0).cachex(igfs.configuration().getMetaCacheConfiguration().getName()) .keySet()) { if (!IgfsUtils.isRootOrTrashId((IgniteUuid)metaId)) metaSize++; } return metaSize == 0; } }, 5000); }
public void testBasicOps() throws Exception { igfs.mkdirs(path("/A/B1/C1")); igfs.mkdirs(path("/A/B1/C2")); igfs.mkdirs(path("/A/B1/C3")); igfs.mkdirs(path("/A/B2/C1")); igfs.mkdirs(path("/A/B2/C2")); igfs.mkdirs(path("/A1/B1/C1")); igfs.mkdirs(path("/A1/B1/C2")); igfs.mkdirs(path("/A1/B1/C3")); igfs.mkdirs(path("/A2/B2/C1")); igfs.mkdirs(path("/A2/B2/C2"));
IgniteFileSystem igfs = grid(0).fileSystem(HadoopAbstractSelfTest.igfsName); igfs.mkdirs(new IgfsPath(PATH_INPUT));
/** * Test properties management in meta-cache. * * @throws Exception If failed. */ @Test public void testUpdateProperties() throws Exception { IgfsPath p = path("/tmp/my"); igfs.mkdirs(p); Map<String, String> oldProps = igfs.info(p).properties(); igfs.update(p, F.asMap("a", "1")); igfs.update(p, F.asMap("b", "2")); assertEquals("1", igfs.info(p).property("a")); assertEquals("2", igfs.info(p).property("b")); igfs.update(p, F.asMap("b", "3")); Map<String, String> expProps = new HashMap<>(oldProps); expProps.put("a", "1"); expProps.put("b", "3"); assertEquals("3", igfs.info(p).property("b")); assertEquals(expProps, igfs.info(p).properties()); assertEquals("5", igfs.info(p).property("c", "5")); assertUpdatePropertiesFails(null, null, NullPointerException.class, "Ouch! Argument cannot be null"); assertUpdatePropertiesFails(p, null, NullPointerException.class, "Ouch! Argument cannot be null"); assertUpdatePropertiesFails(null, F.asMap("x", "9"), NullPointerException.class, "Ouch! Argument cannot be null"); assertUpdatePropertiesFails(p, Collections.<String, String>emptyMap(), IllegalArgumentException.class, "Ouch! Argument is invalid"); }
public void testRename() throws Exception { igfs.mkdirs(path("/A/B1/C1"));