Java 类org.apache.hadoop.hdfs.web.WebHdfsTestUtil 实例源码

项目:hadoop    文件:TestAuditLogs.java   
/** test that access via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfs() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0644));
  fs.setOwner(file, "root", null);

  setupAuditLogs();

  WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf, WebHdfsFileSystem.SCHEME);
  InputStream istream = webfs.open(file);
  int val = istream.read();
  istream.close();

  verifyAuditLogsRepeat(true, 3);
  assertTrue("failed to read from file", val >= 0);
}
项目:hadoop    文件:TestAuditLogs.java   
/** test that stat via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfsStat() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0644));
  fs.setOwner(file, "root", null);

  setupAuditLogs();

  WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf, WebHdfsFileSystem.SCHEME);
  FileStatus st = webfs.getFileStatus(file);

  verifyAuditLogs(true);
  assertTrue("failed to stat file", st != null && st.isFile());
}
项目:hadoop    文件:TestAuditLogs.java   
/** test that denied access via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfsDenied() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0600));
  fs.setOwner(file, "root", null);

  setupAuditLogs();
  try {
    WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf, WebHdfsFileSystem.SCHEME);
    InputStream istream = webfs.open(file);
    int val = istream.read();
    fail("open+read must not succeed, got " + val);
  } catch(AccessControlException E) {
    System.out.println("got access denied, as expected.");
  }
  verifyAuditLogsRepeat(false, 2);
}
项目:aliyun-oss-hadoop-fs    文件:TestWriteReadStripedFile.java   
@Test
public void testWriteReadUsingWebHdfs() throws Exception {
  int fileLength = blockSize * dataBlocks + cellSize + 123;

  final byte[] expected = StripedFileTestUtil.generateBytes(fileLength);
  FileSystem fs = WebHdfsTestUtil.getWebHdfsFileSystem(conf,
      WebHdfsConstants.WEBHDFS_SCHEME);
  Path srcPath = new Path("/testWriteReadUsingWebHdfs");
  DFSTestUtil.writeFile(fs, srcPath, new String(expected));

  StripedFileTestUtil.verifyLength(fs, srcPath, fileLength);

  byte[] smallBuf = new byte[1024];
  byte[] largeBuf = new byte[fileLength + 100];
  // TODO: HDFS-8797
  //StripedFileTestUtil.verifyPread(fs, srcPath, fileLength, expected, largeBuf);

  StripedFileTestUtil.verifyStatefulRead(fs, srcPath, fileLength, expected, largeBuf);
  StripedFileTestUtil.verifySeek(fs, srcPath, fileLength);
  StripedFileTestUtil.verifyStatefulRead(fs, srcPath, fileLength, expected, smallBuf);
  // webhdfs doesn't support bytebuffer read
}
项目:aliyun-oss-hadoop-fs    文件:TestAuditLogs.java   
/** test that access via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfs() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0644));
  fs.setOwner(file, "root", null);

  setupAuditLogs();

  WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf, WebHdfsConstants.WEBHDFS_SCHEME);
  InputStream istream = webfs.open(file);
  int val = istream.read();
  istream.close();

  verifyAuditLogsRepeat(true, 3);
  assertTrue("failed to read from file", val >= 0);
}
项目:aliyun-oss-hadoop-fs    文件:TestAuditLogs.java   
/** test that stat via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfsStat() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0644));
  fs.setOwner(file, "root", null);

  setupAuditLogs();

  WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf, WebHdfsConstants.WEBHDFS_SCHEME);
  FileStatus st = webfs.getFileStatus(file);

  verifyAuditLogs(true);
  assertTrue("failed to stat file", st != null && st.isFile());
}
项目:aliyun-oss-hadoop-fs    文件:TestAuditLogs.java   
/** test that denied access via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfsDenied() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0600));
  fs.setOwner(file, "root", null);

  setupAuditLogs();
  try {
    WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf, WebHdfsConstants.WEBHDFS_SCHEME);
    InputStream istream = webfs.open(file);
    int val = istream.read();
    fail("open+read must not succeed, got " + val);
  } catch(AccessControlException E) {
    System.out.println("got access denied, as expected.");
  }
  verifyAuditLogsRepeat(false, 2);
}
项目:big-c    文件:TestAuditLogs.java   
/** test that access via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfs() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0644));
  fs.setOwner(file, "root", null);

  setupAuditLogs();

  WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf, WebHdfsFileSystem.SCHEME);
  InputStream istream = webfs.open(file);
  int val = istream.read();
  istream.close();

  verifyAuditLogsRepeat(true, 3);
  assertTrue("failed to read from file", val >= 0);
}
项目:big-c    文件:TestAuditLogs.java   
/** test that stat via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfsStat() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0644));
  fs.setOwner(file, "root", null);

  setupAuditLogs();

  WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf, WebHdfsFileSystem.SCHEME);
  FileStatus st = webfs.getFileStatus(file);

  verifyAuditLogs(true);
  assertTrue("failed to stat file", st != null && st.isFile());
}
项目:big-c    文件:TestAuditLogs.java   
/** test that denied access via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfsDenied() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0600));
  fs.setOwner(file, "root", null);

  setupAuditLogs();
  try {
    WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf, WebHdfsFileSystem.SCHEME);
    InputStream istream = webfs.open(file);
    int val = istream.read();
    fail("open+read must not succeed, got " + val);
  } catch(AccessControlException E) {
    System.out.println("got access denied, as expected.");
  }
  verifyAuditLogsRepeat(false, 2);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestAuditLogs.java   
/** test that access via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfs() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0644));
  fs.setOwner(file, "root", null);

  setupAuditLogs();

  WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf, WebHdfsFileSystem.SCHEME);
  InputStream istream = webfs.open(file);
  int val = istream.read();
  istream.close();

  verifyAuditLogsRepeat(true, 3);
  assertTrue("failed to read from file", val >= 0);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestAuditLogs.java   
/** test that stat via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfsStat() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0644));
  fs.setOwner(file, "root", null);

  setupAuditLogs();

  WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf, WebHdfsFileSystem.SCHEME);
  FileStatus st = webfs.getFileStatus(file);

  verifyAuditLogs(true);
  assertTrue("failed to stat file", st != null && st.isFile());
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestAuditLogs.java   
/** test that denied access via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfsDenied() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0600));
  fs.setOwner(file, "root", null);

  setupAuditLogs();
  try {
    WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf, WebHdfsFileSystem.SCHEME);
    InputStream istream = webfs.open(file);
    int val = istream.read();
    fail("open+read must not succeed, got " + val);
  } catch(AccessControlException E) {
    System.out.println("got access denied, as expected.");
  }
  verifyAuditLogsRepeat(false, 2);
}
项目:hadoop-plus    文件:TestAuditLogs.java   
/** test that access via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfs() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0644));
  fs.setOwner(file, "root", null);

  setupAuditLogs();

  WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf);
  InputStream istream = webfs.open(file);
  int val = istream.read();
  istream.close();

  verifyAuditLogsRepeat(true, 3);
  assertTrue("failed to read from file", val >= 0);
}
项目:hadoop-plus    文件:TestAuditLogs.java   
/** test that stat via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfsStat() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0644));
  fs.setOwner(file, "root", null);

  setupAuditLogs();

  WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf);
  FileStatus st = webfs.getFileStatus(file);

  verifyAuditLogs(true);
  assertTrue("failed to stat file", st != null && st.isFile());
}
项目:hadoop-plus    文件:TestAuditLogs.java   
/** test that denied access via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfsDenied() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0600));
  fs.setOwner(file, "root", null);

  setupAuditLogs();
  try {
    WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf);
    InputStream istream = webfs.open(file);
    int val = istream.read();
    fail("open+read must not succeed, got " + val);
  } catch(AccessControlException E) {
    System.out.println("got access denied, as expected.");
  }
  verifyAuditLogsRepeat(false, 2);
}
项目:FlexMap    文件:TestAuditLogs.java   
/** test that access via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfs() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0644));
  fs.setOwner(file, "root", null);

  setupAuditLogs();

  WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf, WebHdfsFileSystem.SCHEME);
  InputStream istream = webfs.open(file);
  int val = istream.read();
  istream.close();

  verifyAuditLogsRepeat(true, 3);
  assertTrue("failed to read from file", val >= 0);
}
项目:FlexMap    文件:TestAuditLogs.java   
/** test that stat via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfsStat() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0644));
  fs.setOwner(file, "root", null);

  setupAuditLogs();

  WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf, WebHdfsFileSystem.SCHEME);
  FileStatus st = webfs.getFileStatus(file);

  verifyAuditLogs(true);
  assertTrue("failed to stat file", st != null && st.isFile());
}
项目:FlexMap    文件:TestAuditLogs.java   
/** test that denied access via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfsDenied() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0600));
  fs.setOwner(file, "root", null);

  setupAuditLogs();
  try {
    WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf, WebHdfsFileSystem.SCHEME);
    InputStream istream = webfs.open(file);
    int val = istream.read();
    fail("open+read must not succeed, got " + val);
  } catch(AccessControlException E) {
    System.out.println("got access denied, as expected.");
  }
  verifyAuditLogsRepeat(false, 2);
}
项目:hops    文件:TestAuditLogs.java   
/**
 * test that access via webhdfs puts proper entry in audit log
 */
