Skip to content

Commit

Permalink
Prepare for Doxia 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-o committed Oct 17, 2023
1 parent 0910b75 commit 4d3e185
Show file tree
Hide file tree
Showing 31 changed files with 415 additions and 168 deletions.
4 changes: 3 additions & 1 deletion maven-surefire-report-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
</prerequisites>

<properties>
<doxiaVersion>1.11.1</doxiaVersion>
<doxiaVersion>2.0.0-M8</doxiaVersion>
<aetherVersion>1.0.0.v20140518</aetherVersion>
</properties>

Expand Down Expand Up @@ -89,10 +89,12 @@
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-api</artifactId>
<version>4.0.0-M8</version>
</dependency>
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-impl</artifactId>
<version>4.0.0-M11</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,6 @@ public abstract class AbstractSurefireReportMojo extends AbstractMavenReport {
@Parameter
private File reportsDirectory;

/**
* The projects in the reactor for aggregation report.
*/
@Parameter(defaultValue = "${reactorProjects}", readonly = true)
private List<MavenProject> reactorProjects;

/**
* Location of the Xrefs to link.
*/
Expand Down Expand Up @@ -345,6 +339,10 @@ protected MavenProject getProject() {
return project;
}

protected List<MavenProject> getReactorProjects() {
return reactorProjects;
}

// TODO Review, especially Locale.getDefault()
private static class CustomI18N implements I18N {
private final MavenProject project;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,7 @@ private String formatI18nString(String section, String key, Object... args) {
public void renderBody() {
javaScript(javascriptToggleDisplayCode());

sink.section1();
sink.sectionTitle1();
sink.text(getTitle());
sink.sectionTitle1_();
sink.section1_();
startSection(getTitle());

renderSectionSummary();

Expand All @@ -125,16 +121,14 @@ public void renderBody() {
renderSectionTestCases();

renderSectionFailureDetails();

endSection();
}

private void renderSectionSummary() {
Map<String, Object> summary = parser.getSummary(testSuites);

sink.section1();
sinkAnchor("Summary");
sink.sectionTitle1();
sink.text(getI18nString("surefire", "label.summary"));
sink.sectionTitle1_();
startSection(getI18nString("surefire", "label.summary"), "Summary");

constructHotLinks();

Expand Down Expand Up @@ -168,7 +162,7 @@ private void renderSectionSummary() {

sink.lineBreak();

sink.section1_();
endSection();
}

private void renderSectionPackages() {
Expand All @@ -177,11 +171,7 @@ private void renderSectionPackages() {
return;
}

sink.section1();
sinkAnchor("Package_List");
sink.sectionTitle1();
sink.text(getI18nString("surefire", "label.packagelist"));
sink.sectionTitle1_();
startSection(getI18nString("surefire", "label.packagelist"), "Package_List");

constructHotLinks();

Expand Down Expand Up @@ -227,11 +217,7 @@ private void renderSectionPackages() {

List<ReportTestSuite> testSuiteList = entry.getValue();

sink.section2();
sinkAnchor(packageName);
sink.sectionTitle2();
sink.text(packageName);
sink.sectionTitle2_();
startSection(packageName);

boolean showTable = false;

Expand Down Expand Up @@ -266,12 +252,12 @@ private void renderSectionPackages() {
endTable();
}

sink.section2_();
endSection();
}

sink.lineBreak();

sink.section1_();
endSection();
}

private void renderSectionTestSuite(ReportTestSuite suite) {
Expand Down Expand Up @@ -320,23 +306,15 @@ private void renderSectionTestCases() {
return;
}

sink.section1();
sinkAnchor("Test_Cases");
sink.sectionTitle1();
sink.text(getI18nString("surefire", "label.testcases"));
sink.sectionTitle1_();
startSection(getI18nString("surefire", "label.testcases"), "Test_Cases");

constructHotLinks();

for (ReportTestSuite suite : testSuites) {
List<ReportTestCase> testCases = suite.getTestCases();

if (!testCases.isEmpty()) {
sink.section2();
sinkAnchor(suite.getPackageName() + '.' + suite.getName());
sink.sectionTitle2();
sink.text(suite.getName());
sink.sectionTitle2_();
startSection(suite.getName(), suite.getPackageName() + '.' + suite.getName());

boolean showTable = false;

Expand All @@ -360,13 +338,13 @@ private void renderSectionTestCases() {
endTable();
}

sink.section2_();
endSection();
}
}

sink.lineBreak();

sink.section1_();
endSection();
}

private void constructTestCaseSection(ReportTestCase testCase) {
Expand Down Expand Up @@ -469,7 +447,7 @@ private void constructTestCaseSection(ReportTestCase testCase) {
}

private String toHtmlId(String id) {
return DoxiaUtils.isValidId(id) ? id : DoxiaUtils.encodeId(id, true);
return DoxiaUtils.isValidId(id) ? id : DoxiaUtils.encodeId(id);
}

private void renderSectionFailureDetails() {
Expand All @@ -478,11 +456,7 @@ private void renderSectionFailureDetails() {
return;
}

sink.section1();
sinkAnchor("Failure_Details");
sink.sectionTitle1();
sink.text(getI18nString("surefire", "label.failuredetails"));
sink.sectionTitle1_();
startSection(getI18nString("surefire", "label.failuredetails"), "Failure_Details");

constructHotLinks();

Expand Down Expand Up @@ -554,7 +528,7 @@ private void renderSectionFailureDetails() {

sink.lineBreak();

sink.section1_();
endSection();
}

private void constructHotLinks() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(new JUnit4TestAdapter(Surefire597Test.class));
suite.addTest(new JUnit4TestAdapter(SurefireSchemaValidationTest.class));
suite.addTestSuite(SurefireReportMojoTest.class);
suite.addTestSuite(SurefireReportTest.class);
return suite;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void testCorruptedTestCaseFailureWithMissingErrorTypeAndMessage() throws
String xml = writer.toString();
assertThat(
xml,
containsString(toSystemNewLine("<table border=\"0\" class=\"bodyTable\">\n"
containsString(toSystemNewLine("<table class=\"bodyTable\">\n"
+ "<tr class=\"a\">\n"
+ "<th>Tests</th>\n"
+ "<th>Errors</th>\n"
Expand All @@ -62,7 +62,7 @@ public void testCorruptedTestCaseFailureWithMissingErrorTypeAndMessage() throws
+ "<th>Success Rate</th>\n"
+ "<th>Time</th></tr>\n"
+ "<tr class=\"b\">\n"
+ "<td align=\"left\">1</td>\n"
+ "<td>1</td>\n"
+ "<td>1</td>\n"
+ "<td>0</td>\n"
+ "<td>0</td>\n"
Expand All @@ -72,7 +72,7 @@ public void testCorruptedTestCaseFailureWithMissingErrorTypeAndMessage() throws
+ "</table>")));
assertThat(
xml,
containsString(toSystemNewLine("<table border=\"0\" class=\"bodyTable\">\n"
containsString(toSystemNewLine("<table class=\"bodyTable\">\n"
+ "<tr class=\"a\">\n"
+ "<th>Package</th>\n"
+ "<th>Tests</th>\n"
Expand All @@ -82,7 +82,7 @@ public void testCorruptedTestCaseFailureWithMissingErrorTypeAndMessage() throws
+ "<th>Success Rate</th>\n"
+ "<th>Time</th></tr>\n"
+ "<tr class=\"b\">\n"
+ "<td align=\"left\"><a href=\"#surefire\">surefire</a></td>\n"
+ "<td><a href=\"#surefire\">surefire</a></td>\n"
+ "<td>1</td>\n"
+ "<td>1</td>\n"
+ "<td>0</td>\n"
Expand All @@ -91,7 +91,7 @@ public void testCorruptedTestCaseFailureWithMissingErrorTypeAndMessage() throws
+ "<td>0 s</td></tr></table>")));
assertThat(
xml,
containsString(toSystemNewLine("<table border=\"0\" class=\"bodyTable\">\n"
containsString(toSystemNewLine("<table class=\"bodyTable\">\n"
+ "<tr class=\"a\">\n"
+ "<th>-</th>\n"
+ "<th>Class</th>\n"
Expand All @@ -102,7 +102,7 @@ public void testCorruptedTestCaseFailureWithMissingErrorTypeAndMessage() throws
+ "<th>Success Rate</th>\n"
+ "<th>Time</th></tr>\n"
+ "<tr class=\"b\">\n"
+ "<td align=\"left\"><a href=\"#surefire.MyTest\"><img src=\"images/icon_error_sml.gif\" alt=\"\" /></a></td>\n"
+ "<td><a href=\"#surefire.MyTest\"><img src=\"images/icon_error_sml.gif\" /></a></td>\n"
+ "<td><a href=\"#surefire.MyTest\">MyTest</a></td>\n"
+ "<td>1</td>\n"
+ "<td>1</td>\n"
Expand All @@ -112,15 +112,15 @@ public void testCorruptedTestCaseFailureWithMissingErrorTypeAndMessage() throws
+ "<td>0 s</td></tr></table>")));
assertThat(
xml,
containsString(toSystemNewLine("<table border=\"0\" class=\"bodyTable\">\n"
containsString(toSystemNewLine("<table class=\"bodyTable\">\n"
+ "<tr class=\"a\">\n"
+ "<td align=\"left\"><img src=\"images/icon_error_sml.gif\" alt=\"\" /></td>\n"
+ "<td><img src=\"images/icon_error_sml.gif\" /></td>\n"
+ "<td><a id=\"surefire.MyTest.test\"></a>test</td></tr>\n"
+ "<tr class=\"b\">\n"
+ "<td align=\"left\">-</td>\n"
+ "<td>-</td>\n"
+ "<td>java.lang.RuntimeException: java.lang.IndexOutOfBoundsException: msg</td></tr>\n"
+ "<tr class=\"a\">\n"
+ "<td align=\"left\">-</td>\n"
+ "<td>-</td>\n"
+ "<td>\n"
+ "<div id=\"test-error\">surefire.MyTest:13</div></td></tr></table>")));
}
Expand Down
Loading

0 comments on commit 4d3e185

Please sign in to comment.