maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r594580 - in /maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter: SurefireBooter.java output/FileOutputConsumerProxy.java
Date Tue, 13 Nov 2007 16:59:19 GMT
Author: brett
Date: Tue Nov 13 08:59:18 2007
New Revision: 594580

URL: http://svn.apache.org/viewvc?rev=594580&view=rev
Log:
[SUREFIRE-349] redirectTestOutputToFile truncates summary information
Submitted by: Paul Gier

Modified:
    maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooter.java
    maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/output/FileOutputConsumerProxy.java

Modified: maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooter.java?rev=594580&r1=594579&r2=594580&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooter.java
(original)
+++ maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooter.java
Tue Nov 13 08:59:18 2007
@@ -590,9 +590,19 @@
             cli.createArgument().setFile( systemProperties );
         }
 
+        
         StreamConsumer out = getForkingStreamConsumer( showHeading, showFooter, redirectTestOutputToFile
);
 
-        StreamConsumer err = getForkingStreamConsumer( showHeading, showFooter, redirectTestOutputToFile
);
+        StreamConsumer err;
+        
+        if ( redirectTestOutputToFile )
+        {
+            err = out;
+        }
+        else
+        { 
+            err = getForkingStreamConsumer( showHeading, showFooter, redirectTestOutputToFile
);
+        }
 
         if ( forkConfiguration.isDebug() )
         {

Modified: maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/output/FileOutputConsumerProxy.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/output/FileOutputConsumerProxy.java?rev=594580&r1=594579&r2=594580&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/output/FileOutputConsumerProxy.java
(original)
+++ maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/output/FileOutputConsumerProxy.java
Tue Nov 13 08:59:18 2007
@@ -46,7 +46,9 @@
     private File reportsDirectory;
 
     private PrintWriter printWriter;
-
+    
+    private StringBuffer outputBuffer = new StringBuffer();
+    
     /**
      * Create a consumer that will write to a {@link File} for each test.
      * Files will be saved in working directory.
@@ -127,6 +129,12 @@
         {
             throw new IllegalStateException( "testSetCompleted called before testSetStarting"
);
         }
+        if ( outputBuffer.length() > 0 )
+        {
+            getPrintWriter().write( outputBuffer.toString() );
+            getPrintWriter().write( LINE_SEPARATOR );
+            outputBuffer.setLength( 0 );
+        }
         getPrintWriter().close();
         setPrintWriter( null );
         super.testSetCompleted();
@@ -139,7 +147,16 @@
     {
         if ( getPrintWriter() == null )
         {
-            throw new IllegalStateException( "consumeOutputLine called before testSetStarting"
);
+            outputBuffer.append( line );
+            outputBuffer.append( LINE_SEPARATOR );
+            return;
+        }
+        
+        if ( outputBuffer.length() > 0 )
+        {
+            getPrintWriter().write( outputBuffer.toString() );
+            getPrintWriter().write( LINE_SEPARATOR );
+            outputBuffer.setLength( 0 );
         }
         getPrintWriter().write( line );
         getPrintWriter().write( LINE_SEPARATOR );



Mime
View raw message