Search in sources :

Example 6 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)

Example 7 with MockAppContext

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

Example 8 with MockAppContext

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

the class TestHSWebApp method testAboutView.

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

Example 9 with MockAppContext

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

the class TestHSWebApp method testAttemptsView.

@Test
public void testAttemptsView() {
    LOG.info("HsAttemptsPage");
    AppContext appContext = new MockAppContext(0, 1, 1, 1);
    Map<String, String> params = TestAMWebApp.getTaskParams(appContext);
    WebAppTests.testPage(HsAttemptsPage.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 10 with MockAppContext

use of org.apache.hadoop.mapreduce.v2.app.MockAppContext 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);
}
Also used : MockAppContext(org.apache.hadoop.mapreduce.v2.app.MockAppContext) HashMap(java.util.HashMap) Injector(com.google.inject.Injector) PrintWriter(java.io.PrintWriter) 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