• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MockJobs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.hadoop.mapreduce.v2.app.MockJobs的典型用法代码示例。如果您正苦于以下问题:Java MockJobs类的具体用法?Java MockJobs怎么用?Java MockJobs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MockJobs类属于org.apache.hadoop.mapreduce.v2.app包,在下文中一共展示了MockJobs类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testLogsView2

import org.apache.hadoop.mapreduce.v2.app.MockJobs; //导入依赖的package包/类
@Test
public void testLogsView2() throws IOException {
  LOG.info("HsLogsPage with data");
  MockAppContext ctx = new MockAppContext(0, 1, 1, 1);
  Map<String, String> params = new HashMap<String, String>();

  params.put(CONTAINER_ID, MRApp.newContainerId(1, 1, 333, 1)
      .toString());
  params.put(NM_NODENAME, 
      NodeId.newInstance(MockJobs.NM_HOST, MockJobs.NM_PORT).toString());
  params.put(ENTITY_STRING, "container_10_0001_01_000001");
  params.put(APP_OWNER, "owner");

  Injector injector =
      WebAppTests.testPage(AggregatedLogsPage.class, AppContext.class, ctx,
          params);
  PrintWriter spyPw = WebAppTests.getPrintWriter(injector);
  verify(spyPw).write(
      "Aggregation is not enabled. Try the nodemanager at "
          + MockJobs.NM_HOST + ":" + MockJobs.NM_PORT);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:TestHSWebApp.java


示例2: testLogsViewBadStartEnd

import org.apache.hadoop.mapreduce.v2.app.MockJobs; //导入依赖的package包/类
@Test
public void testLogsViewBadStartEnd() throws IOException {
  LOG.info("HsLogsPage with bad start/end params");
  MockAppContext ctx = new MockAppContext(0, 1, 1, 1);
  Map<String, String> params = new HashMap<String, String>();

  params.put("start", "foo");
  params.put("end", "bar");
  params.put(CONTAINER_ID, MRApp.newContainerId(1, 1, 333, 1)
      .toString());
  params.put(NM_NODENAME,
      NodeId.newInstance(MockJobs.NM_HOST, MockJobs.NM_PORT).toString());
  params.put(ENTITY_STRING, "container_10_0001_01_000001");
  params.put(APP_OWNER, "owner");

  Injector injector =
      WebAppTests.testPage(AggregatedLogsPage.class, AppContext.class, ctx,
          params);
  PrintWriter spyPw = WebAppTests.getPrintWriter(injector);
  verify(spyPw).write("Invalid log start value: foo");
  verify(spyPw).write("Invalid log end value: bar");
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:TestHSWebApp.java


示例3: testCountersOverRawCounters

import org.apache.hadoop.mapreduce.v2.app.MockJobs; //导入依赖的package包/类
@Test
public void testCountersOverRawCounters() {
  // Create basic class
  TaskReport report = Records.newRecord(TaskReport.class);
  org.apache.hadoop.mapreduce.Counters rCounters = MockJobs.newCounters();
  Counters altCounters = TypeConverter.toYarn(rCounters);
  // Set raw counters
  report.setRawCounters(rCounters);
  // Set real counters
  report.setCounters(altCounters);
  // Verify real counters has priority over raw
  Counters counters = report.getCounters();
  assertNotEquals(null, counters);
  assertNotEquals(rCounters, altCounters);
  assertEquals(counters, altCounters);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:17,代码来源:TestTaskReport.java


示例4: testSingleCounterView

import org.apache.hadoop.mapreduce.v2.app.MockJobs; //导入依赖的package包/类
@Test public void testSingleCounterView() {
  AppContext appContext = new MockAppContext(0, 1, 1, 1);
  Job job = appContext.getAllJobs().values().iterator().next();
  // add a failed task to the job without any counters
  Task failedTask = MockJobs.newTask(job.getID(), 2, 1, true);
  Map<TaskId,Task> tasks = job.getTasks();
  tasks.put(failedTask.getID(), failedTask);
  Map<String, String> params = getJobParams(appContext);
  params.put(AMParams.COUNTER_GROUP, 
      "org.apache.hadoop.mapreduce.FileSystemCounter");
  params.put(AMParams.COUNTER_NAME, "HDFS_WRITE_OPS");
  WebAppTests.testPage(SingleCounterPage.class, AppContext.class,
                       appContext, params);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:TestAMWebApp.java


示例5: testLogsViewSingle

import org.apache.hadoop.mapreduce.v2.app.MockJobs; //导入依赖的package包/类
@Test
public void testLogsViewSingle() throws IOException {
  LOG.info("HsLogsPage with params for single log and data limits");
  MockAppContext ctx = new MockAppContext(0, 1, 1, 1);
  Map<String, String> params = new HashMap<String, String>();

  final Configuration conf = new YarnConfiguration();
  conf.setBoolean(YarnConfiguration.LOG_AGGREGATION_ENABLED, true);

  params.put("start", "-2048");
  params.put("end", "-1024");
  params.put(CONTAINER_LOG_TYPE, "syslog");
  params.put(CONTAINER_ID, MRApp.newContainerId(1, 1, 333, 1)
      .toString());
  params.put(NM_NODENAME,
      NodeId.newInstance(MockJobs.NM_HOST, MockJobs.NM_PORT).toString());
  params.put(ENTITY_STRING, "container_10_0001_01_000001");
  params.put(APP_OWNER, "owner");

  Injector injector =
      WebAppTests.testPage(AggregatedLogsPage.class, AppContext.class, ctx,
          params, new AbstractModule() {
        @Override
        protected void configure() {
          bind(Configuration.class).toInstance(conf);
        }
      });
  PrintWriter spyPw = WebAppTests.getPrintWriter(injector);
  verify(spyPw).write(
      "Logs not available for container_10_0001_01_000001."
          + " Aggregation may not be complete, "
          + "Check back later or try the nodemanager at "
          + MockJobs.NM_HOST + ":" + MockJobs.NM_PORT);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:35,代码来源:TestHSWebApp.java


示例6: testSetRawCounters

import org.apache.hadoop.mapreduce.v2.app.MockJobs; //导入依赖的package包/类
@Test
public void testSetRawCounters() {
  TaskAttemptReport report = Records.newRecord(TaskAttemptReport.class);
  org.apache.hadoop.mapreduce.Counters rCounters = MockJobs.newCounters();
  report.setRawCounters(rCounters);
  Counters counters = report.getCounters();
  assertNotEquals(null, counters);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:9,代码来源:TestTaskAttemptReport.java


示例7: testBuildImplicitRawCounters

import org.apache.hadoop.mapreduce.v2.app.MockJobs; //导入依赖的package包/类
@Test
public void testBuildImplicitRawCounters() {
  TaskAttemptReportPBImpl report = new TaskAttemptReportPBImpl();
  org.apache.hadoop.mapreduce.Counters rCounters = MockJobs.newCounters();
  report.setRawCounters(rCounters);
  MRProtos.TaskAttemptReportProto protoVal = report.getProto();
  Counters counters = report.getCounters();
  assertTrue(protoVal.hasCounters());
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:10,代码来源:TestTaskAttemptReport.java


示例8: testCountersOverRawCounters

import org.apache.hadoop.mapreduce.v2.app.MockJobs; //导入依赖的package包/类
@Test
public void testCountersOverRawCounters() {
  TaskAttemptReport report = Records.newRecord(TaskAttemptReport.class);
  org.apache.hadoop.mapreduce.Counters rCounters = MockJobs.newCounters();
  Counters altCounters = TypeConverter.toYarn(rCounters);
  report.setRawCounters(rCounters);
  report.setCounters(altCounters);
  Counters counters = report.getCounters();
  assertNotEquals(null, counters);
  assertNotEquals(rCounters, altCounters);
  assertEquals(counters, altCounters);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:13,代码来源:TestTaskAttemptReport.java


示例9: testSetNonNullCountersToNull

import org.apache.hadoop.mapreduce.v2.app.MockJobs; //导入依赖的package包/类
@Test
public void testSetNonNullCountersToNull() {
  // Create basic class
  TaskAttemptReport report = Records.newRecord(TaskAttemptReport.class);
  // Set raw counters
  org.apache.hadoop.mapreduce.Counters rCounters = MockJobs.newCounters();
  report.setRawCounters(rCounters);
  // Verify getCounters converts properly from raw to real
  Counters counters = report.getCounters();
  assertNotEquals(null, counters);
  // Clear counters to null and then verify
  report.setCounters(null);
  assertEquals(null, report.getCounters());
  assertEquals(null, report.getRawCounters());
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:16,代码来源:TestTaskAttemptReport.java


示例10: testSetNonNullRawCountersToNull

import org.apache.hadoop.mapreduce.v2.app.MockJobs; //导入依赖的package包/类
@Test
public void testSetNonNullRawCountersToNull() {
  // Create basic class
  TaskAttemptReport report = Records.newRecord(TaskAttemptReport.class);
  // Set raw counters
  org.apache.hadoop.mapreduce.Counters rCounters = MockJobs.newCounters();
  report.setRawCounters(rCounters);
  // Verify getCounters converts properly from raw to real
  Counters counters = report.getCounters();
  assertNotEquals(null, counters);
  // Clear counters to null and then verify
  report.setRawCounters(null);
  assertEquals(null, report.getCounters());
  assertEquals(null, report.getRawCounters());
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:16,代码来源:TestTaskAttemptReport.java


示例11: testSetRawCounters

import org.apache.hadoop.mapreduce.v2.app.MockJobs; //导入依赖的package包/类
@Test
public void testSetRawCounters() {
  // Create basic class
  TaskReport report = Records.newRecord(TaskReport.class);
  org.apache.hadoop.mapreduce.Counters rCounters = MockJobs.newCounters();
  // Set raw counters
  report.setRawCounters(rCounters);
  // Verify getCounters converts properly from raw to real
  Counters counters = report.getCounters();
  assertNotEquals(null, counters);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:12,代码来源:TestTaskReport.java


示例12: testBuildImplicitRawCounters

import org.apache.hadoop.mapreduce.v2.app.MockJobs; //导入依赖的package包/类
@Test
public void testBuildImplicitRawCounters() {
  // Create basic class
  TaskReportPBImpl report = new TaskReportPBImpl();
  org.apache.hadoop.mapreduce.Counters rCounters = MockJobs.newCounters();
  // Set raw counters
  report.setRawCounters(rCounters);
  // Verify getProto method implicitly converts/sets real counters
  MRProtos.TaskReportProto protoVal = report.getProto();
  assertTrue(protoVal.hasCounters());
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:12,代码来源:TestTaskReport.java


示例13: testSetNonNullCountersToNull

import org.apache.hadoop.mapreduce.v2.app.MockJobs; //导入依赖的package包/类
@Test
public void testSetNonNullCountersToNull() {
  // Create basic class
  TaskReport report = Records.newRecord(TaskReport.class);
  // Set raw counters
  org.apache.hadoop.mapreduce.Counters rCounters = MockJobs.newCounters();
  report.setRawCounters(rCounters);
  // Verify getCounters converts properly from raw to real
  Counters counters = report.getCounters();
  assertNotEquals(null, counters);
  // Clear counters to null and then verify
  report.setCounters(null);
  assertEquals(null, report.getCounters());
  assertEquals(null, report.getRawCounters());
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:16,代码来源:TestTaskReport.java


示例14: testSetNonNullRawCountersToNull

import org.apache.hadoop.mapreduce.v2.app.MockJobs; //导入依赖的package包/类
@Test
public void testSetNonNullRawCountersToNull() {
  // Create basic class
  TaskReport report = Records.newRecord(TaskReport.class);
  // Set raw counters
  org.apache.hadoop.mapreduce.Counters rCounters = MockJobs.newCounters();
  report.setRawCounters(rCounters);
  // Verify getCounters converts properly from raw to real
  Counters counters = report.getCounters();
  assertNotEquals(null, counters);
  // Clear counters to null and then verify
  report.setRawCounters(null);
  assertEquals(null, report.getCounters());
  assertEquals(null, report.getRawCounters());
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:16,代码来源:TestTaskReport.java



注:本文中的org.apache.hadoop.mapreduce.v2.app.MockJobs类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ConstraintDescriptions类代码示例发布时间:2022-05-22
下一篇:
Java FifoCache类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap