You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2022/12/21 19:54:53 UTC

[maven-surefire] branch fix-report-tests updated (28d3b962b -> 1218cf82d)

This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a change to branch fix-report-tests
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git


 discard 28d3b962b FIX
 discard a77713723 Fixes
 discard 320b27e0b More fixes
 discard e44ae1f5c add remoe repo
 discard 129b18d64 Fix failing maven-surefire-report-plugin tests
     new 1218cf82d [SUREFIRE-2129] Upgrade Maven Reporting API to 3.1.1/Maven Reporting Impl to 3.2.0

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (28d3b962b)
            \
             N -- N -- N   refs/heads/fix-report-tests (1218cf82d)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:


[maven-surefire] 01/01: [SUREFIRE-2129] Upgrade Maven Reporting API to 3.1.1/Maven Reporting Impl to 3.2.0

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch fix-report-tests
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git

commit 1218cf82d206d7644f2fd010ec8a045e0f6abaf8
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Wed Dec 21 14:50:54 2022 +0100

    [SUREFIRE-2129] Upgrade Maven Reporting API to 3.1.1/Maven Reporting Impl to 3.2.0
    
    Align tests and make them pass.
    
    This closes #586
---
 maven-surefire-report-plugin/pom.xml               |  31 +++++
 .../report/AbstractSurefireReportMojo.java         |  10 +-
 .../plugins/surefire/report/JUnit4SuiteTest.java   |   1 -
 .../plugins/surefire/report/Surefire1183Test.java  | 122 -----------------
 .../plugins/surefire/report/Surefire597Test.java   |   2 +-
 .../surefire/report/SurefireReportMojoTest.java    | 145 ++++++++++-----------
 .../stubs/DependencyArtifactStubFactory.java       |  73 +++++++++++
 .../report/stubs/SurefireRepMavenProjectStub.java  |  17 +++
 .../plugin-config.xml                              |   1 +
 .../plugin-config.xml                              |   1 +
 .../plugin-config.xml                              |   1 +
 .../plugin-config.xml                              |   1 +
 .../basic-surefire-report-test/plugin-config.xml   |   1 +
 .../TEST-com.shape.CircleTest.xml                  |   0
 .../{ => unit}/surefire-1183/plugin-config.xml     |   5 +-
 .../plugin-config.xml                              |   1 +
 .../surefire-report-enclosed/plugin-config.xml     |   1 +
 .../plugin-config.xml                              |   1 +
 .../surefire-report-nestedClass/plugin-config.xml  |   1 +
 .../surefire-report-single-error/plugin-config.xml |   1 +
 20 files changed, 214 insertions(+), 202 deletions(-)

diff --git a/maven-surefire-report-plugin/pom.xml b/maven-surefire-report-plugin/pom.xml
index b48f894dd..486a5b926 100644
--- a/maven-surefire-report-plugin/pom.xml
+++ b/maven-surefire-report-plugin/pom.xml
@@ -48,6 +48,7 @@
 
     <properties>
       <doxiaVersion>1.11.1</doxiaVersion>
+      <aetherVersion>1.0.0.v20140518</aetherVersion>
     </properties>
 
     <dependencies>
@@ -119,6 +120,36 @@
             <artifactId>xmlunit-core</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+          <groupId>org.eclipse.aether</groupId>
+          <artifactId>aether-impl</artifactId>
+          <version>${aetherVersion}</version>
+          <scope>test</scope>
+        </dependency>
+        <dependency>
+          <groupId>org.eclipse.aether</groupId>
+          <artifactId>aether-connector-basic</artifactId>
+          <version>${aetherVersion}</version>
+          <scope>test</scope>
+        </dependency>
+        <dependency>
+          <groupId>org.eclipse.aether</groupId>
+          <artifactId>aether-transport-wagon</artifactId>
+          <version>${aetherVersion}</version>
+          <scope>test</scope>
+        </dependency>
+        <dependency>
+          <groupId>org.apache.maven.wagon</groupId>
+          <artifactId>wagon-http-lightweight</artifactId>
+          <version>3.5.1</version>
+          <scope>test</scope>
+        </dependency>
+        <dependency>
+          <groupId>org.slf4j</groupId>
+          <artifactId>slf4j-simple</artifactId>
+          <version>1.7.36</version>
+          <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>
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 2773f0dbd..ae69f181a 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
@@ -206,8 +206,8 @@ public abstract class AbstractSurefireReportMojo
                     {
                         resolvedReportsDirectories.add( getSurefireReportsDirectory( mavenProject ) );
                     }
-                } 
-                else 
+                }
+                else
                 {
                     resolvedReportsDirectories.add( getSurefireReportsDirectory( project ) );
                 }
@@ -345,4 +345,10 @@ public abstract class AbstractSurefireReportMojo
     {
         return getBundle( locale, getClass().getClassLoader() );
     }
