Repository: maven-surefire
Updated Branches:
  refs/heads/SUREFIRE-1490 [created] 8292ee534


[SUREFIRE-1490] Change header of the Failsafe Report


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/8292ee53
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/8292ee53
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/8292ee53

Branch: refs/heads/SUREFIRE-1490
Commit: 8292ee53404017213696b0727ec0eb2138ff22db
Parents: c10e717
Author: Tibor17 <tibordig...@apache.org>
Authored: Wed Mar 7 02:43:37 2018 +0100
Committer: Tibor17 <tibordig...@apache.org>
Committed: Wed Mar 7 02:43:37 2018 +0100

----------------------------------------------------------------------
 .../report/AbstractSurefireReportMojo.java      |  22 ++--
 .../surefire/report/FailsafeReportMojo.java     |  59 +++++-----
 .../surefire/report/LocalizedProperties.java    | 116 +++++++++++++++++++
 .../report/SurefireReportGenerator.java         |  90 ++++++--------
 .../surefire/report/SurefireReportMojo.java     |  33 ++++++
 .../main/resources/surefire-report.properties   |   3 +-
 .../resources/surefire-report_de.properties     |   1 +
 .../resources/surefire-report_sv.properties     |   1 +
 .../surefire/report/Surefire597Test.java        |  10 +-
 9 files changed, 232 insertions(+), 103 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/8292ee53/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/AbstractSurefireReportMojo.java
----------------------------------------------------------------------
diff --git 
a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/AbstractSurefireReportMojo.java
 
b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/AbstractSurefireReportMojo.java
index b6d4a9d..7c78936 100644
--- 
a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/AbstractSurefireReportMojo.java
+++ 
b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/AbstractSurefireReportMojo.java
@@ -24,7 +24,6 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
-import java.util.ResourceBundle;
 import org.apache.maven.model.ReportPlugin;
 import org.apache.maven.plugin.surefire.log.api.ConsoleLogger;
 import org.apache.maven.plugins.annotations.Parameter;
@@ -36,7 +35,6 @@ import org.apache.maven.shared.utils.PathTool;
 import static java.util.Collections.addAll;
 import static 
org.apache.maven.plugins.surefire.report.SurefireReportParser.hasReportFiles;
 import static org.apache.maven.shared.utils.StringUtils.isEmpty;
