/** * Check root property update. * * @throws Exception If failed. */ private void checkRootPropertyUpdate(String prop, String setVal, String expGetVal) throws Exception { igfs.update(IgfsPath.ROOT, Collections.singletonMap(prop, setVal)); igfs.clear(); IgfsFile file = igfs.info(IgfsPath.ROOT); assert file != null; Map<String,String> props = file.properties(); assertEquals(expGetVal, props.get(prop)); }
/** * Test mkdirs in case parent is the root directory. * * @throws Exception If failed. */ @SuppressWarnings("ConstantConditions") @Test public void testMkdirsParentRoot() throws Exception { Map<String, String> props = null; if (permissionsSupported()) props = properties(null, null, "0555"); // mkdirs command doesn't propagate user info. igfs.mkdirs(DIR, props); checkExist(igfs, igfsSecondary, DIR); 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)); } }
/** * Test info routine when the path exists both locally and remotely. * * @throws Exception If failed. */ @Test public void testInfo() throws Exception { create(igfs, paths(DIR), null); IgfsFile info = igfs.info(DIR); assert info != null; assertEquals(DIR, info.path()); }
/** * Test update when parent is the root. * * @throws Exception If failed. */ @SuppressWarnings("ConstantConditions") @Test public void testUpdateParentRoot() throws Exception { if(!propertiesSupported()) return; Map<String, String> props = properties("owner", "group", "0555"); create(igfs, paths(DIR), null); igfs.update(DIR, props); if (dual) assertEquals(props, igfsSecondary.properties(DIR.toString())); assertEquals(props, igfs.info(DIR).properties()); }
/** * Test update in case both local and remote file systems have the same folder structure. * * @throws Exception If failed. */ @SuppressWarnings("ConstantConditions") @Test public void testUpdate() throws Exception { if(!propertiesSupported()) return; Map<String, String> props = properties("owner", "group", "0555"); create(igfs, paths(DIR, SUBDIR), paths(FILE)); igfs.update(FILE, props); if (dual) assertEquals(props, igfsSecondary.properties(FILE.toString())); assertEquals(props, igfs.info(FILE).properties()); }
assertEquals(info.accessTime(), newInfo.accessTime()); assertEquals(info.modificationTime(), newInfo.modificationTime()); assertEquals(secondaryTimes.get1(), newSecondaryTimes.get1()); assertEquals(secondaryTimes.get2(), newSecondaryTimes.get2()); assertEquals(info.accessTime() + 1000, newInfo.accessTime()); assertEquals(info.modificationTime(), newInfo.modificationTime()); assertEquals(newInfo.accessTime(), (long) newSecondaryTimes.get2()); assertEquals(secondaryTimes.get1(), newSecondaryTimes.get1()); assertEquals(info.accessTime() + 1000, newInfo.accessTime()); assertEquals(info.modificationTime() + 1000, newInfo.modificationTime()); assertEquals(newInfo.accessTime(), (long) newSecondaryTimes.get2()); assertEquals(info.accessTime() + 2000, newInfo.accessTime()); assertEquals(info.modificationTime() + 2000, newInfo.modificationTime()); assertEquals(newInfo.modificationTime(), (long) newSecondaryTimes.get1()); assertEquals(newInfo.accessTime(), (long) newSecondaryTimes.get2());
if (dual) assertEquals(props.get(IgfsUtils.PROP_PERMISSION), igfsSecondary.permissions(SUBSUBDIR.toString())); assertEquals(props.get(IgfsUtils.PROP_PERMISSION), igfs.info(SUBSUBDIR).properties().get(IgfsUtils.PROP_PERMISSION));