@Test public void testHumanDupePrinter() throws Exception { JobHistoryParser.JobInfo job = createJobInfo2(); // Counters are only part of the overview so printAll can be false or true // this does not affect the test, task counters are not printed HumanReadableHistoryViewerPrinter printer = new HumanReadableHistoryViewerPrinter(job, false, "http://", TimeZone.getTimeZone("GMT")); String outStr = run(printer); // We are not interested in anything but the duplicate counter int count1 = outStr.indexOf( "|Map-Reduce Framework |Map input records |"); Assert.assertNotEquals("First counter occurrence not found", -1, count1); int count2 = outStr.indexOf( "|Map-Reduce Framework |Map input records |", count1 + 1); Assert.assertEquals("Duplicate counter found at: " + count1 + " and " + count2, -1, count2); }
@Test public void testJSONDupePrinter() throws Exception { JobHistoryParser.JobInfo job = createJobInfo2(); // Counters are part of the overview and task info // Tasks only have bogus counters in the test if that is changed printAll // must then be kept as false for this test to pass JSONHistoryViewerPrinter printer = new JSONHistoryViewerPrinter(job, false, "http://"); String outStr = run(printer); // We are not interested in anything but the duplicate counter int count1 = outStr.indexOf( "\"counterName\":\"MAP_INPUT_RECORDS\""); Assert.assertNotEquals("First counter occurrence not found", -1, count1); int count2 = outStr.indexOf( "\"counterName\":\"MAP_INPUT_RECORDS\"", count1 + 1); Assert.assertEquals("Duplicate counter found at: " + count1 + " and " + count2, -1, count2); }
new HumanReadableHistoryViewerPrinter(job, false, "http://", TimeZone.getTimeZone("GMT")); String outStr = run(printer); Assert.assertEquals("\n" + "Hadoop job: job_1317928501754_0001\n" +
new HumanReadableHistoryViewerPrinter(job, true, "http://", TimeZone.getTimeZone("GMT")); String outStr = run(printer); if (System.getProperty("java.version").startsWith("1.7")) { Assert.assertEquals("\n" +
JSONHistoryViewerPrinter printer = new JSONHistoryViewerPrinter(job, false, "http://"); String outStr = run(printer); JSONAssert.assertEquals("{\n" + " \"counters\": {\n" +
JSONHistoryViewerPrinter printer = new JSONHistoryViewerPrinter(job, true, "http://"); String outStr = run(printer); JSONAssert.assertEquals("{\n" + " \"counters\": {\n" +