}
public void testLocalDirs() throws Exception {
Configuration conf = new Configuration();
final String permStr = "755";
FsPermission expected = new FsPermission(permStr);
conf.set(DataNode.DATA_DIR_PERMISSION_KEY, permStr);
MiniDFSCluster cluster = null;
try {
// Start the cluster
cluster =
new MiniDFSCluster(0, conf, 1, true,
true, false, null, null, null, null);
cluster.waitActive();
// Check permissions on directories in 'dfs.data.dir'
FileSystem localFS = FileSystem.getLocal(conf);
String[] dataDirs = conf.getStrings(DataNode.DATA_DIR_KEY);
for (String dir : dataDirs) {
Path dataDir = new Path(dir);
FsPermission actual = localFS.getFileStatus(dataDir).getPermission();
assertEquals("Permission for dir: " + dataDir + ", is " + actual +
", while expected is " + expected,
expected, actual);
}
} finally {