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 May 7, 2023
1 parent 47b15d6 commit 0fd108f
Show file tree
Hide file tree
Showing 56 changed files with 445 additions and 225 deletions.
2 changes: 1 addition & 1 deletion maven-failsafe-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire</artifactId>
<version>3.1.1-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
</parent>

<groupId>org.apache.maven.plugins</groupId>
Expand Down
2 changes: 1 addition & 1 deletion maven-surefire-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire</artifactId>
<version>3.1.1-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
</parent>

<artifactId>maven-surefire-common</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-surefire-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire</artifactId>
<version>3.1.1-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
</parent>

<groupId>org.apache.maven.plugins</groupId>
Expand Down
6 changes: 4 additions & 2 deletions maven-surefire-report-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire</artifactId>
<version>3.1.1-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
</parent>

<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -46,7 +46,7 @@
</prerequisites>

<properties>
<doxiaVersion>1.11.1</doxiaVersion>
<doxiaVersion>2.0.0-M6</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-M6</version>
</dependency>
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-impl</artifactId>
<version>4.0.0-M8</version>
</dependency>
<dependency>
<groupId>org.fusesource.jansi</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,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 @@ -354,6 +348,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 @@ -103,11 +103,7 @@ private String getI18nString(String section, String key) {
public void renderBody() {
javaScript(javascriptToggleDisplayCode());

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

renderSectionSummary();

Expand All @@ -116,6 +112,8 @@ public void renderBody() {
renderSectionTestCases();

renderSectionFailureDetails();

endSection();
}

private void renderSectionSummary() {
Expand All @@ -124,11 +122,7 @@ private void renderSectionSummary() {
NumberFormat percentFormat = NumberFormat.getPercentInstance(locale);
percentFormat.setMinimumFractionDigits(1);

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 @@ -162,7 +156,7 @@ private void renderSectionSummary() {

sink.lineBreak();

sink.section1_();
endSection();
}

private void renderSectionPackages() {
Expand All @@ -175,11 +169,7 @@ private void renderSectionPackages() {
NumberFormat percentFormat = NumberFormat.getPercentInstance(locale);
percentFormat.setMinimumFractionDigits(1);

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

constructHotLinks();

Expand All @@ -205,7 +195,7 @@ private void renderSectionPackages() {
Map<String, Object> packageSummary = parser.getSummary(testSuiteList);

tableRow(new String[] {
'{' + packageName + ", #" + packageName + '}',
createLinkPatternedText(packageName, '#' + packageName),
String.valueOf(packageSummary.get("totalTests")),
String.valueOf(packageSummary.get("totalErrors")),
String.valueOf(packageSummary.get("totalFailures")),
Expand All @@ -225,11 +215,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 @@ -264,12 +250,12 @@ private void renderSectionPackages() {
endTable();
}

sink.section2_();
endSection();
}

sink.lineBreak();

sink.section1_();
endSection();
}

private void renderSectionTestSuite(ReportTestSuite suite) {
Expand Down Expand Up @@ -297,7 +283,7 @@ private void renderSectionTestSuite(ReportTestSuite suite) {

sink.tableCell_();

tableCell('{' + suite.getName() + ", #" + suite.getPackageName() + '.' + suite.getName() + '}');
tableCell(createLinkPatternedText( suite.getName(), '#' + suite.getPackageName() + '.' + suite.getName()));

tableCell(Integer.toString(suite.getNumberOfTests()));

Expand All @@ -322,23 +308,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 @@ -362,13 +340,13 @@ private void renderSectionTestCases() {
endTable();
}

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

sink.lineBreak();

sink.section1_();
endSection();
}

private void constructTestCaseSection(ReportTestCase testCase) {
Expand Down Expand Up @@ -460,7 +438,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 @@ -469,11 +447,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 @@ -540,7 +514,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

0 comments on commit 0fd108f

Please sign in to comment.