-import static org.apache.maven.shared.utils.StringUtils.isNotEmpty;
 
 /**
  * Abstract base class for reporting test results using Surefire.
@@ -136,7 +134,7 @@ public abstract class AbstractSurefireReportMojo
         }
 
         new SurefireReportGenerator( getReportsDirectories(), locale, 
showSuccess, determineXrefLocation(),
-                                           getConsoleLogger(), isNotEmpty( 
getTitle() ) ? getTitle() : null )
+                                           getConsoleLogger() )
                 .doGenerateReport( getBundle( locale ), getSink() );
     }
 
@@ -311,9 +309,7 @@ public abstract class AbstractSurefireReportMojo
     @Override
     public String getName( Locale locale )
     {
-        return isEmpty( getTitle() )
-                ? getBundle( locale ).getString( "report.surefire.name" )
-                : getTitle();
+        return getBundle( locale ).getReportName();
     }
 
     /**
@@ -322,9 +318,7 @@ public abstract class AbstractSurefireReportMojo
     @Override
     public String getDescription( Locale locale )
     {
-        return isEmpty( getDescription() )
-                ? getBundle( locale ).getString( "report.surefire.description" 
)
-                : getDescription();
+        return getBundle( locale ).getReportDescription();
     }
 
     /**
@@ -333,13 +327,15 @@ public abstract class AbstractSurefireReportMojo
     @Override
     public abstract String getOutputName();
 
-    private ResourceBundle getBundle( Locale locale )
-    {
-        return ResourceBundle.getBundle( "surefire-report", locale, 
getClass().getClassLoader() );
-    }
+    protected abstract LocalizedProperties getBundle( Locale locale, 
ClassLoader resourceBundleClassLoader );
 
     protected final ConsoleLogger getConsoleLogger()
     {
         return new PluginConsoleLogger( getLog() );
     }
+
+    final LocalizedProperties getBundle( Locale locale )
+    {
+        return getBundle( locale, getClass().getClassLoader() );
+    }
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/8292ee53/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/FailsafeReportMojo.java
----------------------------------------------------------------------
diff --git 
a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/FailsafeReportMojo.java
 
b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/FailsafeReportMojo.java
index 2dd7f2d..f534aa2 100644
--- 
a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/FailsafeReportMojo.java
+++ 
b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/FailsafeReportMojo.java
@@ -92,6 +92,34 @@ public class FailsafeReportMojo
     }
 
     @Override
+    protected LocalizedProperties getBundle( Locale locale, ClassLoader 
resourceBundleClassLoader )
+    {
+        ResourceBundle bundle = ResourceBundle.getBundle( "surefire-report", 
locale, resourceBundleClassLoader );
+        return new LocalizedProperties( bundle ) {
+            @Override
+            public String getReportName()
+            {
+                return isEmpty( FailsafeReportMojo.this.getTitle() )
+                        ? toLocalizedValue( "report.failsafe.name" ) : 
FailsafeReportMojo.this.getTitle();
+            }
+
+            @Override
+            public String getReportDescription()
+            {
+                return isEmpty( FailsafeReportMojo.this.getDescription() )
+                        ? toLocalizedValue( "report.failsafe.description" ) : 
FailsafeReportMojo.this.getDescription();
+            }
+
+            @Override
+            public String getReportHeader()
+            {
+                return isEmpty( FailsafeReportMojo.this.getTitle() )
+                        ? toLocalizedValue( "report.failsafe.header" ) : 
FailsafeReportMojo.this.getTitle();
+            }
+        };
+    }
+
+    @Override
     protected boolean isSkipped()
     {
         return skipFailsafeReport;
@@ -126,35 +154,4 @@ public class FailsafeReportMojo
     {
         return description;
     }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getName( Locale locale )
-    {
-        return isEmpty( getTitle() )
-                ? getBundle( locale ).getString( "report.failsafe.name" )
-                : getTitle();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getDescription( Locale locale )
-    {
-        return isEmpty( getDescription() )
-                ? getDescription()
-                : getBundle( locale ).getString( "report.failsafe.description" 
);
-    }
-
-    /*
-    * This is currently a copy of the getBundle() method of the 
AbstractSurefireReportMojo class,
-    * cause the failsafe report only different in two names for the bundles.
-    */
-    private ResourceBundle getBundle( Locale locale )
-    {
-        return ResourceBundle.getBundle( "surefire-report", locale, 
getClass().getClassLoader() );
-    }
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/8292ee53/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/LocalizedProperties.java
----------------------------------------------------------------------
diff --git 
a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/LocalizedProperties.java
 
