use of com.google.inject.Injector in project hadoop by apache.
the class TestAHSWebApp method testContainerPage.
@Test
public void testContainerPage() throws Exception {
Injector injector = WebAppTests.createMockInjector(ApplicationBaseProtocol.class, mockApplicationHistoryClientService(1, 1, 1));
ContainerPage containerPageInstance = injector.getInstance(ContainerPage.class);
containerPageInstance.render();
WebAppTests.flushOutput(injector);
containerPageInstance.set(YarnWebParams.CONTAINER_ID, ContainerId.newContainerId(ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 1), 1), 1).toString());
containerPageInstance.render();
WebAppTests.flushOutput(injector);
}
use of com.google.inject.Injector in project hadoop by apache.
the class TestHSWebApp method testAppControllerIndex.
@Test
public void testAppControllerIndex() {
MockAppContext ctx = new MockAppContext(0, 1, 1, 1);
Injector injector = WebAppTests.createMockInjector(AppContext.class, ctx);
HsController controller = injector.getInstance(HsController.class);
controller.index();
assertEquals(ctx.getApplicationID().toString(), controller.get(APP_ID, ""));
}
use of com.google.inject.Injector in project hadoop by apache.
the class TestHSWebApp method testTaskViewNaturalSortType.
@Test
public void testTaskViewNaturalSortType() {
LOG.info("HsTaskPage");
AppContext appContext = new MockAppContext(0, 1, 1, 1);
Map<String, String> params = TestAMWebApp.getTaskParams(appContext);
Injector testPage = WebAppTests.testPage(HsTaskPage.class, AppContext.class, appContext, params);
View viewInstance = testPage.getInstance(HsTaskPage.class);
Map<String, String> moreParams = viewInstance.context().requestContext().moreParams();
String appTableColumnsMeta = moreParams.get("ui.dataTables.attempts.init");
Assert.assertTrue(appTableColumnsMeta.indexOf("natural") != -1);
}
use of com.google.inject.Injector in project hadoop by apache.
the class TestHSWebApp method testLogsViewBadStartEnd.
@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");
}
use of com.google.inject.Injector in project hadoop by apache.
the class TestHSWebApp method testLogsView2.
@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);
}
Aggregations