Author: krosenvold
Date: Mon Mar 14 18:36:58 2011
New Revision: 1081511

URL: http://svn.apache.org/viewvc?rev=1081511&view=rev
Log:
[SUREFIRE-712] reportsDirectories ignored when running unaggregated

Modified:
    
maven/surefire/trunk/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java
    
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire570MultipleReportDirectoriesIT.java
    
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/SurefireVerifierTestClass.java
    
maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-570-multipleReportDirectories/module1/src/test/resources/surefire-reports/TEST-org.apache.maven.surefireReport.surefireReportTest.MyClassTest.xml
    
maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-570-multipleReportDirectories/module2/src/test/resources/surefire-reports/TEST-org.apache.maven.surefireReport.surefireReportTest.MyClassTest.xml

Modified: 
maven/surefire/trunk/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java
URL: 
http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java?rev=1081511&r1=1081510&r2=1081511&view=diff
==============================================================================
--- 
maven/surefire/trunk/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java
 (original)
+++ 
maven/surefire/trunk/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java
 Mon Mar 14 18:36:58 2011
@@ -138,12 +138,12 @@ public class SurefireReportMojo
     {
         final List reportsDirectoryList = new ArrayList();
 
+        if ( reportsDirectories != null )
+        {
+            reportsDirectoryList.addAll( Arrays.asList( reportsDirectories ) );
+        }
         if ( reportsDirectory != null )
         {
-            if ( reportsDirectories != null )
-            {
-                reportsDirectoryList.addAll( Arrays.asList( reportsDirectories 
) );
-            }
             reportsDirectoryList.add( reportsDirectory );
         }
         if ( aggregate )

Modified: 
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire570MultipleReportDirectoriesIT.java
URL: 
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire570MultipleReportDirectoriesIT.java?rev=1081511&r1=1081510&r2=1081511&view=diff
==============================================================================
--- 
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire570MultipleReportDirectoriesIT.java
 (original)
+++ 
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire570MultipleReportDirectoriesIT.java
 Mon Mar 14 18:36:58 2011
@@ -35,7 +35,7 @@ public class Surefire570MultipleReportDi
         super( "/surefire-570-multipleReportDirectories" );
     }
 
-    public void testForkPerTestNoSetup()
+    public void testReportWithAggregate()
         throws Exception
     {
 
@@ -49,6 +49,22 @@ public class Surefire570MultipleReportDi
         File siteFile = getSiteFile( "surefire-report.html" );
         assertContainsText( siteFile, "MyModule1ClassTest" );
         assertContainsText( siteFile, "MyModule2ClassTest" );
-        assertContainsText( siteFile, "MyDummyClassTest" );
+        assertContainsText( siteFile, "MyDummyClassM1Test" );
     }
+
+    public void testReportWithoutAggregate()
+        throws Exception
+    {
+
+        failNever();
+        executeTest(); // Hmm. This shouldn't be necessary but is another bug
+
+        reset();
+
+        execute( "surefire-report:report" );
+        File siteFile = getSiteFile( "module1", "surefire-report.html" );
+        assertContainsText( siteFile, "MyModule1ClassTest" );
+        assertContainsText( siteFile, "MyDummyClassM1Test" );
+    }
+
 }

Modified: 
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/SurefireVerifierTestClass.java
URL: 
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/SurefireVerifierTestClass.java?rev=1081511&r1=1081510&r2=1081511&view=diff
==============================================================================
--- 
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/SurefireVerifierTestClass.java
 (original)
+++ 
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/SurefireVerifierTestClass.java
 Mon Mar 14 18:36:58 2011
@@ -228,6 +228,12 @@ public abstract class SurefireVerifierTe
         return new File( targetDir, fileName );
     }
 