@Test
public void testAuditWebHdfs() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short) 0644));
  fs.setOwner(file, "root", null);

  setupAuditLogs();

  WebHdfsFileSystem webfs =
      WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf);
  InputStream istream = webfs.open(file);
  int val = istream.read();
  istream.close();

  verifyAuditLogsRepeat(true, 3);
  assertTrue("failed to read from file", val >= 0);
}
项目:hops    文件:TestAuditLogs.java   
/**
 * test that stat via webhdfs puts proper entry in audit log
 */
@Test
public void testAuditWebHdfsStat() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short) 0644));
  fs.setOwner(file, "root", null);

  setupAuditLogs();

  WebHdfsFileSystem webfs =
      WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf);
  FileStatus st = webfs.getFileStatus(file);

  verifyAuditLogs(true);
  assertTrue("failed to stat file", st != null && st.isFile());
}
项目:hops    文件:TestAuditLogs.java   
/**
 * test that denied access via webhdfs puts proper entry in audit log
 */
@Test
public void testAuditWebHdfsDenied() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short) 0600));
  fs.setOwner(file, "root", null);

  setupAuditLogs();
  try {
    WebHdfsFileSystem webfs =
        WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf);
    InputStream istream = webfs.open(file);
    int val = istream.read();
    fail("open+read must not succeed, got " + val);
  } catch (AccessControlException E) {
    System.out.println("got access denied, as expected.");
  }
  verifyAuditLogsRepeat(false, 2);
}
项目:hadoop-TCP    文件:TestAuditLogs.java   
/** test that access via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfs() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0644));
  fs.setOwner(file, "root", null);

  setupAuditLogs();

  WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf);
  InputStream istream = webfs.open(file);
  int val = istream.read();
  istream.close();

  verifyAuditLogsRepeat(true, 3);
  assertTrue("failed to read from file", val >= 0);
}
项目:hadoop-TCP    文件:TestAuditLogs.java   
/** test that stat via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfsStat() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0644));
  fs.setOwner(file, "root", null);

  setupAuditLogs();

  WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf);
  FileStatus st = webfs.getFileStatus(file);

  verifyAuditLogs(true);
  assertTrue("failed to stat file", st != null && st.isFile());
}
项目:hadoop-TCP    文件:TestAuditLogs.java   
/** test that denied access via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfsDenied() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0600));
  fs.setOwner(file, "root", null);

  setupAuditLogs();
  try {
    WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf);
    InputStream istream = webfs.open(file);
    int val = istream.read();
    fail("open+read must not succeed, got " + val);
  } catch(AccessControlException E) {
    System.out.println("got access denied, as expected.");
  }
  verifyAuditLogsRepeat(false, 2);
}
项目:hardfs    文件:TestAuditLogs.java   
/** test that access via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfs() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0644));
  fs.setOwner(file, "root", null);

  setupAuditLogs();

  WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf);
  InputStream istream = webfs.open(file);
  int val = istream.read();
  istream.close();

  verifyAuditLogsRepeat(true, 3);
  assertTrue("failed to read from file", val >= 0);
}
项目:hardfs    文件:TestAuditLogs.java   
/** test that stat via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfsStat() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0644));
  fs.setOwner(file, "root", null);

  setupAuditLogs();

  WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf);
  FileStatus st = webfs.getFileStatus(file);

  verifyAuditLogs(true);
  assertTrue("failed to stat file", st != null && st.isFile());
}
项目:hardfs    文件:TestAuditLogs.java   
/** test that denied access via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfsDenied() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0600));
  fs.setOwner(file, "root", null);

  setupAuditLogs();
  try {
    WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf);
    InputStream istream = webfs.open(file);
    int val = istream.read();
    fail("open+read must not succeed, got " + val);
  } catch(AccessControlException E) {
    System.out.println("got access denied, as expected.");
  }
  verifyAuditLogsRepeat(false, 2);
}
项目:hadoop-on-lustre2    文件:TestAuditLogs.java   
/** test that access via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfs() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0644));
  fs.setOwner(file, "root", null);

  setupAuditLogs();

  WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf, WebHdfsFileSystem.SCHEME);
  InputStream istream = webfs.open(file);
  int val = istream.read();
  istream.close();

  verifyAuditLogsRepeat(true, 3);
  assertTrue("failed to read from file", val >= 0);
}
项目:hadoop-on-lustre2    文件:TestAuditLogs.java   
/** test that stat via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfsStat() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0644));
  fs.setOwner(file, "root", null);

  setupAuditLogs();

  WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf, WebHdfsFileSystem.SCHEME);
  FileStatus st = webfs.getFileStatus(file);

  verifyAuditLogs(true);
  assertTrue("failed to stat file", st != null && st.isFile());
}
项目:hadoop-on-lustre2    文件:TestAuditLogs.java   
/** test that denied access via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfsDenied() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0600));
  fs.setOwner(file, "root", null);

  setupAuditLogs();
  try {
    WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf, WebHdfsFileSystem.SCHEME);
    InputStream istream = webfs.open(file);
    int val = istream.read();
    fail("open+read must not succeed, got " + val);
  } catch(AccessControlException E) {
    System.out.println("got access denied, as expected.");
  }
  verifyAuditLogsRepeat(false, 2);
}
项目:hadoop    文件:TestSymlinkHdfs.java   
@BeforeClass
public static void beforeClassSetup() throws Exception {
  Configuration conf = new HdfsConfiguration();
  conf.setBoolean(DFSConfigKeys.DFS_WEBHDFS_ENABLED_KEY, true);
  conf.set(FsPermission.UMASK_LABEL, "000");
  conf.setInt(DFSConfigKeys.DFS_NAMENODE_MAX_COMPONENT_LENGTH_KEY, 0);
  cluster = new MiniDFSCluster.Builder(conf).build();
  webhdfs = WebHdfsTestUtil.getWebHdfsFileSystem(conf, WebHdfsFileSystem.SCHEME);
  dfs = cluster.getFileSystem();
}
项目:hadoop    文件:TestAuditLogs.java   
/** test that open via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfsOpen() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0644));
  fs.setOwner(file, "root", null);

  setupAuditLogs();

  WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf, WebHdfsFileSystem.SCHEME);
  webfs.open(file);

  verifyAuditLogsCheckPattern(true, 3, webOpenPattern);
}
项目:hadoop    文件:TestDFSClientRetries.java   
private static FileSystem createFsWithDifferentUsername(
    final Configuration conf, final boolean isWebHDFS
    ) throws IOException, InterruptedException {
  final String username = UserGroupInformation.getCurrentUser(
      ).getShortUserName() + "_XXX";
  final UserGroupInformation ugi = UserGroupInformation.createUserForTesting(
      username, new String[]{"supergroup"});

  return isWebHDFS? WebHdfsTestUtil.getWebHdfsFileSystemAs(ugi, conf, WebHdfsFileSystem.SCHEME)
      : DFSTestUtil.getFileSystemAs(ugi, conf);
}
项目:aliyun-oss-hadoop-fs    文件:TestSymlinkHdfs.java   
@BeforeClass
public static void beforeClassSetup() throws Exception {
  Configuration conf = new HdfsConfiguration();
  conf.set(FsPermission.UMASK_LABEL, "000");
  conf.setInt(DFSConfigKeys.DFS_NAMENODE_MAX_COMPONENT_LENGTH_KEY, 0);
  cluster = new MiniDFSCluster.Builder(conf).build();
  webhdfs = WebHdfsTestUtil.getWebHdfsFileSystem(conf, WebHdfsConstants.WEBHDFS_SCHEME);
  dfs = cluster.getFileSystem();
}
项目:aliyun-oss-hadoop-fs    文件:TestAuditLogs.java   
/** test that open via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfsOpen() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0644));
  fs.setOwner(file, "root", null);

  setupAuditLogs();

  WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf, WebHdfsConstants.WEBHDFS_SCHEME);
  webfs.open(file).read();

  verifyAuditLogsCheckPattern(true, 3, webOpenPattern);
}
项目:aliyun-oss-hadoop-fs    文件:TestDataNodeUGIProvider.java   
@Before
public void setUp(){
  conf = WebHdfsTestUtil.createConf();
  conf.setInt(DFSConfigKeys.DFS_WEBHDFS_UGI_EXPIRE_AFTER_ACCESS_KEY,
      EXPIRE_AFTER_ACCESS);
  DataNodeUGIProvider.init(conf);
}
项目:aliyun-oss-hadoop-fs    文件:TestDFSClientRetries.java   
private static FileSystem createFsWithDifferentUsername(
    final Configuration conf, final boolean isWebHDFS
    ) throws IOException, InterruptedException {
  final String username = UserGroupInformation.getCurrentUser(
      ).getShortUserName() + "_XXX";
  final UserGroupInformation ugi = UserGroupInformation.createUserForTesting(
      username, new String[]{"supergroup"});

  return isWebHDFS? WebHdfsTestUtil.getWebHdfsFileSystemAs(ugi, conf, WebHdfsConstants.WEBHDFS_SCHEME)
      : DFSTestUtil.getFileSystemAs(ugi, conf);
}
项目:big-c    文件:TestSymlinkHdfs.java   
@BeforeClass
public static void beforeClassSetup() throws Exception {
  Configuration conf = new HdfsConfiguration();
  conf.setBoolean(DFSConfigKeys.DFS_WEBHDFS_ENABLED_KEY, true);
  conf.set(FsPermission.UMASK_LABEL, "000");
  conf.setInt(DFSConfigKeys.DFS_NAMENODE_MAX_COMPONENT_LENGTH_KEY, 0);
  cluster = new MiniDFSCluster.Builder(conf).build();
  webhdfs = WebHdfsTestUtil.getWebHdfsFileSystem(conf, WebHdfsFileSystem.SCHEME);
  dfs = cluster.getFileSystem();
}
项目:big-c    文件:TestAuditLogs.java   
/** test that open via webhdfs puts proper entry in audit log */
@Test
public void testAuditWebHdfsOpen() throws Exception {
  final Path file = new Path(fnames[0]);

  fs.setPermission(file, new FsPermission((short)0644));
  fs.setOwner(file, "root", null);

  setupAuditLogs();

  WebHdfsFileSystem webfs = WebHdfsTestUtil.getWebHdfsFileSystemAs(userGroupInfo, conf, WebHdfsFileSystem.SCHEME);
  webfs.open(file);

  verifyAuditLogsCheckPattern(true, 3, webOpenPattern);
}