use of org.apache.hadoop.mapreduce.v2.app.MockAppContext in project hadoop by apache.
the class TestAMWebApp method testTaskView.
@Test
public void testTaskView() {
AppContext appContext = new MockAppContext(0, 1, 1, 1);
Map<String, String> params = getTaskParams(appContext);
App app = new App(appContext);
app.setJob(appContext.getAllJobs().values().iterator().next());
app.setTask(app.getJob().getTasks().values().iterator().next());
WebAppTests.testPage(TaskPage.class, App.class, app, params);
}
use of org.apache.hadoop.mapreduce.v2.app.MockAppContext in project hadoop by apache.
the class TestAMWebApp method testSingleCounterView.
@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);
}
use of org.apache.hadoop.mapreduce.v2.app.MockAppContext in project hadoop by apache.
the class TestAMWebApp method testAppControllerIndex.
@Test
public void testAppControllerIndex() {
AppContext ctx = new MockAppContext(0, 1, 1, 1);
Injector injector = WebAppTests.createMockInjector(AppContext.class, ctx);
AppController controller = injector.getInstance(AppController.class);
controller.index();
assertEquals(ctx.getApplicationID().toString(), controller.get(APP_ID, ""));
}
use of org.apache.hadoop.mapreduce.v2.app.MockAppContext in project hadoop by apache.
the class TestAMWebApp method testTasksView.
@Test
public void testTasksView() {
AppContext appContext = new MockAppContext(0, 1, 1, 1);
Map<String, String> params = getTaskParams(appContext);
WebAppTests.testPage(TasksPage.class, AppContext.class, appContext, params);
}
use of org.apache.hadoop.mapreduce.v2.app.MockAppContext in project hadoop by apache.
the class TestAMWebApp method testSingleTaskCounterView.
@Test
public void testSingleTaskCounterView() {
AppContext appContext = new MockAppContext(0, 1, 1, 2);
Map<String, String> params = getTaskParams(appContext);
params.put(AMParams.COUNTER_GROUP, "org.apache.hadoop.mapreduce.FileSystemCounter");
params.put(AMParams.COUNTER_NAME, "HDFS_WRITE_OPS");
// remove counters from one task attempt
// to test handling of missing counters
TaskId taskID = MRApps.toTaskID(params.get(AMParams.TASK_ID));
Job job = appContext.getJob(taskID.getJobId());
Task task = job.getTask(taskID);
TaskAttempt attempt = task.getAttempts().values().iterator().next();
attempt.getReport().setCounters(null);
WebAppTests.testPage(SingleCounterPage.class, AppContext.class, appContext, params);
}
Aggregations