use of org.apache.hadoop.mapreduce.v2.app.MockAppContext in project hadoop by apache.
the class TestHSWebApp method testTaskView.
@Test
public void testTaskView() {
LOG.info("HsTaskPage");
AppContext appContext = new MockAppContext(0, 1, 1, 1);
Map<String, String> params = TestAMWebApp.getTaskParams(appContext);
WebAppTests.testPage(HsTaskPage.class, AppContext.class, appContext, params);
}
use of org.apache.hadoop.mapreduce.v2.app.MockAppContext in project hadoop by apache.
the class TestHSWebApp method testTasksView.
@Test
public void testTasksView() {
LOG.info("HsTasksPage");
AppContext appContext = new MockAppContext(0, 1, 1, 1);
Map<String, String> params = TestAMWebApp.getTaskParams(appContext);
WebAppTests.testPage(HsTasksPage.class, AppContext.class, appContext, params);
}
use of org.apache.hadoop.mapreduce.v2.app.MockAppContext in project hadoop by apache.
the class TestHSWebApp method testLogsView1.
@Test
public void testLogsView1() throws IOException {
LOG.info("HsLogsPage");
Injector injector = WebAppTests.testPage(AggregatedLogsPage.class, AppContext.class, new MockAppContext(0, 1, 1, 1));
PrintWriter spyPw = WebAppTests.getPrintWriter(injector);
verify(spyPw).write("Cannot get container logs without a ContainerId");
verify(spyPw).write("Cannot get container logs without a NodeId");
verify(spyPw).write("Cannot get container logs without an app owner");
}
use of org.apache.hadoop.mapreduce.v2.app.MockAppContext in project hadoop by apache.
the class JHEventHandlerForSigtermTest method mockAppContext.
private AppContext mockAppContext(Class<? extends AppContext> contextClass, ApplicationId appId, boolean isLastAMRetry) {
JobId jobId = TypeConverter.toYarn(TypeConverter.fromYarn(appId));
AppContext mockContext = mock(contextClass);
Job mockJob = mockJob();
when(mockContext.getJob(jobId)).thenReturn(mockJob);
when(mockContext.getApplicationID()).thenReturn(appId);
when(mockContext.isLastAMRetry()).thenReturn(isLastAMRetry);
if (mockContext instanceof RunningAppContext) {
when(((RunningAppContext) mockContext).getTimelineClient()).thenReturn(TimelineClient.createTimelineClient());
when(((RunningAppContext) mockContext).getTimelineV2Client()).thenReturn(TimelineV2Client.createTimelineClient(ApplicationId.newInstance(0, 1)));
}
return mockContext;
}
use of org.apache.hadoop.mapreduce.v2.app.MockAppContext in project hadoop by apache.
the class TestAMWebApp method testJobView.
@Test
public void testJobView() {
AppContext appContext = new MockAppContext(0, 1, 1, 1);
Map<String, String> params = getJobParams(appContext);
WebAppTests.testPage(JobPage.class, AppContext.class, appContext, params);
}
Aggregations