You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2018/03/17 21:07:03 UTC

[4/5] maven-surefire git commit: [SUREFIRE-1490] Change header of the Failsafe Report

[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/be4e4c0c
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/be4e4c0c
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/be4e4c0c

Branch: refs/heads/SUREFIRE-1498
Commit: be4e4c0c773e47fafe598b5cb11473f89b35f3fc
Parents: bcd27b7
Author: Tibor17 <ti...@apache.org>
Authored: Wed Mar 7 02:43:37 2018 +0100
Committer: Tibor17 <ti...@apache.org>
Committed: Sat Mar 17 17:28:47 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 +-
 .../Surefire1490ReportTitleDescriptionIT.java   |  93 +++++++++++++++
 .../src/test/resources/surefire-1490/pom.xml    |  97 ++++++++++++++++
 .../src/test/java/it/Surefire1490IT.java        |  31 +++++
 .../src/test/java/it/Surefire1490Test.java      |  31 +++++
 13 files changed, 484 insertions(+), 103 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/be4e4c0c/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/be4e4c0c/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/be4e4c0c/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:tibordigana@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/be4e4c0c/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/be4e4c0c/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..3c93737 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.surefire.name" ) : SurefireReportMojo.this.getTitle();
+            }
+
+            @Override
+            public String getReportDescription()
+            {
+                return isEmpty( SurefireReportMojo.this.getDescription() )
+                        ? toLocalizedValue( "report.surefire.description" ) : SurefireReportMojo.this.getDescription();
+            }
+
+            @Override
+            public String getReportHeader()
+            {
+                return isEmpty( SurefireReportMojo.this.getTitle() )
+                        ? toLocalizedValue( "report.surefire.header" ) : SurefireReportMojo.this.getTitle();
+            }
+        };
+    }
+
+    @Override
     protected boolean isSkipped()
     {
         return skipSurefireReport;

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/be4e4c0c/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/be4e4c0c/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/be4e4c0c/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/be4e4c0c/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"

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/be4e4c0c/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1490ReportTitleDescriptionIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1490ReportTitleDescriptionIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1490ReportTitleDescriptionIT.java
new file mode 100644
index 0000000..289edec
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1490ReportTitleDescriptionIT.java
@@ -0,0 +1,93 @@
+package org.apache.maven.surefire.its.jiras;
+
+/*
+ * 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 org.apache.maven.surefire.its.fixture.OutputValidator;
+import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
+import org.apache.maven.surefire.its.fixture.SurefireLauncher;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:tibordigana@apache.org">Tibor Digana (tibor17)</a>
+ * @see <a href="https://issues.apache.org/jira/browse/SUREFIRE-1490">SUREFIRE-1490</a>
+ * @since 3.0.0-M1
+ */
+public class Surefire1490ReportTitleDescriptionIT
+        extends SurefireJUnit4IntegrationTestCase
+{
+    @Test
+    public void shouldHaveDefaultReportTitleAndDescription()
+    {
+        OutputValidator validator = unpack()
+                .addGoal( "verify" )
+                .execute( "site" )
+                .verifyErrorFreeLog();
+
+        validator.getSiteFile( "project-reports.html" )
+                .assertContainsText( "Surefire Report" )
+                .assertContainsText( "Report on the test results of the project." )
+                .assertContainsText( "Failsafe Report" )
+                .assertContainsText( "Report on the integration test results of the project." );
+
+        validator.getSiteFile( "failsafe-report.html" )
+                .assertContainsText( "Failsafe Report" )
+                .assertContainsText( "Surefire1490IT" );
+
+        validator.getSiteFile( "surefire-report.html" )
+                .assertContainsText( "Surefire Report" )
+                .assertContainsText( "Surefire1490Test" );
+    }
+
+    @Test
+    public void shouldHaveCustomizedReportTitleAndDescription()
+    {
+        OutputValidator validator = unpack()
+                .sysProp( "failsafe.report.title", "failsafe title" )
+                .sysProp( "failsafe.report.description", "failsafe desc" )
+                .sysProp( "surefire.report.title", "surefire title" )
+                .sysProp( "surefire.report.description", "surefire desc" )
+                .addGoal( "verify" )
+                .execute( "site" )
+                .verifyErrorFreeLog();
+
+        validator.getSiteFile( "project-reports.html" )
+                .assertContainsText( "surefire title" )
+                .assertContainsText( "surefire desc" )
+                .assertContainsText( "failsafe title" )
+                .assertContainsText( "failsafe desc" );
+
+        validator.getSiteFile( "failsafe-report.html" )
+                .assertContainsText( "failsafe title" )
+                .assertContainsText( "Surefire1490IT" );
+
+        validator.getSiteFile( "surefire-report.html" )
+                .assertContainsText( "surefire title" )
+                .assertContainsText( "Surefire1490Test" );
+    }
+
+    public SurefireLauncher unpack()
+    {
+        SurefireLauncher unpack = unpack( "surefire-1490" );
+        unpack.sysProp( "user.language", "en" )
+                .maven()
+                .execute( "clean" );
+        return unpack;
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/be4e4c0c/surefire-its/src/test/resources/surefire-1490/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/resources/surefire-1490/pom.xml b/surefire-its/src/test/resources/surefire-1490/pom.xml
new file mode 100644
index 0000000..8ec6244
--- /dev/null
+++ b/surefire-its/src/test/resources/surefire-1490/pom.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.maven.surefire</groupId>
+        <artifactId>it-parent</artifactId>
+        <version>1.0</version>
+    </parent>
+
+    <groupId>org.apache.maven.plugins.surefire</groupId>
+    <artifactId>surefire-1490</artifactId>
+    <version>1.0</version>
+
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.12</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-failsafe-plugin</artifactId>
+                <version>${surefire.version}</version>
+                <executions>
+                    <execution>
+                        <id>integration-tests</id>
+                        <goals>
+                            <goal>integration-test</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>verify-integration-tests</id>
+                        <goals>
+                            <goal>verify</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+    <reporting>
+        <plugins>
+            <plugin>
+                <artifactId>maven-surefire-report-plugin</artifactId>
+                <version>${surefire.version}</version>
+                <reportSets>
+                    <reportSet>
+                        <id>reports</id>
+                        <reports>
+                            <report>report-only</report>
+                            <report>failsafe-report-only</report>
+                        </reports>
+                    </reportSet>
+                </reportSets>
+            </plugin>
+            <plugin>
+                <artifactId>maven-project-info-reports-plugin</artifactId>
+                <version>2.9</version>
+                <reportSets>
+                    <reportSet>
+                        <reports>
+                            <report>index</report>
+                            <report>summary</report>
+                        </reports>
+                    </reportSet>
+                </reportSets>
+            </plugin>
+        </plugins>
+    </reporting>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/be4e4c0c/surefire-its/src/test/resources/surefire-1490/src/test/java/it/Surefire1490IT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/resources/surefire-1490/src/test/java/it/Surefire1490IT.java b/surefire-its/src/test/resources/surefire-1490/src/test/java/it/Surefire1490IT.java
new file mode 100644
index 0000000..2a6818d
--- /dev/null
+++ b/surefire-its/src/test/resources/surefire-1490/src/test/java/it/Surefire1490IT.java
@@ -0,0 +1,31 @@
+package it;
+
+/*
+ * 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 org.junit.Test;
+
+public class Surefire1490IT
+{
+    @Test
+    public void test()
+    {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/be4e4c0c/surefire-its/src/test/resources/surefire-1490/src/test/java/it/Surefire1490Test.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/resources/surefire-1490/src/test/java/it/Surefire1490Test.java b/surefire-its/src/test/resources/surefire-1490/src/test/java/it/Surefire1490Test.java
new file mode 100644
index 0000000..26de27f
--- /dev/null
+++ b/surefire-its/src/test/resources/surefire-1490/src/test/java/it/Surefire1490Test.java
@@ -0,0 +1,31 @@
+package it;
+
+/*
+ * 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 org.junit.Test;
+
+public class Surefire1490Test
+{
+    @Test
+    public void test()
+    {
+
+    }
+}