From f7743dd07dfbe0dde9be71acfaba16ded52adba7 Mon Sep 17 00:00:00 2001 From: Karthik Kambatla Date: Mon, 29 Sep 2014 11:33:44 -0700 Subject: [PATCH] YARN-2610. Hamlet should close table tags. (Ray Chiang via kasha) --- hadoop-yarn-project/CHANGES.txt | 2 ++ .../apache/hadoop/yarn/webapp/hamlet/Hamlet.java | 10 +++++----- .../hadoop/yarn/webapp/hamlet/TestHamlet.java | 4 ++-- .../hadoop/yarn/webapp/view/TestInfoBlock.java | 15 ++++++++------- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index a15a98ec63..c1172de3fb 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -480,6 +480,8 @@ Release 2.6.0 - UNRELEASED YARN-2606. Application History Server tries to access hdfs before doing secure login (Mit Desai via jeagles) + YARN-2610. Hamlet should close table tags. (Ray Chiang via kasha) + Release 2.5.1 - 2014-09-05 INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/hamlet/Hamlet.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/hamlet/Hamlet.java index 7076c9afac..83fa5dafa8 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/hamlet/Hamlet.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/hamlet/Hamlet.java @@ -2423,10 +2423,10 @@ public TR td(String selector, String cdata) { } private TH th_(T e, boolean inline) { - return new TH("th", e, opt(false, inline, false)); } + return new TH("th", e, opt(true, inline, false)); } private TD td_(T e, boolean inline) { - return new TD("td", e, opt(false, inline, false)); } + return new TD("td", e, opt(true, inline, false)); } public class COL extends EImp implements HamletSpec.COL { public COL(String name, T parent, EnumSet opts) { @@ -3719,10 +3719,10 @@ private COLGROUP colgroup_(T e, boolean inline) { return new COLGROUP("colgroup", e, opt(false, inline, false)); } private THEAD thead_(T e, boolean inline) { - return new THEAD("thead", e, opt(false, inline, false)); } + return new THEAD("thead", e, opt(true, inline, false)); } private TFOOT tfoot_(T e, boolean inline) { - return new TFOOT("tfoot", e, opt(false, inline, false)); } + return new TFOOT("tfoot", e, opt(true, inline, false)); } private TBODY tbody_(T e, boolean inline) { return new TBODY("tbody", e, opt(true, inline, false)); } @@ -3731,7 +3731,7 @@ private COL col_(T e, boolean inline) { return new COL("col", e, opt(false, inline, false)); } private TR tr_(T e, boolean inline) { - return new TR("tr", e, opt(false, inline, false)); } + return new TR("tr", e, opt(true, inline, false)); } public class BUTTON extends EImp implements HamletSpec.BUTTON { public BUTTON(String name, T parent, EnumSet opts) { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/hamlet/TestHamlet.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/hamlet/TestHamlet.java index 1ea8bcf6ba..d9eaa37b3c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/hamlet/TestHamlet.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/hamlet/TestHamlet.java @@ -88,8 +88,8 @@ public class TestHamlet { assertEquals(0, h.nestLevel); verify(out).print(""); - verify(out, never()).print(""); - verify(out, never()).print(""); + verify(out, atLeast(1)).print(""); + verify(out, atLeast(1)).print(""); } @Test public void testEnumAttrs() { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestInfoBlock.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestInfoBlock.java index 4ec14348e5..da5efbb82f 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestInfoBlock.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/webapp/view/TestInfoBlock.java @@ -68,7 +68,7 @@ public static class MultilineInfoBlock extends InfoBlock{ static { resInfo = new ResponseInfo(); - resInfo._("Single_line_value", "This is one line."); + resInfo._("Multiple_line_value", "This is one line."); resInfo._("Multiple_line_value", "This is first line.\nThis is second line."); } @@ -98,13 +98,14 @@ public void testMultilineInfoBlock() throws Exception{ WebAppTests.testBlock(MultilineInfoBlock.class); TestInfoBlock.pw.flush(); String output = TestInfoBlock.sw.toString().replaceAll(" +", " "); - String expectedSinglelineData = String.format("%n" - + " %n Single_line_value%n %n This is one line.%n"); - String expectedMultilineData = String.format("%n" - + " %n Multiple_line_value%n %n
%n" + String expectedMultilineData1 = String.format("%n" + + " %n Multiple_line_value%n %n" + + " %n This is one line.%n %n"); + String expectedMultilineData2 = String.format("%n" + + " %n Multiple_line_value%n %n %n
%n" + " This is first line.%n
%n
%n" + " This is second line.%n
%n"); - assertTrue(output.contains(expectedSinglelineData) && output.contains(expectedMultilineData)); + assertTrue(output.contains(expectedMultilineData1) && output.contains(expectedMultilineData2)); } @Test(timeout=60000L) @@ -115,4 +116,4 @@ public void testJavaScriptInfoBlock() throws Exception{ assertFalse(output.contains("