+
+    @Override
+    protected MavenProject getProject()
+    {
+        return project;
+    }
 }
diff --git a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/JUnit4SuiteTest.java b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/JUnit4SuiteTest.java
index bcf63cb3d..13b03e785 100644
--- a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/JUnit4SuiteTest.java
+++ b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/JUnit4SuiteTest.java
@@ -37,7 +37,6 @@ public class JUnit4SuiteTest extends TestCase
         TestSuite suite = new TestSuite();
         suite.addTest( new JUnit4TestAdapter( Surefire597Test.class ) );
         suite.addTest( new JUnit4TestAdapter( SurefireSchemaValidationTest.class ) );
-        suite.addTestSuite( Surefire1183Test.class );
         suite.addTestSuite( SurefireReportMojoTest.class );
         return suite;
     }
diff --git a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire1183Test.java b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire1183Test.java
deleted file mode 100644
index 2ce686d99..000000000
--- a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire1183Test.java
+++ /dev/null
@@ -1,122 +0,0 @@
-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 org.apache.maven.doxia.site.decoration.DecorationModel;
-import org.apache.maven.doxia.siterenderer.Renderer;
-import org.apache.maven.doxia.siterenderer.RendererException;
-import org.apache.maven.doxia.siterenderer.SiteRenderingContext;
-import org.apache.maven.doxia.siterenderer.sink.SiteRendererSink;
-import org.apache.maven.plugin.testing.AbstractMojoTestCase;
-import org.apache.maven.shared.utils.WriterFactory;
-import org.apache.maven.shared.utils.io.FileUtils;
-import org.apache.maven.shared.utils.io.IOUtil;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-import java.net.URL;
-import java.net.URLDecoder;
-import java.util.Locale;
-
-/**
- * Prevent fom NPE if failure type and message is null however detail presents.
- */
-public class Surefire1183Test extends AbstractMojoTestCase
-{
-    private Renderer renderer;
-
-    @Override
-    protected void setUp()
-            throws Exception
-    {
-        super.setUp();
-        renderer = (Renderer) lookup( Renderer.ROLE );
-    }
-
-    private File getTestBaseDir()
-            throws UnsupportedEncodingException
-    {
-        URL resource = getClass().getResource( "/surefire-1183" );
-        // URLDecoder.decode necessary for JDK 1.5+, where spaces are escaped to %20
-        return new File( URLDecoder.decode ( resource.getPath(), "UTF-8" ) ).getAbsoluteFile();
-    }
-
-    /**
-     * Renderer the sink from the report mojo.
-     *
-     * @param mojo       not null
-     * @param outputHtml not null
-     * @throws RendererException if any
-     * @throws IOException       if any
-     */
-    private void renderer( SurefireReportMojo mojo, File outputHtml )
-            throws RendererException, IOException
-    {
-        Writer writer = null;
-        SiteRenderingContext context = new SiteRenderingContext();
-        context.setDecoration( new DecorationModel() );
-        context.setTemplateName( "org/apache/maven/doxia/siterenderer/resources/default-site.vm" );
-        context.setLocale( Locale.ENGLISH );
-
-        try
-        {
-            outputHtml.getParentFile().mkdirs();
-            writer = WriterFactory.newXmlWriter ( outputHtml );
-
-            renderer.generateDocument( writer, (SiteRendererSink ) mojo.getSink(), context );
-        }
-        finally
-        {
-            IOUtil.close ( writer );
-        }
-    }
-
-    public void testCustomTitleAndDescriptionReport()
-            throws Exception
-    {
-        File testPom = new File( getTestBaseDir(), "plugin-config.xml" );
-        SurefireReportMojo mojo = (SurefireReportMojo) lookupMojo( "report", testPom );
-
-        File outputDir = (File) getVariableValueFromObject( mojo, "outputDirectory" );
-        String outputName = (String) getVariableValueFromObject( mojo, "outputName" );
-        File reportsDir = (File) getVariableValueFromObject( mojo, "reportsDirectory" );
-        String title = (String) getVariableValueFromObject( mojo, "title" );
-        String description = (String) getVariableValueFromObject( mojo, "description" );
-
-        assertEquals( new File( getBasedir() + "/target/site/surefire-1183" ), outputDir );
-        assertEquals( new File( getBasedir() + "/src/test/resources/surefire-1183/acceptancetest-reports" )
-                        .getAbsolutePath(), reportsDir.getAbsolutePath() );
-        assertEquals( "acceptance-test-report", outputName );
-        assertEquals( "Acceptance Test", title );
-        assertEquals( "Acceptance Test Description", description );
-
-        mojo.execute();
-
-        File report = new File( getBasedir(), "target/site/acceptance-test-report.html" );
-        renderer( mojo, report );
-
-        assertTrue( report.exists() );
-
-        String htmlContent = FileUtils.fileRead ( report );
-        assertTrue( htmlContent.contains ( "<h2><a name=\"Acceptance_Test\"></a>Acceptance Test</h2></section>" ) );
-    }
-}
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 389187187..95075a8ef 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
@@ -113,7 +113,7 @@ public class Surefire597Test
             "<table border=\"1\" class=\"bodyTable\">\n"
                 + "<tr class=\"a\">\n"
                 + "<td align=\"left\"><figure><img src=\"images/icon_error_sml.gif\" alt=\"\" /></figure></td>\n"
