public virtual void TestWebImageViewerForAcl() { WebImageViewer viewer = new WebImageViewer(NetUtils.CreateSocketAddr("localhost:0" )); try { viewer.InitServer(originalFsimage.GetAbsolutePath()); int port = viewer.GetPort(); // create a WebHdfsFileSystem instance URI uri = new URI("webhdfs://localhost:" + port.ToString()); Configuration conf = new Configuration(); WebHdfsFileSystem webhdfs = (WebHdfsFileSystem)FileSystem.Get(uri, conf); // GETACLSTATUS operation to a directory without ACL AclStatus acl = webhdfs.GetAclStatus(new Path("/dirWithNoAcl")); NUnit.Framework.Assert.AreEqual(writtenAcls["/dirWithNoAcl"], acl); // GETACLSTATUS operation to a directory with a default ACL acl = webhdfs.GetAclStatus(new Path("/dirWithDefaultAcl")); NUnit.Framework.Assert.AreEqual(writtenAcls["/dirWithDefaultAcl"], acl); // GETACLSTATUS operation to a file without ACL acl = webhdfs.GetAclStatus(new Path("/noAcl")); NUnit.Framework.Assert.AreEqual(writtenAcls["/noAcl"], acl); // GETACLSTATUS operation to a file with a ACL acl = webhdfs.GetAclStatus(new Path("/withAcl")); NUnit.Framework.Assert.AreEqual(writtenAcls["/withAcl"], acl); // GETACLSTATUS operation to a file with several ACL entries acl = webhdfs.GetAclStatus(new Path("/withSeveralAcls")); NUnit.Framework.Assert.AreEqual(writtenAcls["/withSeveralAcls"], acl); // GETACLSTATUS operation to a invalid path Uri url = new Uri("http://localhost:" + port + "/webhdfs/v1/invalid/?op=GETACLSTATUS" ); HttpURLConnection connection = (HttpURLConnection)url.OpenConnection(); connection.SetRequestMethod("GET"); connection.Connect(); NUnit.Framework.Assert.AreEqual(HttpURLConnection.HttpNotFound, connection.GetResponseCode ()); } finally { // shutdown the viewer viewer.Close(); } }