Search in sources :

Example 1 with View

use of org.apache.hadoop.yarn.webapp.View 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);
}
Also used : MockAppContext(org.apache.hadoop.mapreduce.v2.app.MockAppContext) Injector(com.google.inject.Injector) AppContext(org.apache.hadoop.mapreduce.v2.app.AppContext) MockAppContext(org.apache.hadoop.mapreduce.v2.app.MockAppContext) View(org.apache.hadoop.yarn.webapp.View) Test(org.junit.Test)

Example 2 with View

use of org.apache.hadoop.yarn.webapp.View in project hadoop by apache.

the class WebAppTests method testPage.

public static <T> Injector testPage(Class<? extends View> page, Class<T> api, T impl, Map<String, String> params, Module... modules) {
    Injector injector = createMockInjector(api, impl, modules);
    View view = injector.getInstance(page);
    if (params != null) {
        for (Map.Entry<String, String> entry : params.entrySet()) {
            view.set(entry.getKey(), entry.getValue());
        }
    }
    view.render();
    flushOutput(injector);
    return injector;
}
Also used : Injector(com.google.inject.Injector) SubView(org.apache.hadoop.yarn.webapp.SubView) View(org.apache.hadoop.yarn.webapp.View) Map(java.util.Map)

Example 3 with View

use of org.apache.hadoop.yarn.webapp.View in project hadoop by apache.

the class TestHSWebApp method testTasksViewNaturalSortType.

@Test
public void testTasksViewNaturalSortType() {
    LOG.info("HsTasksPage");
    AppContext appContext = new MockAppContext(0, 1, 1, 1);
    Map<String, String> params = TestAMWebApp.getTaskParams(appContext);
    Injector testPage = WebAppTests.testPage(HsTasksPage.class, AppContext.class, appContext, params);
    View viewInstance = testPage.getInstance(HsTasksPage.class);
    Map<String, String> moreParams = viewInstance.context().requestContext().moreParams();
    String appTableColumnsMeta = moreParams.get("ui.dataTables.selector.init");
    Assert.assertTrue(appTableColumnsMeta.indexOf("natural") != -1);
}
Also used : MockAppContext(org.apache.hadoop.mapreduce.v2.app.MockAppContext) Injector(com.google.inject.Injector) AppContext(org.apache.hadoop.mapreduce.v2.app.AppContext) MockAppContext(org.apache.hadoop.mapreduce.v2.app.MockAppContext) View(org.apache.hadoop.yarn.webapp.View) Test(org.junit.Test)

Aggregations

Injector (com.google.inject.Injector)3 View (org.apache.hadoop.yarn.webapp.View)3 AppContext (org.apache.hadoop.mapreduce.v2.app.AppContext)2 MockAppContext (org.apache.hadoop.mapreduce.v2.app.MockAppContext)2 Test (org.junit.Test)2 Map (java.util.Map)1 SubView (org.apache.hadoop.yarn.webapp.SubView)1