-                + "<td align=\"left\"><a name=\"surefire.MyTest.test\"></a>test</td></tr>\n"
+                + "<td align=\"left\"><a id=\"surefire.MyTest.test\"></a>test</td></tr>\n"
                 + "<tr class=\"b\">\n"
                 + "<td align=\"left\"></td>\n"
                 + "<td align=\"left\">java.lang.RuntimeException: java.lang.IndexOutOfBoundsException: msg</td></tr>\n"
diff --git a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportMojoTest.java b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportMojoTest.java
index d0cde71ad..548bf911d 100644
--- a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportMojoTest.java
+++ b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportMojoTest.java
@@ -32,10 +32,17 @@ import org.apache.maven.doxia.siterenderer.Renderer;
 import org.apache.maven.doxia.siterenderer.RendererException;
 import org.apache.maven.doxia.siterenderer.SiteRenderingContext;
 import org.apache.maven.doxia.siterenderer.sink.SiteRendererSink;
+import org.apache.maven.plugin.LegacySupport;
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+import org.apache.maven.plugin.testing.ArtifactStubFactory;
+import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+import org.apache.maven.plugins.surefire.report.stubs.DependencyArtifactStubFactory;
 import org.apache.maven.shared.utils.WriterFactory;
 import org.apache.maven.shared.utils.io.FileUtils;
 import org.apache.maven.shared.utils.io.IOUtil;
+import org.eclipse.aether.DefaultRepositorySystemSession;
+import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory;
+import org.eclipse.aether.repository.LocalRepository;
 
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.CoreMatchers.containsString;
@@ -48,6 +55,8 @@ import static org.apache.maven.plugins.surefire.report.Utils.toSystemNewLine;
 public class SurefireReportMojoTest
     extends AbstractMojoTestCase
 {
+    private ArtifactStubFactory artifactStubFactory;
+
     private Renderer renderer;
 
     @Override
@@ -56,56 +65,58 @@ public class SurefireReportMojoTest
     {
         super.setUp();
         renderer = (Renderer) lookup( Renderer.ROLE );
+
+        artifactStubFactory = new DependencyArtifactStubFactory( getTestFile( "target" ), true, false );
+        artifactStubFactory.getWorkingDir().mkdirs();
+    }
+
+    protected SurefireReportMojo createReportMojo( File pluginXmlFile )
+        throws Exception
+    {
+        SurefireReportMojo mojo = (SurefireReportMojo) lookupMojo( "report", pluginXmlFile );
+        assertNotNull( "Mojo found.", mojo );
+
+        LegacySupport legacySupport = lookup( LegacySupport.class );
+        legacySupport.setSession( newMavenSession( new MavenProjectStub() ) );
+        DefaultRepositorySystemSession repoSession =
+            (DefaultRepositorySystemSession) legacySupport.getRepositorySession();
+        repoSession.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory().newInstance( repoSession, new LocalRepository( artifactStubFactory.getWorkingDir() ) ) );
+
+        //setVariableValueToObject( mojo, "session", legacySupport.getSession() );
+        setVariableValueToObject( mojo, "remoteRepositories", mojo.getProject().getRemoteArtifactRepositories() );
+        return mojo;
     }
 
     public void testBasicSurefireReport()
         throws Exception
     {
         File testPom = new File( getUnitBaseDir(), "basic-surefire-report-test/plugin-config.xml" );
-
-        SurefireReportMojo mojo = (SurefireReportMojo) lookupMojo( "report", testPom );
-
-        assertNotNull( mojo );
-
+        SurefireReportMojo mojo = createReportMojo( testPom );
         File outputDir = (File) getVariableValueFromObject( mojo, "outputDirectory" );
-
         boolean showSuccess = (Boolean) getVariableValueFromObject( mojo, "showSuccess" );
-
         File reportsDir = (File) getVariableValueFromObject( mojo, "reportsDirectory" );
-
         String outputName = (String) getVariableValueFromObject( mojo, "outputName" );
-
         File xrefLocation = (File) getVariableValueFromObject( mojo, "xrefLocation" );
-
         boolean linkXRef = (Boolean) getVariableValueFromObject( mojo, "linkXRef" );
 
         assertEquals( new File( getBasedir() + "/target/site/unit/basic-surefire-report-test" ), outputDir );
-
         assertTrue( showSuccess );
-
         assertEquals( new File(
             getBasedir() + "/src/test/resources/unit/basic-surefire-report-test/surefire-reports" ).getAbsolutePath(),
                       reportsDir.getAbsolutePath() );
-
         assertEquals( "surefire-report", outputName );
         assertEquals(
             new File( getBasedir() + "/target/site/unit/basic-surefire-report-test/xref-test" ).getAbsolutePath(),
             xrefLocation.getAbsolutePath() );
-
         assertTrue( linkXRef );
 
         mojo.execute();
-
         File report = new File( getBasedir(), "target/site/unit/basic-surefire-report-test/surefire-report.html" );
-
         renderer( mojo, report );
-
         assertTrue( report.exists() );
-
         String htmlContent = FileUtils.fileRead( report );
 
         int idx = htmlContent.indexOf( "images/icon_success_sml.gif" );
-
         assertTrue( idx >= 0 );
     }
 
