org.apache.hadoop.tools.DistCp.main()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(160)

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

DistCp.main介绍

[英]Main function of the DistCp program. Parses the input arguments (via OptionsParser), and invokes the DistCp::run() method, via the ToolRunner.
[中]DistCp程序的主要功能。解析输入参数(通过OptionsParser),并通过ToolRunner调用DistCp::run()方法。

代码示例

代码示例来源:origin: io.hops/hadoop-distcp

/**
 * test main method of DistCp. Method should to call System.exit().
 * 
 */
@Test
public void testCleanupTestViaToolRunner() throws IOException, InterruptedException {
 Configuration conf = getConf();
 Path stagingDir = JobSubmissionFiles.getStagingDir(new Cluster(conf), conf);
 stagingDir.getFileSystem(conf).mkdirs(stagingDir);
  Path soure = createFile("tmp.txt");
 Path target = createFile("target.txt");
 try {
  String[] arg = {target.toString(),soure.toString()};
  DistCp.main(arg);
  Assert.fail();
 } catch (ExitException t) {
  Assert.assertTrue(fs.exists(target));
  Assert.assertEquals(t.status, 0);
  Assert.assertEquals(
    stagingDir.getFileSystem(conf).listStatus(stagingDir).length, 0);
 }
}

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

/**
 * test main method of DistCp. Method should to call System.exit().
 * 
 */
@Test
public void testCleanupTestViaToolRunner() throws IOException, InterruptedException {
 Configuration conf = getConf();
 Path stagingDir = JobSubmissionFiles.getStagingDir(new Cluster(conf), conf);
 stagingDir.getFileSystem(conf).mkdirs(stagingDir);
  Path soure = createFile("tmp.txt");
 Path target = createFile("target.txt");
 try {
  String[] arg = {target.toString(),soure.toString()};
  DistCp.main(arg);
  Assert.fail();
 } catch (ExitException t) {
  Assert.assertTrue(fs.exists(target));
  Assert.assertEquals(t.status, 0);
  Assert.assertEquals(
    stagingDir.getFileSystem(conf).listStatus(stagingDir).length, 0);
 }
}

相关文章