You are viewing a plain text version of this content. The canonical link for it is here.
Posted to surefire-commits@maven.apache.org by kr...@apache.org on 2011/03/28 18:15:53 UTC

svn commit: r1086291 - in /maven/surefire/trunk: surefire-api/src/main/java/org/apache/maven/surefire/report/ surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ surefire-providers/surefire-testng/src/main/java/org/ap...

Author: krosenvold
Date: Mon Mar 28 16:15:53 2011
New Revision: 1086291

URL: http://svn.apache.org/viewvc?rev=1086291&view=rev
Log:
o Minor cleanups

Modified:
    maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/TestSetRunListener.java
    maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/LogicalStream.java
    maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGReporter.java

Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/TestSetRunListener.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/TestSetRunListener.java?rev=1086291&r1=1086290&r2=1086291&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/TestSetRunListener.java (original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/TestSetRunListener.java Mon Mar 28 16:15:53 2011
@@ -43,7 +43,7 @@ import java.util.List;
 public class TestSetRunListener
     implements RunListener, RunReporter, Reporter, ConsoleOutputReceiver
 {
-    private final RunStatistics runStatisticsForThis;
+    private final RunStatistics globalStats;
 
     private final MulticastingReporter multicastingReporter;
 
@@ -52,10 +52,10 @@ public class TestSetRunListener
     private final List testStdErr = Collections.synchronizedList( new ArrayList() );
 
 
-    public TestSetRunListener( List reports, RunStatistics runStatisticsForThis )
+    public TestSetRunListener( List reports, RunStatistics globalStats )
     {
         multicastingReporter = new MulticastingReporter( reports );
-        this.runStatisticsForThis = runStatisticsForThis;
+        this.globalStats = globalStats;
     }
 
     public void writeMessage( String message )
@@ -97,25 +97,25 @@ public class TestSetRunListener
         multicastingReporter.writeFooter( "" );
         multicastingReporter.writeFooter( "Results :" );
         multicastingReporter.writeFooter( "" );
-        if ( runStatisticsForThis.hadFailures() )
+        if ( globalStats.hadFailures() )
         {
             multicastingReporter.writeFooter( "Failed tests: " );
-            for ( Iterator iterator = this.runStatisticsForThis.getFailureSources().iterator(); iterator.hasNext(); )
+            for ( Iterator iterator = this.globalStats.getFailureSources().iterator(); iterator.hasNext(); )
             {
                 multicastingReporter.writeFooter( "  " + iterator.next() );
             }
             multicastingReporter.writeFooter( "" );
         }
-        if ( runStatisticsForThis.hadErrors() )
+        if ( globalStats.hadErrors() )
         {
             writeFooter( "Tests in error: " );
-            for ( Iterator iterator = this.runStatisticsForThis.getErrorSources().iterator(); iterator.hasNext(); )
+            for ( Iterator iterator = this.globalStats.getErrorSources().iterator(); iterator.hasNext(); )
             {
                 multicastingReporter.writeFooter( "  " + iterator.next() );
             }
             multicastingReporter.writeFooter( "" );
         }
-        multicastingReporter.writeFooter( runStatisticsForThis.getSummary() );
+        multicastingReporter.writeFooter( globalStats.getSummary() );
         multicastingReporter.writeFooter( "" );
     }
 
@@ -149,7 +149,7 @@ public class TestSetRunListener
     public void testSucceeded( ReportEntry report )
     {
         clearCapturedContent();
-        runStatisticsForThis.incrementCompletedCount();
+        globalStats.incrementCompletedCount();
         multicastingReporter.testSucceeded( report );
     }
 
@@ -161,9 +161,9 @@ public class TestSetRunListener
     public void testError( ReportEntry reportEntry, String stdOutLog, String stdErrLog )
     {
         multicastingReporter.testError( reportEntry, stdOutLog, stdErrLog );
-        runStatisticsForThis.incrementErrorsCount();
-        runStatisticsForThis.incrementCompletedCount();
-        runStatisticsForThis.addErrorSource( reportEntry.getName(), reportEntry.getStackTraceWriter() );
+        globalStats.incrementErrorsCount();
+        globalStats.incrementCompletedCount();
+        globalStats.addErrorSource( reportEntry.getName(), reportEntry.getStackTraceWriter() );
         clearCapturedContent();
     }
 
@@ -175,9 +175,9 @@ public class TestSetRunListener
     public void testFailed( ReportEntry reportEntry, String stdOutLog, String stdErrLog )
     {
         multicastingReporter.testFailed( reportEntry, stdOutLog, stdErrLog );
-        runStatisticsForThis.incrementFailureCount();
-        runStatisticsForThis.incrementCompletedCount();
-        runStatisticsForThis.addFailureSource( reportEntry.getName(), reportEntry.getStackTraceWriter() );
+        globalStats.incrementFailureCount();
+        globalStats.incrementCompletedCount();
+        globalStats.addFailureSource( reportEntry.getName(), reportEntry.getStackTraceWriter() );
         clearCapturedContent();
     }
 
@@ -188,8 +188,8 @@ public class TestSetRunListener
     public void testSkipped( ReportEntry report )
     {
         clearCapturedContent();
-        runStatisticsForThis.incrementSkippedCount();
-        runStatisticsForThis.incrementCompletedCount();
+        globalStats.incrementSkippedCount();
+        globalStats.incrementCompletedCount();
         multicastingReporter.testSkipped( report );
     }
 

Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/LogicalStream.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/LogicalStream.java?rev=1086291&r1=1086290&r2=1086291&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/LogicalStream.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/LogicalStream.java Mon Mar 28 16:15:53 2011
@@ -19,10 +19,11 @@ package org.apache.maven.surefire.junitc
  * under the License.
  */
 
-import org.apache.maven.surefire.report.Reporter;
-
 import java.util.ArrayList;
 import java.util.List;
+import org.apache.maven.surefire.report.ConsoleOutputReceiver;
+import org.apache.maven.surefire.report.Reporter;
+import org.apache.maven.surefire.util.internal.ByteBuffer;
 
 /**
  * A stream-like object that preserves ordering between stdout/stderr
@@ -34,13 +35,16 @@ public class LogicalStream
     class Entry
     {
         final boolean stdout;
-
-        final String value;
+        final byte[] b;
+        final int off;
+        final int len;
 
         Entry( boolean stdout, byte[] b, int off, int len )
         {
             this.stdout = stdout;
-            value = new String( b, off, len ).intern();
+            this.b = ByteBuffer.copy( b, off, len);
+            this.off = 0;
+            this.len = len;
         }
 
         public boolean isStdout()
@@ -50,24 +54,31 @@ public class LogicalStream
 
         public void writeTo( StringBuilder stringBuilder )
         {
-            stringBuilder.append( value );
+            final String str = new String( b, off, len );
+            stringBuilder.append( str );
         }
 
 
         public void writeDetails( Reporter reporter )
         {
-            reporter.writeDetailMessage( value );
+            final String str = new String( b, off, len );
+            reporter.writeDetailMessage( str );
+        }
+
+        public void writeDetails( ConsoleOutputReceiver outputReceiver)
+        {
+            outputReceiver.writeTestOutput( b, off, len , stdout );
         }
 
         @Override
         public String toString()
         {
-            return value;
+            return new String( b, off, len );
         }
 
         public boolean isBlankLine()
         {
-            return "\n".equals( value );
+            return "\n".equals( toString() );
         }
     }
 
@@ -88,6 +99,15 @@ public class LogicalStream
         }
     }
 
+    public void writeDetails( ConsoleOutputReceiver outputReceiver )
+    {
+        for ( Entry entry : output )
+        {
+            entry.writeDetails( outputReceiver );
+        }
+    }
+
+
     public String getOutput( boolean stdOut )
     {
         StringBuilder stringBuilder = new StringBuilder();

Modified: maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGReporter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGReporter.java?rev=1086291&r1=1086290&r2=1086291&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGReporter.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGReporter.java Mon Mar 28 16:15:53 2011
@@ -19,7 +19,6 @@ package org.apache.maven.surefire.testng
  * under the License.
  */
 
-import org.apache.maven.surefire.Surefire;
 import org.apache.maven.surefire.report.CategorizedReportEntry;
 import org.apache.maven.surefire.report.PojoStackTraceWriter;
 import org.apache.maven.surefire.report.ReportEntry;
@@ -46,7 +45,9 @@ import org.testng.TestNG;
 public class TestNGReporter
     implements ITestListener, ISuiteListener
 {
-    private final ResourceBundle bundle = ResourceBundle.getBundle( Surefire.SUREFIRE_BUNDLE_NAME );
+    public static final String SUREFIRE_BUNDLE_NAME = "org.apache.maven.surefire.surefire";
+
+    private final ResourceBundle bundle = ResourceBundle.getBundle( SUREFIRE_BUNDLE_NAME );
 
     /**
      * core Surefire reporting