Search in sources :

Example 6 with HtmlBlock

use of org.apache.hadoop.yarn.webapp.view.HtmlBlock in project hadoop by apache.

the class TestAggregatedLogsBlock method testBadLogs.

/**
   * try to read bad logs
   * 
   * @throws Exception
   */
@Test
public void testBadLogs() throws Exception {
    FileUtil.fullyDelete(new File("target/logs"));
    Configuration configuration = getConfiguration();
    writeLogs("target/logs/logs/application_0_0001/container_0_0001_01_000001");
    writeLog(configuration, "owner");
    AggregatedLogsBlockForTest aggregatedBlock = getAggregatedLogsBlockForTest(configuration, "admin", "container_0_0001_01_000001");
    ByteArrayOutputStream data = new ByteArrayOutputStream();
    PrintWriter printWriter = new PrintWriter(data);
    HtmlBlock html = new HtmlBlockForTest();
    HtmlBlock.Block block = new BlockForTest(html, printWriter, 10, false);
    aggregatedBlock.render(block);
    block.getWriter().flush();
    String out = data.toString();
    assertTrue(out.contains("Logs not available for entity. Aggregation may not be complete, Check back later or try the nodemanager at localhost:1234"));
}
Also used : HtmlBlockForTest(org.apache.hadoop.yarn.webapp.view.HtmlBlockForTest) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) Configuration(org.apache.hadoop.conf.Configuration) AggregatedLogsBlockForTest(org.apache.hadoop.yarn.webapp.log.AggregatedLogsBlockForTest) ByteArrayOutputStream(java.io.ByteArrayOutputStream) HtmlBlock(org.apache.hadoop.yarn.webapp.view.HtmlBlock) File(java.io.File) PrintWriter(java.io.PrintWriter) AggregatedLogsBlockForTest(org.apache.hadoop.yarn.webapp.log.AggregatedLogsBlockForTest) BlockForTest(org.apache.hadoop.yarn.webapp.view.BlockForTest) HtmlBlockForTest(org.apache.hadoop.yarn.webapp.view.HtmlBlockForTest) AggregatedLogsBlockForTest(org.apache.hadoop.yarn.webapp.log.AggregatedLogsBlockForTest) BlockForTest(org.apache.hadoop.yarn.webapp.view.BlockForTest) HtmlBlockForTest(org.apache.hadoop.yarn.webapp.view.HtmlBlockForTest) Test(org.junit.Test)

Example 7 with HtmlBlock

use of org.apache.hadoop.yarn.webapp.view.HtmlBlock in project hadoop by apache.

the class TestHsJobBlock method createBlockToCreateTo.

private static HtmlBlock.Block createBlockToCreateTo(OutputStream outputStream) {
    PrintWriter printWriter = new PrintWriter(outputStream);
    HtmlBlock html = new HtmlBlockForTest();
    return new BlockForTest(html, printWriter, 10, false) {

        @Override
        protected void subView(Class<? extends SubView> cls) {
        }
    };
}
Also used : HtmlBlockForTest(org.apache.hadoop.yarn.webapp.view.HtmlBlockForTest) HtmlBlock(org.apache.hadoop.yarn.webapp.view.HtmlBlock) SubView(org.apache.hadoop.yarn.webapp.SubView) PrintWriter(java.io.PrintWriter) BlockForTest(org.apache.hadoop.yarn.webapp.view.BlockForTest) HtmlBlockForTest(org.apache.hadoop.yarn.webapp.view.HtmlBlockForTest)

Aggregations

PrintWriter (java.io.PrintWriter)7 BlockForTest (org.apache.hadoop.yarn.webapp.view.BlockForTest)7 HtmlBlock (org.apache.hadoop.yarn.webapp.view.HtmlBlock)7 HtmlBlockForTest (org.apache.hadoop.yarn.webapp.view.HtmlBlockForTest)7 ByteArrayOutputStream (java.io.ByteArrayOutputStream)6 File (java.io.File)6 Configuration (org.apache.hadoop.conf.Configuration)6 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)6 AggregatedLogsBlockForTest (org.apache.hadoop.yarn.webapp.log.AggregatedLogsBlockForTest)6 Test (org.junit.Test)6 URL (java.net.URL)1 SubView (org.apache.hadoop.yarn.webapp.SubView)1