+    protected File getSiteFile( String moduleName, String fileName )
+    {
+        File targetDir = getSubFile(moduleName + "/target/site" );
+        return new File( targetDir, fileName );
+    }
+
     protected void printSummary( boolean printsummary )
     {
         addGoal( "-DprintSummary=" + printsummary );

Modified: 
maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-570-multipleReportDirectories/module1/src/test/resources/surefire-reports/TEST-org.apache.maven.surefireReport.surefireReportTest.MyClassTest.xml
URL: 
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-570-multipleReportDirectories/module1/src/test/resources/surefire-reports/TEST-org.apache.maven.surefireReport.surefireReportTest.MyClassTest.xml?rev=1081511&r1=1081510&r2=1081511&view=diff
==============================================================================
--- 
maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-570-multipleReportDirectories/module1/src/test/resources/surefire-reports/TEST-org.apache.maven.surefireReport.surefireReportTest.MyClassTest.xml
 (original)
+++ 
maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-570-multipleReportDirectories/module1/src/test/resources/surefire-reports/TEST-org.apache.maven.surefireReport.surefireReportTest.MyClassTest.xml
 Mon Mar 14 18:36:58 2011
@@ -57,7 +57,7 @@
     <property name="sun.desktop" value="gnome"/>
     <property name="sun.cpu.isalist" value=""/>
   </properties>
-  <testcase time="0.005" 
classname="org.apache.maven.surefireReport.surefireReportTest.module1.MyDummyClassTest"
 name="testGetFooKO">
+  <testcase time="0.005" 
classname="org.apache.maven.surefireReport.surefireReportTest.module1.MyDummyClassM1Test"
 name="testGetFooKO">
     <failure message="expected:&lt;18&gt; but was:&lt;42&gt;" 
type="junit.framework.AssertionFailedError">junit.framework.AssertionFailedError:
 expected:&lt;18&gt; but was:&lt;42&gt;
        at junit.framework.Assert.fail(Assert.java:47)
        at junit.framework.Assert.failNotEquals(Assert.java:280)
@@ -67,5 +67,5 @@
        at 
org.apache.maven.surefireReport.surefireReportTest.module1.MyDummyClassTest.testGetFooKO(MyClassTest.java:10)
 </failure>
   </testcase>
-  <testcase time="0" 
classname="org.apache.maven.surefireReport.surefireReportTest.module1.MyDummyClassTest"
 name="testGetFooOK"/>
-</testsuite>
\ No newline at end of file
+  <testcase time="0" 
classname="org.apache.maven.surefireReport.surefireReportTest.module1.MyDummyClassM1Test"
 name="testGetFooOK"/>
+</testsuite>

Modified: 
maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-570-multipleReportDirectories/module2/src/test/resources/surefire-reports/TEST-org.apache.maven.surefireReport.surefireReportTest.MyClassTest.xml
URL: 
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-570-multipleReportDirectories/module2/src/test/resources/surefire-reports/TEST-org.apache.maven.surefireReport.surefireReportTest.MyClassTest.xml?rev=1081511&r1=1081510&r2=1081511&view=diff
==============================================================================
--- 
maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-570-multipleReportDirectories/module2/src/test/resources/surefire-reports/TEST-org.apache.maven.surefireReport.surefireReportTest.MyClassTest.xml
 (original)
+++ 
maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-570-multipleReportDirectories/module2/src/test/resources/surefire-reports/TEST-org.apache.maven.surefireReport.surefireReportTest.MyClassTest.xml
 Mon Mar 14 18:36:58 2011
@@ -57,7 +57,7 @@
     <property name="sun.desktop" value="gnome"/>
     <property name="sun.cpu.isalist" value=""/>
   </properties>
-  <testcase time="0.005" 
classname="org.apache.maven.surefireReport.surefireReportTest.module1.MyDummyClassTest"
 name="testGetFooKO">
+  <testcase time="0.005" 
classname="org.apache.maven.surefireReport.surefireReportTest.module1.MyDummyClassM2Test"
 name="testGetFooKO">
     <failure message="expected:&lt;18&gt; but was:&lt;42&gt;" 
type="junit.framework.AssertionFailedError">junit.framework.AssertionFailedError:
 expected:&lt;18&gt; but was:&lt;42&gt;
        at junit.framework.Assert.fail(Assert.java:47)
        at junit.framework.Assert.failNotEquals(Assert.java:280)
@@ -67,5 +67,5 @@
        at 
org.apache.maven.surefireReport.surefireReportTest.module1.MyDummyClassTest.testGetFooKO(MyClassTest.java:10)
 </failure>
   </testcase>
-  <testcase time="0" 
classname="org.apache.maven.surefireReport.surefireReportTest.module1.MyDummyClassTest"
 name="testGetFooOK"/>
-</testsuite>
\ No newline at end of file
+  <testcase time="0" 
classname="org.apache.maven.surefireReport.surefireReportTest.module1.MyDummyClassM2Test"
 name="testGetFooOK"/>
+</testsuite>


Reply via email to