@@ -121,28 +132,17 @@ public class SurefireReportMojoTest
         throws Exception
     {
         File testPom = new File( getUnitBaseDir(), "basic-surefire-report-success-false/plugin-config.xml" );
-
-        SurefireReportMojo mojo = (SurefireReportMojo) lookupMojo( "report", testPom );
-
-        assertNotNull( mojo );
-
+        SurefireReportMojo mojo = createReportMojo( testPom );
         boolean showSuccess = (Boolean) getVariableValueFromObject( mojo, "showSuccess" );
-
         assertFalse( showSuccess );
-
         mojo.execute();
-
         File report =
             new File( getBasedir(), "target/site/unit/basic-surefire-report-success-false/surefire-report.html" );
-
         renderer( mojo, report );
-
         assertTrue( report.exists() );
-
         String htmlContent = FileUtils.fileRead( report );
 
         int idx = htmlContent.indexOf( "images/icon_success_sml.gif" );
-
         assertTrue( idx < 0 );
     }
 
@@ -150,28 +150,17 @@ public class SurefireReportMojoTest
         throws Exception
     {
         File testPom = new File( getUnitBaseDir(), "basic-surefire-report-linkxref-false/plugin-config.xml" );
-
-        SurefireReportMojo mojo = (SurefireReportMojo) lookupMojo( "report", testPom );
-
-        assertNotNull( mojo );
-
+        SurefireReportMojo mojo = createReportMojo( testPom );
         boolean linkXRef = (Boolean) getVariableValueFromObject( mojo, "linkXRef" );
-
         assertFalse( linkXRef );
-
         mojo.execute();
-
         File report =
             new File( getBasedir(), "target/site/unit/basic-surefire-report-success-false/surefire-report.html" );
-
         renderer( mojo, report );
-
         assertTrue( report.exists() );
-
         String htmlContent = FileUtils.fileRead( report );
 
         int idx = htmlContent.indexOf( "./xref-test/com/shape/CircleTest.html#L44" );
-
         assertTrue( idx == -1 );
     }
 
@@ -179,24 +168,15 @@ public class SurefireReportMojoTest
         throws Exception
     {
         File testPom = new File( getUnitBaseDir(), "basic-surefire-report-reporting-null/plugin-config.xml" );
-
-        SurefireReportMojo mojo = (SurefireReportMojo) lookupMojo( "report", testPom );
-
-        assertNotNull( mojo );
-
+        SurefireReportMojo mojo = createReportMojo( testPom );
         mojo.execute();
-
         File report =
             new File( getBasedir(), "target/site/unit/basic-surefire-report-reporting-null/surefire-report.html" );
-
         renderer( mojo, report );
-
         assertTrue( report.exists() );
-
         String htmlContent = FileUtils.fileRead( report );
 
         int idx = htmlContent.indexOf( "./xref-test/com/shape/CircleTest.html#L44" );
-
         assertTrue( idx < 0 );
     }
 
@@ -205,26 +185,18 @@ public class SurefireReportMojoTest
         throws Exception
     {
         File testPom = new File( getUnitBaseDir(), "basic-surefire-report-anchor-test-cases/plugin-config.xml" );
-
-        SurefireReportMojo mojo = (SurefireReportMojo) lookupMojo( "report", testPom );
-
-        assertNotNull( mojo );
-
+        SurefireReportMojo mojo = createReportMojo( testPom );
         mojo.execute();
-
         File report = new File( getBasedir(),
                                 "target/site/unit/basic-surefire-report-anchor-test-cases/surefire-report.html" );
-
         renderer( mojo, report );
-
         assertTrue( report.exists() );
-
         String htmlContent = FileUtils.fileRead( report );
 
-        int idx = htmlContent.indexOf( "<td align=\"left\"><a name=\"TC_com.shape.CircleTest.testX\"></a>testX</td>" );
+        int idx = htmlContent.indexOf( "<td align=\"left\"><a id=\"TC_com.shape.CircleTest.testX\"></a>testX</td>" );
         assertTrue( idx > 0 );
 
-        idx = htmlContent.indexOf( "<td align=\"left\"><a name=\"TC_com.shape.CircleTest.testRadius\"></a>"
+        idx = htmlContent.indexOf( "<td align=\"left\"><a id=\"TC_com.shape.CircleTest.testRadius\"></a>"
                                        + "<a href=\"#com.shape.CircleTest.testRadius\">testRadius</a>" );
         assertTrue( idx > 0 );
     }
@@ -233,8 +205,7 @@ public class SurefireReportMojoTest
         throws Exception
     {
         File testPom = new File( getUnitBaseDir(), "surefire-report-single-error/plugin-config.xml" );
-        SurefireReportMojo mojo = (SurefireReportMojo) lookupMojo( "report", testPom );
-        assertNotNull( mojo );
+        SurefireReportMojo mojo = createReportMojo( testPom );
         mojo.execute();
         File report = new File( getBasedir(), "target/site/unit/surefire-report-single-error/surefire-report.html" );
         renderer( mojo, report );
@@ -318,8 +289,7 @@ public class SurefireReportMojoTest
         throws Exception
     {
         File testPom = new File( getUnitBaseDir(), "surefire-report-nestedClass-trimStackTrace/plugin-config.xml" );
-        SurefireReportMojo mojo = (SurefireReportMojo) lookupMojo( "report", testPom );
-        assertNotNull( mojo );
+        SurefireReportMojo mojo = createReportMojo( testPom );
         mojo.execute();
         File report = new File( getBasedir(), "target/site/unit/surefire-report-nestedClass-trimStackTrace/surefire-report.html" );
         renderer( mojo, report );
@@ -381,8 +351,7 @@ public class SurefireReportMojoTest
         throws Exception
     {
         File testPom = new File( getUnitBaseDir(), "surefire-report-nestedClass/plugin-config.xml" );
-        SurefireReportMojo mojo = (SurefireReportMojo) lookupMojo( "report", testPom );
-        assertNotNull( mojo );
+        SurefireReportMojo mojo = createReportMojo( testPom );
         mojo.execute();
         File report = new File( getBasedir(), "target/site/unit/surefire-report-nestedClass/surefire-report.html" );
         renderer( mojo, report );
@@ -468,8 +437,7 @@ public class SurefireReportMojoTest
         throws Exception
     {
         File testPom = new File( getUnitBaseDir(), "surefire-report-enclosed-trimStackTrace/plugin-config.xml" );
-        SurefireReportMojo mojo = (SurefireReportMojo) lookupMojo( "report", testPom );
-        assertNotNull( mojo );
+        SurefireReportMojo mojo = createReportMojo( testPom );
         mojo.execute();
         File report = new File( getBasedir(), "target/site/unit/surefire-report-enclosed-trimStackTrace/surefire-report.html" );
         renderer( mojo, report );
@@ -530,8 +498,7 @@ public class SurefireReportMojoTest
         throws Exception
     {
         File testPom = new File( getUnitBaseDir(), "surefire-report-enclosed/plugin-config.xml" );
-        SurefireReportMojo mojo = (SurefireReportMojo) lookupMojo( "report", testPom );
-        assertNotNull( mojo );
+        SurefireReportMojo mojo = createReportMojo( testPom );
         mojo.execute();
         File report = new File( getBasedir(), "target/site/unit/surefire-report-enclosed/surefire-report.html" );
         renderer( mojo, report );
@@ -620,6 +587,36 @@ public class SurefireReportMojoTest
                 + "</pre>" ) ) );
     }
 
+    public void testCustomTitleAndDescriptionReport()
+            throws Exception
+    {
+        File testPom = new File( getUnitBaseDir(), "surefire-1183/plugin-config.xml" );
+        SurefireReportMojo mojo = createReportMojo( testPom );
+
+        File outputDir = (File) getVariableValueFromObject( mojo, "outputDirectory" );
+        String outputName = (String) getVariableValueFromObject( mojo, "outputName" );
+        File reportsDir = (File) getVariableValueFromObject( mojo, "reportsDirectory" );
+        String title = (String) getVariableValueFromObject( mojo, "title" );
+        String description = (String) getVariableValueFromObject( mojo, "description" );
+
+        assertEquals( new File( getBasedir() + "/target/site/unit/surefire-1183" ), outputDir );
+        assertEquals( new File( getBasedir() + "/src/test/resources/unit/surefire-1183/acceptancetest-reports" )
+                        .getAbsolutePath(), reportsDir.getAbsolutePath() );
+        assertEquals( "acceptance-test-report", outputName );
+        assertEquals( "Acceptance Test", title );
+        assertEquals( "Acceptance Test Description", description );
+
+        mojo.execute();
+
+        File report = new File( getBasedir(), "target/site/acceptance-test-report.html" );
+        renderer( mojo, report );
+
+        assertTrue( report.exists() );
+
+        String htmlContent = FileUtils.fileRead ( report );
+        assertTrue( htmlContent.contains ( "<h2><a name=\"Acceptance_Test\"></a>Acceptance Test</h2></section>" ) );
+    }
+
     /**
      * Renderer the sink from the report mojo.
      *
diff --git a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/DependencyArtifactStubFactory.java b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/DependencyArtifactStubFactory.java
new file mode 100644
index 000000000..e91d6467e
--- /dev/null
+++ b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/DependencyArtifactStubFactory.java
@@ -0,0 +1,73 @@
+package org.apache.maven.plugins.surefire.report.stubs;
+
+/*
+ * 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.io.File;
+import java.io.IOException;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.ArtifactUtils;
+import org.apache.maven.artifact.versioning.VersionRange;
+import org.apache.maven.plugin.testing.ArtifactStubFactory;
+
+/**
+ * DependencyArtifactStubFactory
+ *
+ */
+public class DependencyArtifactStubFactory
+    extends ArtifactStubFactory
+{
+    private boolean flattenedPath = true;
+
+    public DependencyArtifactStubFactory( File theWorkingDir, boolean theCreateFiles, boolean flattenedPath )
+    {
+        this( theWorkingDir, theCreateFiles );
+        this.flattenedPath = flattenedPath;
+    }
+
+    public DependencyArtifactStubFactory( File theWorkingDir, boolean theCreateFiles )
+    {
+        super( theWorkingDir, theCreateFiles );
+    }
+
+    @Override
+    public Artifact createArtifact( String groupId, String artifactId, VersionRange versionRange, String scope,
+                                    String type, String classifier, boolean optional )
+        throws IOException
+    {
+        File workingDir = getWorkingDir();
+
+        if ( !flattenedPath )
+        {
+            // don't use flatten directories, won't happen at runtime
+            String path = groupId.replace( '.', '/' ) + '/'
+                    + artifactId + '/'
+                    + ArtifactUtils.toSnapshotVersion( versionRange.getRecommendedVersion().toString() );
+            setWorkingDir( new File( workingDir, path ) );
+        }
+
+        Artifact artifact =
+            super.createArtifact( groupId, artifactId, versionRange, scope, type, classifier, optional );
+
+        setWorkingDir( workingDir );
+
+        return artifact;
+    }
+}
diff --git a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/SurefireRepMavenProjectStub.java b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/SurefireRepMavenProjectStub.java
index d1f2c113b..cc2bac290 100644
--- a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/SurefireRepMavenProjectStub.java
+++ b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/stubs/SurefireRepMavenProjectStub.java
@@ -20,6 +20,11 @@ package org.apache.maven.plugins.surefire.report.stubs;
  */
 
 import java.util.List;
+import java.util.Collections;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
+import org.apache.maven.artifact.repository.MavenArtifactRepository;
+import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.ReportPlugin;
 import org.apache.maven.model.Reporting;
@@ -51,4 +56,16 @@ public class SurefireRepMavenProjectStub
 
         return reporting.getPlugins();
     }
+
+    @Override
+    public List<ArtifactRepository> getRemoteArtifactRepositories()
+    {
+        ArtifactRepository repository =
+                new MavenArtifactRepository( "central", "https://repo1.maven.org/maven2",
+                                             new DefaultRepositoryLayout(),
+                                             new ArtifactRepositoryPolicy(),
+                                             new ArtifactRepositoryPolicy() );
+
+        return Collections.singletonList( repository );
+    }
 }
