org.apache.hadoop.ipc.RemoteException.toString()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中org.apache.hadoop.ipc.RemoteException.toString方法的一些代码示例,展示了RemoteException.toString的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RemoteException.toString方法的具体详情如下:
包路径:org.apache.hadoop.ipc.RemoteException
类名称:RemoteException
方法名:toString

RemoteException.toString介绍

暂无

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-hdfs-test

/** Test calling getFileInfo directly on the client */
@Test
public void testGetFileInfo() throws IOException {
 // Check that / exists
 Path path = new Path("/");
 assertTrue("/ should be a directory", 
       fs.getFileStatus(path).isDirectory());
 
 // Make sure getFileInfo returns null for files which do not exist
 HdfsFileStatus fileInfo = dfsClient.getFileInfo("/noSuchFile");
 assertEquals("Non-existant file should result in null", null, fileInfo);
 // Test getFileInfo throws the right exception given a non-absolute path.
 try {
  dfsClient.getFileInfo("non-absolute");
  fail("getFileInfo for a non-absolute path did not throw IOException");
 } catch (RemoteException re) {
  assertTrue("Wrong exception for invalid file name", 
    re.toString().contains("Invalid file name"));
 }
}

代码示例来源:origin: ch.cern.hadoop/hadoop-hdfs

/** Test calling getFileInfo directly on the client */
@Test
public void testGetFileInfo() throws IOException {
 // Check that / exists
 Path path = new Path("/");
 assertTrue("/ should be a directory", 
       fs.getFileStatus(path).isDirectory());
 
 // Make sure getFileInfo returns null for files which do not exist
 HdfsFileStatus fileInfo = dfsClient.getFileInfo("/noSuchFile");
 assertEquals("Non-existant file should result in null", null, fileInfo);
 
 Path path1 = new Path("/name1");
 Path path2 = new Path("/name1/name2");
 assertTrue(fs.mkdirs(path1));
 FSDataOutputStream out = fs.create(path2, false);
 out.close();
 fileInfo = dfsClient.getFileInfo(path1.toString());
 assertEquals(1, fileInfo.getChildrenNum());
 fileInfo = dfsClient.getFileInfo(path2.toString());
 assertEquals(0, fileInfo.getChildrenNum());
 // Test getFileInfo throws the right exception given a non-absolute path.
 try {
  dfsClient.getFileInfo("non-absolute");
  fail("getFileInfo for a non-absolute path did not throw IOException");
 } catch (RemoteException re) {
  assertTrue("Wrong exception for invalid file name", 
    re.toString().contains("Invalid file name"));
 }
}

相关文章