Search in sources :

Example 1 with FsActionParam

use of org.apache.hadoop.hdfs.web.resources.FsActionParam in project hadoop by apache.

the class TestWebHdfsUrl method testCheckAccessUrl.

@Test(timeout = 60000)
public void testCheckAccessUrl() throws IOException {
    Configuration conf = new Configuration();
    UserGroupInformation ugi = UserGroupInformation.createRemoteUser("test-user");
    UserGroupInformation.setLoginUser(ugi);
    WebHdfsFileSystem webhdfs = getWebHdfsFileSystem(ugi, conf);
    Path fsPath = new Path("/p1");
    URL checkAccessUrl = webhdfs.toUrl(GetOpParam.Op.CHECKACCESS, fsPath, new FsActionParam(FsAction.READ_WRITE));
    checkQueryParams(new String[] { GetOpParam.Op.CHECKACCESS.toQueryString(), new UserParam(ugi.getShortUserName()).toString(), FsActionParam.NAME + "=" + FsAction.READ_WRITE.SYMBOL }, checkAccessUrl);
}
Also used : Path(org.apache.hadoop.fs.Path) UserParam(org.apache.hadoop.hdfs.web.resources.UserParam) Configuration(org.apache.hadoop.conf.Configuration) URL(java.net.URL) FsActionParam(org.apache.hadoop.hdfs.web.resources.FsActionParam) UserGroupInformation(org.apache.hadoop.security.UserGroupInformation) Test(org.junit.Test)

Aggregations

URL (java.net.URL)1 Configuration (org.apache.hadoop.conf.Configuration)1 Path (org.apache.hadoop.fs.Path)1 FsActionParam (org.apache.hadoop.hdfs.web.resources.FsActionParam)1 UserParam (org.apache.hadoop.hdfs.web.resources.UserParam)1 UserGroupInformation (org.apache.hadoop.security.UserGroupInformation)1 Test (org.junit.Test)1