diff --git a/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-anchor-test-cases/plugin-config.xml b/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-anchor-test-cases/plugin-config.xml
index 28822bb81..3045dce6d 100644
--- a/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-anchor-test-cases/plugin-config.xml
+++ b/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-anchor-test-cases/plugin-config.xml
@@ -24,6 +24,7 @@
         <artifactId>maven-surefire-report-plugin</artifactId>
         <configuration>
           <outputDirectory>${basedir}/target/site/unit/basic-surefire-report-anchor-test-cases</outputDirectory>
+          <localRepository>${localRepository}</localRepository>
           <project implementation="org.apache.maven.plugins.surefire.report.stubs.SurefireRepMavenProjectStub"/>
           <showSuccess>true</showSuccess>
           <reportsDirectory>${basedir}/src/test/resources/unit/basic-surefire-report-anchor-test-cases/surefire-reports
diff --git a/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-linkxref-false/plugin-config.xml b/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-linkxref-false/plugin-config.xml
index 0c21c12f4..e0586aad1 100644
--- a/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-linkxref-false/plugin-config.xml
+++ b/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-linkxref-false/plugin-config.xml
@@ -24,6 +24,7 @@
         <artifactId>maven-surefire-report-plugin</artifactId>
         <configuration>
           <outputDirectory>${basedir}/target/site/unit/basic-surefire-report-linkxref-false</outputDirectory>
