public virtual void TestAccess() { Path p1 = new Path("/pathX"); try { UserGroupInformation ugi = UserGroupInformation.CreateUserForTesting("alpha", new string[] { "beta" }); WebHdfsFileSystem fs = WebHdfsTestUtil.GetWebHdfsFileSystemAs(ugi, conf, WebHdfsFileSystem .Scheme); fs.Mkdirs(p1); fs.SetPermission(p1, new FsPermission((short)0x124)); fs.Access(p1, FsAction.Read); try { fs.Access(p1, FsAction.Write); Fail("The access call should have failed."); } catch (AccessControlException) { } // expected Path badPath = new Path("/bad"); try { fs.Access(badPath, FsAction.Read); Fail("The access call should have failed"); } catch (FileNotFoundException) { } } finally { // expected fs.Delete(p1, true); } }