Search in sources :

Example 1 with MockAppContext

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

Example 2 with MockAppContext

use of org.apache.hadoop.mapreduce.v2.app.MockAppContext in project hadoop by apache.

the class TestHSWebApp method testSingleCounterView.

@Test
public void testSingleCounterView() {
    LOG.info("HsSingleCounterPage");
    WebAppTests.testPage(HsSingleCounterPage.class, AppContext.class, new MockAppContext(0, 1, 1, 1));
}
Also used : MockAppContext(org.apache.hadoop.mapreduce.v2.app.MockAppContext) Test(org.junit.Test)

Example 3 with MockAppContext

use of org.apache.hadoop.mapreduce.v2.app.MockAppContext in project hadoop by apache.

the class TestHSWebApp method testJobView.

@Test
public void testJobView() {
    LOG.info("HsJobPage");
    AppContext appContext = new MockAppContext(0, 1, 1, 1);
    Map<String, String> params = TestAMWebApp.getJobParams(appContext);
    WebAppTests.testPage(HsJobPage.class, AppContext.class, appContext, params);
}
Also used : MockAppContext(org.apache.hadoop.mapreduce.v2.app.MockAppContext) AppContext(org.apache.hadoop.mapreduce.v2.app.AppContext) MockAppContext(org.apache.hadoop.mapreduce.v2.app.MockAppContext) Test(org.junit.Test)

Example 4 with MockAppContext

use of org.apache.hadoop.mapreduce.v2.app.MockAppContext 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 5 with MockAppContext

use of org.apache.hadoop.mapreduce.v2.app.MockAppContext in project hadoop by apache.

the class TestHSWebApp method testConfView.

@Test
public void testConfView() {
    LOG.info("HsConfPage");
    WebAppTests.testPage(HsConfPage.class, AppContext.class, new MockAppContext(0, 1, 1, 1));
}
Also used : MockAppContext(org.apache.hadoop.mapreduce.v2.app.MockAppContext) Test(org.junit.Test)

Aggregations

MockAppContext (org.apache.hadoop.mapreduce.v2.app.MockAppContext)25 Test (org.junit.Test)25 AppContext (org.apache.hadoop.mapreduce.v2.app.AppContext)17 Injector (com.google.inject.Injector)8 PrintWriter (java.io.PrintWriter)4 HashMap (java.util.HashMap)4 Job (org.apache.hadoop.mapreduce.v2.app.job.Job)3 JobId (org.apache.hadoop.mapreduce.v2.api.records.JobId)2 TaskId (org.apache.hadoop.mapreduce.v2.api.records.TaskId)2 Task (org.apache.hadoop.mapreduce.v2.app.job.Task)2 View (org.apache.hadoop.yarn.webapp.View)2 AbstractModule (com.google.inject.AbstractModule)1 Configuration (org.apache.hadoop.conf.Configuration)1 MRApp (org.apache.hadoop.mapreduce.v2.app.MRApp)1 RunningAppContext (org.apache.hadoop.mapreduce.v2.app.MRAppMaster.RunningAppContext)1 TaskAttempt (org.apache.hadoop.mapreduce.v2.app.job.TaskAttempt)1 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)1