+          <localRepository>${localRepository}</localRepository>
           <project implementation="org.apache.maven.plugins.surefire.report.stubs.SurefireRepMavenProjectStub"/>
           <showSuccess>true</showSuccess>
           <reportsDirectory>${basedir}/src/test/resources/unit/basic-surefire-report-linkxref-false/surefire-reports
diff --git a/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-reporting-null/plugin-config.xml b/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-reporting-null/plugin-config.xml
index 96a8a0646..8aca877bd 100644
--- a/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-reporting-null/plugin-config.xml
+++ b/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-reporting-null/plugin-config.xml
@@ -24,6 +24,7 @@
         <artifactId>maven-surefire-report-plugin</artifactId>
         <configuration>
           <outputDirectory>${basedir}/target/site/unit/basic-surefire-report-reporting-null</outputDirectory>
+          <localRepository>${localRepository}</localRepository>
           <project implementation="org.apache.maven.plugins.surefire.report.stubs.SurefireRepMavenProjectStub2"/>
           <showSuccess>true</showSuccess>
           <reportsDirectory>${basedir}/src/test/resources/unit/basic-surefire-report-reporting-null/surefire-reports
diff --git a/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-success-false/plugin-config.xml b/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-success-false/plugin-config.xml
index c5d99740f..c79859112 100644
--- a/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-success-false/plugin-config.xml
+++ b/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-success-false/plugin-config.xml
@@ -24,6 +24,7 @@
         <artifactId>maven-surefire-report-plugin</artifactId>
         <configuration>
           <outputDirectory>${basedir}/target/site/unit/basic-surefire-report-success-false</outputDirectory>
+          <localRepository>${localRepository}</localRepository>
           <project implementation="org.apache.maven.plugins.surefire.report.stubs.SurefireRepMavenProjectStub"/>
           <showSuccess>false</showSuccess>
           <reportsDirectory>${basedir}/src/test/resources/unit/basic-surefire-report-success-false/surefire-reports
diff --git a/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-test/plugin-config.xml b/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-test/plugin-config.xml
index a2efee926..81e59caf1 100644
--- a/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-test/plugin-config.xml
+++ b/maven-surefire-report-plugin/src/test/resources/unit/basic-surefire-report-test/plugin-config.xml
@@ -24,6 +24,7 @@
         <artifactId>maven-surefire-report-plugin</artifactId>
         <configuration>
           <outputDirectory>${basedir}/target/site/unit/basic-surefire-report-test</outputDirectory>
+          <localRepository>${localRepository}</localRepository>
           <project implementation="org.apache.maven.plugins.surefire.report.stubs.SurefireRepMavenProjectStub"/>
           <showSuccess>true</showSuccess>
           <reportsDirectory>${basedir}/src/test/resources/unit/basic-surefire-report-test/surefire-reports
diff --git a/maven-surefire-report-plugin/src/test/resources/surefire-1183/acceptancetest-reports/TEST-com.shape.CircleTest.xml b/maven-surefire-report-plugin/src/test/resources/unit/surefire-1183/acceptancetest-reports/TEST-com.shape.CircleTest.xml
similarity index 100%
rename from maven-surefire-report-plugin/src/test/resources/surefire-1183/acceptancetest-reports/TEST-com.shape.CircleTest.xml
rename to maven-surefire-report-plugin/src/test/resources/unit/surefire-1183/acceptancetest-reports/TEST-com.shape.CircleTest.xml
diff --git a/maven-surefire-report-plugin/src/test/resources/surefire-1183/plugin-config.xml b/maven-surefire-report-plugin/src/test/resources/unit/surefire-1183/plugin-config.xml
similarity index 87%
rename from maven-surefire-report-plugin/src/test/resources/surefire-1183/plugin-config.xml
rename to maven-surefire-report-plugin/src/test/resources/unit/surefire-1183/plugin-config.xml
index fe129e4e8..3166e7896 100644
--- a/maven-surefire-report-plugin/src/test/resources/surefire-1183/plugin-config.xml
+++ b/maven-surefire-report-plugin/src/test/resources/unit/surefire-1183/plugin-config.xml
@@ -29,8 +29,9 @@
                     <title>Acceptance Test</title>
                     <description>Acceptance Test Description</description>
                     <outputName>acceptance-test-report</outputName>
