private void stageDirTest(String stageDirConfigStr, String stageDirName, boolean isLocal) throws IOException {
String scratchDirStr = System.getProperty("test.tmp.dir") + File.separator +
stageDirName;
System.setProperty(stageDirConfigStr, scratchDirStr);
ThriftCLIService service = new EmbeddedThriftBinaryCLIService();
ThriftCLIServiceClient client = new ThriftCLIServiceClient(service);
final Path scratchDir = new Path(scratchDirStr);
Configuration conf = new Configuration();
FileSystem fs = scratchDir.getFileSystem(conf);
if (isLocal) {
fs = FileSystem.getLocal(conf);
}
assertTrue(fs.exists(scratchDir));
FileStatus[] fStatus = fs.globStatus(scratchDir);
boolean foo = fStatus[0].equals(new FsPermission((short)0777));
assertEquals(new FsPermission((short)0777), fStatus[0].getPermission());
service.stop();
fs.delete(scratchDir, true);
System.clearProperty(stageDirConfigStr);
}