b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/LocalizedProperties.java
new file mode 100644
index 0000000..d73dc5e
--- /dev/null
+++ 
b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/LocalizedProperties.java
@@ -0,0 +1,116 @@
+package org.apache.maven.plugins.surefire.report;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ResourceBundle;
+
+/**
+ * Surefire Resource Bundle.
+ *
+ * @author <a href="mailto:tibordig...@apache.org";>Tibor Digana (tibor17)</a>
+ */
+public abstract class LocalizedProperties
+{
+    private final ResourceBundle bundle;
+
+    protected LocalizedProperties( ResourceBundle bundle )
+    {
+        this.bundle = bundle;
+    }
+
+    public abstract String getReportName();
+    public abstract String getReportDescription();
+    public abstract String getReportHeader();
+
+    protected final String toLocalizedValue( String key )
+    {
+        return bundle.getString( key );
+    }
+
+    public String getReportLabelSummary()
+    {
+        return toLocalizedValue( "report.surefire.label.summary" );
+    }
+
+    public String getReportLabelTests()
+    {
+        return toLocalizedValue( "report.surefire.label.tests" );
+    }
+
+    public String getReportLabelErrors()
+    {
+        return toLocalizedValue( "report.surefire.label.errors" );
+    }
+
+    public String getReportLabelFailures()
+    {
+        return toLocalizedValue( "report.surefire.label.failures" );
+    }
+
+    public String getReportLabelSkipped()
+    {
+        return toLocalizedValue( "report.surefire.label.skipped" );
+    }
+
+    public String getReportLabelSuccessRate()
+    {
+        return toLocalizedValue( "report.surefire.label.successrate" );
+    }
+
+    public String getReportLabelTime()
+    {
+        return toLocalizedValue( "report.surefire.label.time" );
+    }
+
+    public String getReportLabelPackageList()
+    {
+        return toLocalizedValue( "report.surefire.label.packagelist" );
+    }
+
+    public String getReportLabelPackage()
+    {
+        return toLocalizedValue( "report.surefire.label.package" );
+    }
+
+    public String getReportLabelClass()
+    {
+        return toLocalizedValue( "report.surefire.label.class" );
+    }
+
+    public String getReportLabelTestCases()
+    {
+        return toLocalizedValue( "report.surefire.label.testcases" );
+    }
+
+    public String getReportLabelFailureDetails()
+    {
+        return toLocalizedValue( "report.surefire.label.failuredetails" );
+    }
+
+    public String getReportTextNode1()
+    {
+        return toLocalizedValue( "report.surefire.text.note1" );
+    }
+
+    public String getReportTextNode2()
+    {
+        return toLocalizedValue( "report.surefire.text.note2" );
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/8292ee53/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java
----------------------------------------------------------------------
diff --git 
a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java
 
b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java
index 5929f79..f9b9480 100644
--- 
a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java
+++ 
b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java
@@ -24,7 +24,6 @@ import java.text.NumberFormat;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
-import java.util.ResourceBundle;
 import org.apache.maven.doxia.markup.HtmlMarkup;
 import org.apache.maven.doxia.sink.Sink;
 import org.apache.maven.doxia.sink.SinkEventAttributeSet;
@@ -40,7 +39,6 @@ import static 
org.apache.maven.doxia.sink.SinkEventAttributes.ID;
 import static org.apache.maven.doxia.sink.SinkEventAttributes.NAME;
 import static org.apache.maven.doxia.sink.SinkEventAttributes.STYLE;
 import static org.apache.maven.doxia.sink.SinkEventAttributes.TYPE;
-import static org.apache.maven.shared.utils.StringUtils.isEmpty;
 
 /**
  * This generator creates HTML Report from Surefire and Failsafe XML Report.
@@ -48,35 +46,23 @@ import static 
org.apache.maven.shared.utils.StringUtils.isEmpty;
 public final class SurefireReportGenerator
 {
     private static final int LEFT = JUSTIFY_LEFT;
-
     private static final Object[] TAG_TYPE_START = { HtmlMarkup.TAG_TYPE_START 
};
-
     private static final Object[] TAG_TYPE_END = { HtmlMarkup.TAG_TYPE_END };
 
     private final SurefireReportParser report;
-
     private final boolean showSuccess;
-
     private final String xrefLocation;
-    private final String title;
     private List<ReportTestSuite> testSuites;
 
     public SurefireReportGenerator( List<File> reportsDirectories, Locale 
locale, boolean showSuccess,
-                                    String xrefLocation, ConsoleLogger 
consoleLogger, String title )
+                                    String xrefLocation, ConsoleLogger 
consoleLogger )
     {
         report = new SurefireReportParser( reportsDirectories, locale, 
consoleLogger );
         this.showSuccess = showSuccess;
         this.xrefLocation = xrefLocation;
-        this.title = title;
-    }
-
-    public SurefireReportGenerator( List<File> reportsDirectories, Locale 
locale, boolean showSuccess,
-                                    String xrefLocation, ConsoleLogger 
consoleLogger )
-    {
-        this( reportsDirectories, locale, showSuccess, xrefLocation, 
consoleLogger, null );
     }
 
-    public void doGenerateReport( ResourceBundle bundle, Sink sink )
+    public void doGenerateReport( LocalizedProperties bundle, Sink sink )
         throws MavenReportException
     {
         testSuites = report.parseXMLReportFiles();
@@ -84,7 +70,7 @@ public final class SurefireReportGenerator
         sink.head();
 
         sink.title();
-        sink.text( isEmpty( title ) ? bundle.getString( 
"report.surefire.header" ) : title );
+        sink.text( bundle.getReportHeader() );
         sink.title_();
 
         sink.head_();
@@ -99,7 +85,7 @@ public final class SurefireReportGenerator
 
         sink.section1();
         sink.sectionTitle1();
-        sink.text( isEmpty( title ) ? bundle.getString( 
"report.surefire.header" ) : title );
+        sink.text( bundle.getReportHeader() );
         sink.sectionTitle1_();
         sink.section1_();
 
@@ -129,13 +115,13 @@ public final class SurefireReportGenerator
         sink.close();
     }
 
-    private void constructSummarySection( ResourceBundle bundle, Sink sink )
+    private void constructSummarySection( LocalizedProperties bundle, Sink 
sink )
     {
         Map<String, String> summary = report.getSummary( testSuites );
 
         sink.section1();
         sink.sectionTitle1();
-        sink.text( bundle.getString( "report.surefire.label.summary" ) );
+        sink.text( bundle.getReportLabelSummary() );
         sink.sectionTitle1_();
 
         sinkAnchor( sink, "Summary" );
@@ -150,17 +136,17 @@ public final class SurefireReportGenerator
 
         sink.tableRow();
 
-        sinkHeader( sink, bundle.getString( "report.surefire.label.tests" ) );
+        sinkHeader( sink, bundle.getReportLabelTests() );
 
-        sinkHeader( sink, bundle.getString( "report.surefire.label.errors" ) );
+        sinkHeader( sink, bundle.getReportLabelErrors() );
 
-        sinkHeader( sink, bundle.getString( "report.surefire.label.failures" ) 
);
+        sinkHeader( sink, bundle.getReportLabelFailures() );
 
-        sinkHeader( sink, bundle.getString( "report.surefire.label.skipped" ) 
);
+        sinkHeader( sink, bundle.getReportLabelSkipped() );
 
-        sinkHeader( sink, bundle.getString( 
"report.surefire.label.successrate" ) );
+        sinkHeader( sink, bundle.getReportLabelSuccessRate() );
 
-        sinkHeader( sink, bundle.getString( "report.surefire.label.time" ) );
+        sinkHeader( sink, bundle.getReportLabelTime() );
 
         sink.tableRow_();
 
@@ -187,7 +173,7 @@ public final class SurefireReportGenerator
         sink.lineBreak();
 
         sink.paragraph();
-        sink.text( bundle.getString( "report.surefire.text.note1" ) );
+        sink.text( bundle.getReportTextNode1() );
         sink.paragraph_();
 
         sinkLineBreak( sink );
@@ -195,14 +181,14 @@ public final class SurefireReportGenerator
         sink.section1_();
     }
 
-    private void constructPackagesSection( ResourceBundle bundle, Sink sink,
+    private void constructPackagesSection( LocalizedProperties bundle, Sink 
sink,
                                            Map<String, List<ReportTestSuite>> 
suitePackages )
     {
         NumberFormat numberFormat = report.getNumberFormat();
 
         sink.section1();
         sink.sectionTitle1();
-        sink.text( bundle.getString( "report.surefire.label.packagelist" ) );
+        sink.text( bundle.getReportLabelPackageList() );
         sink.sectionTitle1_();
 
         sinkAnchor( sink, "Package_List" );
@@ -217,19 +203,19 @@ public final class SurefireReportGenerator
 
         sink.tableRow();
 
-        sinkHeader( sink, bundle.getString( "report.surefire.label.package" ) 
);
+        sinkHeader( sink, bundle.getReportLabelPackage() );
 
-        sinkHeader( sink, bundle.getString( "report.surefire.label.tests" ) );
+        sinkHeader( sink, bundle.getReportLabelTests() );
 
-        sinkHeader( sink, bundle.getString( "report.surefire.label.errors" ) );
+        sinkHeader( sink, bundle.getReportLabelErrors() );
 
-        sinkHeader( sink, bundle.getString( "report.surefire.label.failures" ) 
);
+        sinkHeader( sink, bundle.getReportLabelFailures() );
 
-        sinkHeader( sink, bundle.getString( "report.surefire.label.skipped" ) 
);
+        sinkHeader( sink, bundle.getReportLabelSkipped() );
 
-        sinkHeader( sink, bundle.getString( 
"report.surefire.label.successrate" ) );
+        sinkHeader( sink, bundle.getReportLabelSuccessRate() );
 
-        sinkHeader( sink, bundle.getString( "report.surefire.label.time" ) );
+        sinkHeader( sink, bundle.getReportLabelTime() );
 
         sink.tableRow_();
 
@@ -267,7 +253,7 @@ public final class SurefireReportGenerator
         sink.lineBreak();
 
         sink.paragraph();
-        sink.text( bundle.getString( "report.surefire.text.note2" ) );
+        sink.text( bundle.getReportTextNode2() );
         sink.paragraph_();
 
         for ( Map.Entry<String, List<ReportTestSuite>> entry : 
suitePackages.entrySet() )
@@ -305,19 +291,19 @@ public final class SurefireReportGenerator
 
                 sinkHeader( sink, "" );
 
-                sinkHeader( sink, bundle.getString( 
"report.surefire.label.class" ) );
+                sinkHeader( sink, bundle.getReportLabelClass() );
 
-                sinkHeader( sink, bundle.getString( 
"report.surefire.label.tests" ) );
+                sinkHeader( sink, bundle.getReportLabelTests() );
 
-                sinkHeader( sink, bundle.getString( 
"report.surefire.label.errors" ) );
+                sinkHeader( sink, bundle.getReportLabelErrors() );
 
-                sinkHeader( sink, bundle.getString( 
"report.surefire.label.failures" ) );
+                sinkHeader( sink, bundle.getReportLabelFailures() );
 
-                sinkHeader( sink, bundle.getString( 
"report.surefire.label.skipped" ) );
+                sinkHeader( sink, bundle.getReportLabelSkipped() );
 
-                sinkHeader( sink, bundle.getString( 
"report.surefire.label.successrate" ) );
+                sinkHeader( sink, bundle.getReportLabelSuccessRate() );
 
-                sinkHeader( sink, bundle.getString( 
"report.surefire.label.time" ) );
+                sinkHeader( sink, bundle.getReportLabelTime() );
 
                 sink.tableRow_();
 
@@ -390,13 +376,13 @@ public final class SurefireReportGenerator
         sink.tableRow_();
     }
 
-    private void constructTestCasesSection( ResourceBundle bundle, Sink sink )
+    private void constructTestCasesSection( LocalizedProperties bundle, Sink 
sink )
     {
         NumberFormat numberFormat = report.getNumberFormat();
 
         sink.section1();
         sink.sectionTitle1();
-        sink.text( bundle.getString( "report.surefire.label.testcases" ) );
+        sink.text( bundle.getReportLabelTestCases() );
         sink.sectionTitle1_();
 
         sinkAnchor( sink, "Test_Cases" );
@@ -562,11 +548,11 @@ public final class SurefireReportGenerator
         return DoxiaUtils.isValidId( id ) ? id : DoxiaUtils.encodeId( id, true 
);
     }
 
-    private void constructFailureDetails( Sink sink, ResourceBundle bundle, 
List<ReportTestCase> failures )
+    private void constructFailureDetails( Sink sink, LocalizedProperties 
bundle, List<ReportTestCase> failures )
     {
         sink.section1();
         sink.sectionTitle1();
-        sink.text( bundle.getString( "report.surefire.label.failuredetails" ) 
);
+        sink.text( bundle.getReportLabelFailureDetails() );
         sink.sectionTitle1_();
 
         sinkAnchor( sink, "Failure_Details" );
@@ -647,22 +633,22 @@ public final class SurefireReportGenerator
         sink.section1_();
     }
 
-    private void constructHotLinks( Sink sink, ResourceBundle bundle )
+    private void constructHotLinks( Sink sink, LocalizedProperties bundle )
     {
         if ( !testSuites.isEmpty() )
         {
             sink.paragraph();
 
             sink.text( "[" );
-            sinkLink( sink, bundle.getString( "report.surefire.label.summary" 
), "#Summary" );
+            sinkLink( sink, bundle.getReportLabelSummary(), "#Summary" );
             sink.text( "]" );
 
             sink.text( " [" );
-            sinkLink( sink, bundle.getString( 
"report.surefire.label.packagelist" ), "#Package_List" );
+            sinkLink( sink, bundle.getReportLabelPackageList(), 
"#Package_List" );
             sink.text( "]" );
 
             sink.text( " [" );
-            sinkLink( sink, bundle.getString( 
"report.surefire.label.testcases" ), "#Test_Cases" );
+            sinkLink( sink, bundle.getReportLabelTestCases(), "#Test_Cases" );
             sink.text( "]" );
 
             sink.paragraph_();

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/8292ee53/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java
----------------------------------------------------------------------
diff --git 
a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java
 
b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java
index 2329095..5da1aa4 100644
--- 
a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java
+++ 
b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java
@@ -20,12 +20,17 @@ package org.apache.maven.plugins.surefire.report;
  */
 
 import java.io.File;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
 import org.apache.maven.plugins.annotations.Execute;
 import org.apache.maven.plugins.annotations.LifecyclePhase;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.project.MavenProject;
 
+import static org.apache.maven.shared.utils.StringUtils.isEmpty;
+
 /**
  * Creates a nicely formatted Surefire Test Report in html format.
  *
@@ -87,6 +92,34 @@ public class SurefireReportMojo
     }
 
     @Override
+    protected LocalizedProperties getBundle( Locale locale, ClassLoader 
resourceBundleClassLoader )
+    {
+        ResourceBundle bundle = ResourceBundle.getBundle( "surefire-report", 
locale, resourceBundleClassLoader );
+        return new LocalizedProperties( bundle ) {
+            @Override
+            public String getReportName()
+            {
+                return isEmpty( SurefireReportMojo.this.getTitle() )
+                        ? toLocalizedValue( "report.failsafe.name" ) : 
SurefireReportMojo.this.getTitle();
+            }
+
+            @Override
+            public String getReportDescription()
+            {
+                return isEmpty( SurefireReportMojo.this.getDescription() )
+                        ? toLocalizedValue( "report.failsafe.description" ) : 
SurefireReportMojo.this.getDescription();
+            }
+
+            @Override
+            public String getReportHeader()
+            {
+                return isEmpty( SurefireReportMojo.this.getTitle() )
+                        ? toLocalizedValue( "report.failsafe.header" ) : 
SurefireReportMojo.this.getTitle();
+            }
+        };
+    }
+
+    @Override
     protected boolean isSkipped()
     {
         return skipSurefireReport;

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/8292ee53/maven-surefire-report-plugin/src/main/resources/surefire-report.properties
----------------------------------------------------------------------
diff --git 
a/maven-surefire-report-plugin/src/main/resources/surefire-report.properties 
b/maven-surefire-report-plugin/src/main/resources/surefire-report.properties
index f2f65c6..8aa256e 100644
--- a/maven-surefire-report-plugin/src/main/resources/surefire-report.properties
+++ b/maven-surefire-report-plugin/src/main/resources/surefire-report.properties
@@ -22,7 +22,7 @@ report.surefire.description=Report on the test results of the 
project.
 report.surefire.header=Surefire Report
 report.surefire.label.summary=Summary
 report.surefire.label.tests=Tests
-report.surefire.label.errors=Errors 
+report.surefire.label.errors=Errors
 report.surefire.label.failures=Failures
 report.surefire.label.skipped=Skipped
 report.surefire.label.successrate=Success Rate
@@ -37,3 +37,4 @@ report.surefire.text.note2=Note: package statistics are not 
computed recursively
 
 report.failsafe.name=Failsafe Report
 report.failsafe.description=Report on the integration test results of the 
project.
+report.failsafe.header=Failsafe Report

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/8292ee53/maven-surefire-report-plugin/src/main/resources/surefire-report_de.properties
----------------------------------------------------------------------
diff --git 
a/maven-surefire-report-plugin/src/main/resources/surefire-report_de.properties 
b/maven-surefire-report-plugin/src/main/resources/surefire-report_de.properties
index cde7830..baff5db 100644
--- 
a/maven-surefire-report-plugin/src/main/resources/surefire-report_de.properties
+++ 
b/maven-surefire-report-plugin/src/main/resources/surefire-report_de.properties
@@ -37,3 +37,4 @@ report.surefire.text.note2 =Hinweis: Die Paketstatistiken 
werden nicht rekursiv
 
 report.failsafe.name=Failsafe Bericht
 report.failsafe.description=Bericht \u00FCber die Integrationstestresultate 
des Projekts.
+report.failsafe.header=Failsafe Bericht

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/8292ee53/maven-surefire-report-plugin/src/main/resources/surefire-report_sv.properties
----------------------------------------------------------------------
diff --git 
a/maven-surefire-report-plugin/src/main/resources/surefire-report_sv.properties 
b/maven-surefire-report-plugin/src/main/resources/surefire-report_sv.properties
index 3664c6b..5e3bcbe 100644
--- 
a/maven-surefire-report-plugin/src/main/resources/surefire-report_sv.properties
+++ 
b/maven-surefire-report-plugin/src/main/resources/surefire-report_sv.properties
@@ -37,3 +37,4 @@ report.surefire.text.note2=Notera: paketstatistiken 
ber\u00e4knas inte rekursivt
 
 report.failsafe.name=Failsafe-rapport
 report.failsafe.description=Rapport om integration testresultaten f\u00f6r 
projektet.
+report.failsafe.header=Failsafe-rapport

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/8292ee53/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire597Test.java
----------------------------------------------------------------------
diff --git 
a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire597Test.java
 
b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire597Test.java
index 4d75a30..02af6c4 100644
--- 
a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire597Test.java
+++ 
b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire597Test.java
@@ -26,7 +26,6 @@ import org.junit.Test;
 
 import java.io.File;
 import java.io.StringWriter;
-import java.util.ResourceBundle;
 
 import static java.util.Collections.singletonList;
 import static java.util.Locale.ENGLISH;
@@ -47,15 +46,14 @@ public class Surefire597Test
         File report = new File( basedir, "target/test-classes/surefire-597" );
         ConsoleLogger log = new NullConsoleLogger();
         SurefireReportGenerator gen = new SurefireReportGenerator( 
singletonList( report ), ENGLISH, true, null, log );
-        ResourceBundle resourceBundle = ResourceBundle.getBundle( 
"surefire-report", ENGLISH );
         StringWriter writer = new StringWriter();
-        gen.doGenerateReport( resourceBundle, new XhtmlSink( writer ) {} );
+        gen.doGenerateReport( new SurefireReportMojo().getBundle( ENGLISH ), 
new XhtmlSink( writer ) {} );
         String xml = writer.toString();
         assertThat( xml, containsString( toSystemNewLine(
             "<table border=\"1\" class=\"bodyTable\">\n"
                 + "<tr class=\"a\">\n"
                 + "<th>Tests</th>\n"
-                + "<th>Errors </th>\n"
+                + "<th>Errors</th>\n"
                 + "<th>Failures</th>\n"
                 + "<th>Skipped</th>\n"
                 + "<th>Success Rate</th>\n"
@@ -74,7 +72,7 @@ public class Surefire597Test
                 + "<tr class=\"a\">\n"
                 + "<th>Package</th>\n"
                 + "<th>Tests</th>\n"
-                + "<th>Errors </th>\n"
+                + "<th>Errors</th>\n"
                 + "<th>Failures</th>\n"
                 + "<th>Skipped</th>\n"
                 + "<th>Success Rate</th>\n"
@@ -93,7 +91,7 @@ public class Surefire597Test
                 + "<th></th>\n"
                 + "<th>Class</th>\n"
                 + "<th>Tests</th>\n"
-                + "<th>Errors </th>\n"
+                + "<th>Errors</th>\n"
                 + "<th>Failures</th>\n"
                 + "<th>Skipped</th>\n"
                 + "<th>Success Rate</th>\n"

Reply via email to