-                    <outputDirectory>${basedir}/target/site/surefire-1183</outputDirectory>
-                    <reportsDirectory>${basedir}/src/test/resources/surefire-1183/acceptancetest-reports
+                    <localRepository>${localRepository}</localRepository>
+                    <outputDirectory>${basedir}/target/site/unit/surefire-1183</outputDirectory>
+                    <reportsDirectory>${basedir}/src/test/resources/unit/surefire-1183/acceptancetest-reports
                     </reportsDirectory>
                 </configuration>
             </plugin>
diff --git a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed-trimStackTrace/plugin-config.xml b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed-trimStackTrace/plugin-config.xml
index 5124e1730..981bb1882 100644
--- a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed-trimStackTrace/plugin-config.xml
+++ b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed-trimStackTrace/plugin-config.xml
@@ -24,6 +24,7 @@
         <artifactId>maven-surefire-report-plugin</artifactId>
         <configuration>
           <outputDirectory>${basedir}/target/site/unit/surefire-report-enclosed-trimStackTrace</outputDirectory>
+          <localRepository>${localRepository}</localRepository>
           <project implementation="org.apache.maven.plugins.surefire.report.stubs.SurefireRepMavenProjectStub"/>
           <showSuccess>true</showSuccess>
           <reportsDirectory>${basedir}/src/test/resources/unit/surefire-report-enclosed-trimStackTrace/surefire-reports
diff --git a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed/plugin-config.xml b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed/plugin-config.xml
index 77c031e46..26bae34ab 100644
--- a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed/plugin-config.xml
+++ b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-enclosed/plugin-config.xml
@@ -24,6 +24,7 @@
         <artifactId>maven-surefire-report-plugin</artifactId>
         <configuration>
           <outputDirectory>${basedir}/target/site/unit/surefire-report-enclosed</outputDirectory>
+          <localRepository>${localRepository}</localRepository>
           <project implementation="org.apache.maven.plugins.surefire.report.stubs.SurefireRepMavenProjectStub"/>
           <showSuccess>true</showSuccess>
           <reportsDirectory>${basedir}/src/test/resources/unit/surefire-report-enclosed/surefire-reports
diff --git a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass-trimStackTrace/plugin-config.xml b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass-trimStackTrace/plugin-config.xml
index d32358ac4..dcf6a9a72 100644
--- a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass-trimStackTrace/plugin-config.xml
+++ b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass-trimStackTrace/plugin-config.xml
@@ -24,6 +24,7 @@
         <artifactId>maven-surefire-report-plugin</artifactId>
         <configuration>
           <outputDirectory>${basedir}/target/site/unit/surefire-report-nestedClass-trimStackTrace</outputDirectory>
+          <localRepository>${localRepository}</localRepository>
           <project implementation="org.apache.maven.plugins.surefire.report.stubs.SurefireRepMavenProjectStub"/>
           <showSuccess>true</showSuccess>
           <reportsDirectory>${basedir}/src/test/resources/unit/surefire-report-nestedClass-trimStackTrace/surefire-reports
diff --git a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass/plugin-config.xml b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass/plugin-config.xml
index 7f2725520..86ff4639b 100644
--- a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass/plugin-config.xml
+++ b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-nestedClass/plugin-config.xml
@@ -24,6 +24,7 @@
         <artifactId>maven-surefire-report-plugin</artifactId>
         <configuration>
           <outputDirectory>${basedir}/target/site/unit/surefire-report-nestedClass</outputDirectory>
+          <localRepository>${localRepository}</localRepository>
           <project implementation="org.apache.maven.plugins.surefire.report.stubs.SurefireRepMavenProjectStub"/>
           <showSuccess>true</showSuccess>
           <reportsDirectory>${basedir}/src/test/resources/unit/surefire-report-nestedClass/surefire-reports
diff --git a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-single-error/plugin-config.xml b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-single-error/plugin-config.xml
index 6bc56d9b5..e8a3f5889 100644
--- a/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-single-error/plugin-config.xml
+++ b/maven-surefire-report-plugin/src/test/resources/unit/surefire-report-single-error/plugin-config.xml
@@ -24,6 +24,7 @@
         <artifactId>maven-surefire-report-plugin</artifactId>
         <configuration>
           <outputDirectory>${basedir}/target/site/unit/surefire-report-single-error</outputDirectory>
+          <localRepository>${localRepository}</localRepository>
           <project implementation="org.apache.maven.plugins.surefire.report.stubs.SurefireRepMavenProjectStub"/>
           <showSuccess>true</showSuccess>
           <reportsDirectory>${basedir}/src/test/resources/unit/surefire-report-single-error/surefire-reports