maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r382008 - in /maven/surefire/branches/surefire-testng: surefire-booter/src/main/java/org/apache/maven/surefire/ surefire/src/main/java/org/apache/maven/surefire/report/
Date Wed, 01 Mar 2006 13:08:40 GMT
Author: brett
Date: Wed Mar  1 05:08:38 2006
New Revision: 382008

URL: http://svn.apache.org/viewcvs?rev=382008&view=rev
Log:
further rationalise reporters

Added:
    maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java
  (with props)
Removed:
    maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/ForkingReport.java
    maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/ForkingSummaryConsoleReporter.java
    maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/SummaryConsoleReporter.java
Modified:
    maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/ForkingWriterStreamConsumer.java
    maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/AbstractConsoleReporter.java
    maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/AbstractFileReporter.java
    maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java
    maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/BriefConsoleReporter.java
    maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/BriefFileReporter.java
    maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/ConsoleReporter.java
    maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/DetailedConsoleReporter.java
    maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/FileReporter.java
    maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/ForkingConsoleReporter.java
    maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/ReporterManager.java
    maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/XMLReporter.java

Modified: maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/ForkingWriterStreamConsumer.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/ForkingWriterStreamConsumer.java?rev=382008&r1=382007&r2=382008&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/ForkingWriterStreamConsumer.java
(original)
+++ maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/ForkingWriterStreamConsumer.java
Wed Mar  1 05:08:38 2006
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-import org.apache.maven.surefire.report.ForkingReport;
+import org.apache.maven.surefire.report.ForkingConsoleReporter;
 import org.codehaus.plexus.util.cli.StreamConsumer;
 
 import java.io.PrintWriter;
@@ -43,21 +43,21 @@
 
         printWriter = new PrintWriter( writer );
 
-        standardPrefixLength = ForkingReport.FORKING_PREFIX_STANDARD.length();
+        standardPrefixLength = ForkingConsoleReporter.FORKING_PREFIX_STANDARD.length();
 
-        headingPrefixLength = ForkingReport.FORKING_PREFIX_HEADING.length();
+        headingPrefixLength = ForkingConsoleReporter.FORKING_PREFIX_HEADING.length();
     }
 
     public void consumeLine( String line )
     {
-        if ( line.startsWith( ForkingReport.FORKING_PREFIX_HEADING ) )
+        if ( line.startsWith( ForkingConsoleReporter.FORKING_PREFIX_HEADING ) )
         {
             if ( showHeading )
             {
                 printWriter.println( line.substring( headingPrefixLength ) );
             }
         }
-        else if ( line.startsWith( ForkingReport.FORKING_PREFIX_STANDARD ) )
+        else if ( line.startsWith( ForkingConsoleReporter.FORKING_PREFIX_STANDARD ) )
         {
             printWriter.println( line.substring( standardPrefixLength ) );
         }

Modified: maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/AbstractConsoleReporter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/AbstractConsoleReporter.java?rev=382008&r1=382007&r2=382008&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/AbstractConsoleReporter.java
(original)
+++ maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/AbstractConsoleReporter.java
Wed Mar  1 05:08:38 2006
@@ -23,21 +23,18 @@
 
 /**
  * Base class for console reporters.
- * <p/>
- * // TODO: what about stream closing?
  *
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
  */
 public abstract class AbstractConsoleReporter
-    extends AbstractReporter
+    extends AbstractTextReporter
 {
     protected static final int BUFFER_SIZE = 4096;
 
-    protected PrintWriter writer;
-
-    protected AbstractConsoleReporter()
+    protected AbstractConsoleReporter( String format )
     {
-        writer = new PrintWriter( new OutputStreamWriter( new BufferedOutputStream( System.out,
BUFFER_SIZE ) ) );
+        super( new PrintWriter( new OutputStreamWriter( new BufferedOutputStream( System.out,
BUFFER_SIZE ) ) ),
+               format );
     }
 
     public void batteryStarting( ReportEntry report )
@@ -48,18 +45,37 @@
         writeMessage( "Running " + report.getName() );
     }
 
-    public void writeMessage( String message )
+    public void runStarting( int testCount )
+    {
+        writeHeading( "" );
+        writeHeading( "-------------------------------------------------------" );
+        writeHeading( " T E S T S" );
+        writeHeading( "-------------------------------------------------------" );
+    }
+
+    public void writeHeading( String message )
     {
-        writer.println( "[surefire] " + message );
+        writer.println( message );
         writer.flush();
     }
 
-    public void runStarting( int testCount )
+    public void runAborted( ReportEntry report )
+    {
+        printAbortionError( "RUN ABORTED", report );
+    }
+
+    public void batteryAborted( ReportEntry report )
+    {
+        printAbortionError( "BATTERY ABORTED", report );
+    }
+
+    private void printAbortionError( String msg, ReportEntry report )
     {
-        writer.println();
-        writer.println( "-------------------------------------------------------" );
-        writer.println( " T E S T S" );
-        writer.println( "-------------------------------------------------------" );
+        writer.println( msg );
+        writer.println( report.getSource().getClass().getName() );
+        writer.println( report.getName() );
+        writer.println( report.getMessage() );
+        writer.println( report.getThrowable().getMessage() );
         writer.flush();
     }
 }

Modified: maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/AbstractFileReporter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/AbstractFileReporter.java?rev=382008&r1=382007&r2=382008&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/AbstractFileReporter.java
(original)
+++ maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/AbstractFileReporter.java
Wed Mar  1 05:08:38 2006
@@ -27,32 +27,41 @@
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
  */
 public abstract class AbstractFileReporter
-    extends AbstractReporter
+    extends AbstractTextReporter
 {
-    protected StringBuffer reportContent;
-
-    protected PrintWriter writer;
+    protected AbstractFileReporter( String format )
+    {
+        super( format );
+    }
 
     public void batteryStarting( ReportEntry report )
         throws IOException
     {
         super.batteryStarting( report );
 
-        reportContent = new StringBuffer();
-
         File reportFile = new File( getReportsDirectory(), report.getName() + ".txt" );
 
         File reportDir = reportFile.getParentFile();
 
         reportDir.mkdirs();
 
-        writer = new PrintWriter( new FileWriter( reportFile ) );
+        PrintWriter writer = new PrintWriter( new FileWriter( reportFile ) );
 
         writer.println( "-------------------------------------------------------------------------------"
);
 
         writer.println( "Battery: " + report.getName() );
 
         writer.println( "-------------------------------------------------------------------------------"
);
+
+        setWriter( writer );
     }
 
+    public void batteryCompleted( ReportEntry report )
+    {
+        super.batteryCompleted( report );
+
+        writer.flush();
+
+        writer.close();
+    }
 }

Modified: maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java?rev=382008&r1=382007&r2=382008&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java
(original)
+++ maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java
Wed Mar  1 05:08:38 2006
@@ -46,7 +46,7 @@
 
     private static final int MS_PER_SEC = 1000;
 
-    private long batteryStartTime;
+    protected long batteryStartTime;
 
     public void setReportsDirectory( String reportsDirectory )
     {
@@ -62,10 +62,6 @@
     // Report interface
     // ----------------------------------------------------------------------
 
-    public void writeMessage( String message )
-    {
-    }
-
     public void runStarting( int testCount )
     {
     }
@@ -187,46 +183,5 @@
         writer.flush();
 
         return writer.toString();
-    }
-
-    protected StringBuffer getBatterySummary()
-    {
-        StringBuffer batterySummary = new StringBuffer();
-
-        batterySummary.append( "Tests run: " );
-        batterySummary.append( completedCount );
-        batterySummary.append( ", Failures: " );
-        batterySummary.append( failures );
-        batterySummary.append( ", Errors: " );
-        batterySummary.append( errors );
-        batterySummary.append( ", Time elapsed: " );
-        batterySummary.append( elapsedTimeAsString( System.currentTimeMillis() - batteryStartTime
) );
-        batterySummary.append( " sec" );
-        return batterySummary;
-    }
-
-    protected String getElapsedTimeSummary()
-    {
-        StringBuffer reportContent = new StringBuffer();
-        long runTime = this.endTime - this.startTime;
-
-        reportContent.append( "  Time elapsed: " ).append( elapsedTimeAsString( runTime )
).append( " sec" );
-
-        return reportContent.toString();
-    }
-
-    protected String getOutput( ReportEntry report, String msg )
-    {
-        StringBuffer buf = new StringBuffer();
-
-        buf.append( report.getName() );
-
-        buf.append( getElapsedTimeSummary() );
-
-        buf.append( "  <<< " ).append( msg ).append( "!" ).append( NL );
-
-        buf.append( getStackTrace( report ) ).append( NL );
-
-        return buf.toString();
     }
 }

Added: maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java?rev=382008&view=auto
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java
(added)
+++ maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java
Wed Mar  1 05:08:38 2006
@@ -0,0 +1,163 @@
+package org.apache.maven.surefire.report;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/*
+ * Copyright 2001-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+/**
+ * Text based reporter.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public abstract class AbstractTextReporter
+    extends AbstractReporter
+{
+    protected static final String BRIEF = "brief";
+
+    protected static final String PLAIN = "plain";
+
+    protected static final String SUMMARY = "summary";
+
+    protected PrintWriter writer;
+
+    private final String format;
+
+    private List testResults;
+
+    protected AbstractTextReporter( String format )
+    {
+        this.format = format;
+    }
+
+    protected AbstractTextReporter( PrintWriter writer, String format )
+    {
+        this.writer = writer;
+
+        this.format = format;
+    }
+
+    public void setWriter( PrintWriter writer )
+    {
+        this.writer = writer;
+    }
+
+    public void writeMessage( String message )
+    {
+        writer.println( message );
+
+        writer.flush();
+    }
+
+    public void testSucceeded( ReportEntry report )
+    {
+        super.testSucceeded( report );
+
+        if ( PLAIN.equals( format ) )
+        {
+            testResults.add( getElapsedTimeSummary( report ) );
+        }
+    }
+
+    public void testError( ReportEntry report, String stdOut, String stdErr )
+    {
+        super.testError( report, stdOut, stdErr );
+
+        testResults.add( getOutput( report, "ERROR" ) );
+    }
+
+    public void testFailed( ReportEntry report, String stdOut, String stdErr )
+    {
+        super.testFailed( report, stdOut, stdErr );
+
+        testResults.add( getOutput( report, "FAILURE" ) );
+    }
+
+    public void batteryStarting( ReportEntry report )
+        throws IOException
+    {
+        super.batteryStarting( report );
+
+        testResults = new ArrayList();
+    }
+
+    public void batteryCompleted( ReportEntry report )
+    {
+        super.batteryCompleted( report );
+
+        writeMessage( getBatterySummary() );
+
+        if ( format.equals( BRIEF ) || format.equals( PLAIN ) )
+        {
+            for ( Iterator i = testResults.iterator(); i.hasNext(); )
+            {
+                writeMessage( (String) i.next() );
+            }
+        }
+    }
+
+    protected String getBatterySummary()
+    {
+        StringBuffer batterySummary = new StringBuffer();
+
+        batterySummary.append( "Tests run: " );
+        batterySummary.append( completedCount );
+        batterySummary.append( ", Failures: " );
+        batterySummary.append( failures );
+        batterySummary.append( ", Errors: " );
+        batterySummary.append( errors );
+        batterySummary.append( ", Time elapsed: " );
+        batterySummary.append( elapsedTimeAsString( System.currentTimeMillis() - batteryStartTime
) );
+        batterySummary.append( " sec" );
+
+        if ( failures > 0 || errors > 0 )
+        {
+            batterySummary.append( " <<< FAILURE!" );
+        }
+
+        return batterySummary.toString();
+    }
+
+    protected String getElapsedTimeSummary( ReportEntry report )
+    {
+        StringBuffer reportContent = new StringBuffer();
+        long runTime = this.endTime - this.startTime;
+
+        reportContent.append( report.getName() );
+        reportContent.append( "  Time elapsed: " );
+        reportContent.append( elapsedTimeAsString( runTime ) );
+        reportContent.append( " sec" );
+
+        return reportContent.toString();
+    }
+
+    protected String getOutput( ReportEntry report, String msg )
+    {
+        StringBuffer buf = new StringBuffer();
+
+        buf.append( getElapsedTimeSummary( report ) );
+
+        buf.append( "  <<< " ).append( msg ).append( "!" ).append( NL );
+
+        buf.append( getStackTrace( report ) );
+
+        return buf.toString();
+    }
+}

Propchange: maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/BriefConsoleReporter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/BriefConsoleReporter.java?rev=382008&r1=382007&r2=382008&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/BriefConsoleReporter.java
(original)
+++ maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/BriefConsoleReporter.java
Wed Mar  1 05:08:38 2006
@@ -16,8 +16,6 @@
  * limitations under the License.
  */
 
-import java.io.IOException;
-
 /**
  * Brief format console reporter.
  *
@@ -28,45 +26,8 @@
 public class BriefConsoleReporter
     extends AbstractConsoleReporter
 {
-    protected StringBuffer reportContent;
-
-    public void batteryStarting( ReportEntry report )
-        throws IOException
-    {
-        super.batteryStarting( report );
-
-        reportContent = new StringBuffer();
-    }
-
-    public void batteryCompleted( ReportEntry report )
-    {
-        StringBuffer batterySummary = getBatterySummary();
-
-        batterySummary.append( NL );
-        batterySummary.append( NL );
-
-        batterySummary.append( reportContent );
-
-        writeMessage( batterySummary.toString() );
-    }
-
-    public void testError( ReportEntry report, String stdOut, String stdErr )
-    {
-        super.testError( report, stdOut, stdErr );
-
-        appendOutput( report, "ERROR" );
-    }
-
-    private void appendOutput( ReportEntry report, String msg )
-    {
-        reportContent.append( "[surefire] " );
-        reportContent.append( getOutput( report, msg ) );
-    }
-
-    public void testFailed( ReportEntry report, String stdOut, String stdErr )
+    public BriefConsoleReporter()
     {
-        super.testFailed( report, stdOut, stdErr );
-
-        appendOutput( report, "FAILURE" );
+        super( BRIEF );
     }
 }

Modified: maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/BriefFileReporter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/BriefFileReporter.java?rev=382008&r1=382007&r2=382008&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/BriefFileReporter.java
(original)
+++ maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/BriefFileReporter.java
Wed Mar  1 05:08:38 2006
@@ -25,33 +25,8 @@
 public class BriefFileReporter
     extends AbstractFileReporter
 {
-    public void batteryCompleted( ReportEntry report )
+    public BriefFileReporter()
     {
-        StringBuffer batterySummary = getBatterySummary();
-
-        batterySummary.append( NL );
-        batterySummary.append( NL );
-
-        reportContent = batterySummary.append( reportContent );
-
-        writer.println( batterySummary );
-
-        writer.flush();
-
-        writer.close();
-    }
-
-    public void testError( ReportEntry report, String stdOut, String stdErr )
-    {
-        super.testError( report, stdOut, stdErr );
-
-        reportContent.append( getOutput( report, "ERROR" ) );
-    }
-
-    public void testFailed( ReportEntry report, String stdOut, String stdErr )
-    {
-        super.testFailed( report, stdOut, stdErr );
-
-        reportContent.append( getOutput( report, "FAILURE" ) );
+        super( BRIEF );
     }
 }

Modified: maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/ConsoleReporter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/ConsoleReporter.java?rev=382008&r1=382007&r2=382008&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/ConsoleReporter.java
(original)
+++ maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/ConsoleReporter.java
Wed Mar  1 05:08:38 2006
@@ -25,35 +25,8 @@
 public class ConsoleReporter
     extends AbstractConsoleReporter
 {
-    public void batteryCompleted( ReportEntry report )
+    public ConsoleReporter()
     {
-        StringBuffer batterySummary = getBatterySummary();
-
-        if ( failures > 0 || errors > 0 )
-        {
-            batterySummary.append( " <<< FAILURE! " );
-        }
-
-        writeMessage( batterySummary.toString() );
-    }
-
-    public void runAborted( ReportEntry report )
-    {
-        printAbortionError( "RUN ABORTED", report );
-    }
-
-    public void batteryAborted( ReportEntry report )
-    {
-        printAbortionError( "BATTERY ABORTED", report );
-    }
-
-    private void printAbortionError( String msg, ReportEntry report )
-    {
-        writer.println( msg );
-        writer.println( report.getSource().getClass().getName() );
-        writer.println( report.getName() );
-        writer.println( report.getMessage() );
-        writer.println( report.getThrowable().getMessage() );
-        writer.flush();
+        super( SUMMARY );
     }
 }

Modified: maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/DetailedConsoleReporter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/DetailedConsoleReporter.java?rev=382008&r1=382007&r2=382008&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/DetailedConsoleReporter.java
(original)
+++ maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/DetailedConsoleReporter.java
Wed Mar  1 05:08:38 2006
@@ -23,20 +23,10 @@
  * @version $Id$
  */
 public class DetailedConsoleReporter
-    extends BriefConsoleReporter
+    extends AbstractConsoleReporter
 {
-    public void testStarting( ReportEntry report )
+    public DetailedConsoleReporter()
     {
-        super.testStarting( report );
-
-        reportContent.append( "[surefire] " ).append( report.getName() );
-    }
-
-    public void testSucceeded( ReportEntry report )
-    {
-        super.testSucceeded( report );
-
-        reportContent.append( getElapsedTimeSummary() );
-        reportContent.append( NL );
+        super( PLAIN );
     }
 }

Modified: maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/FileReporter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/FileReporter.java?rev=382008&r1=382007&r2=382008&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/FileReporter.java
(original)
+++ maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/FileReporter.java
Wed Mar  1 05:08:38 2006
@@ -23,20 +23,10 @@
  * @version $Id$
  */
 public class FileReporter
-    extends BriefFileReporter
+    extends AbstractFileReporter
 {
-    public void testStarting( ReportEntry report )
+    public FileReporter()
     {
-        super.testStarting( report );
-
-        reportContent.append( report.getName() );
-    }
-
-    public void testSucceeded( ReportEntry report )
-    {
-        super.testSucceeded( report );
-
-        reportContent.append( getElapsedTimeSummary() );
-        reportContent.append( NL );
+        super( PLAIN );
     }
 }

Modified: maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/ForkingConsoleReporter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/ForkingConsoleReporter.java?rev=382008&r1=382007&r2=382008&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/ForkingConsoleReporter.java
(original)
+++ maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/ForkingConsoleReporter.java
Wed Mar  1 05:08:38 2006
@@ -19,20 +19,21 @@
 public class ForkingConsoleReporter
     extends ConsoleReporter
 {
-    public void runStarting( int testCount )
+    public static final String FORKING_PREFIX_STANDARD = "@SL";
+
+    public static final String FORKING_PREFIX_HEADING = "@HL";
+
+    public void writeHeading( String message )
     {
-        heading( "" );
-        heading( "-------------------------------------------------------" );
-        heading( " T E S T S" );
-        heading( "-------------------------------------------------------" );
+        writer.print( FORKING_PREFIX_HEADING );
 
-        writer.flush();
+        super.writeHeading( message );
     }
 
-    private void heading( String line )
+    public void writeMessage( String message )
     {
-        writer.print( ForkingReport.FORKING_PREFIX_HEADING );
+        writer.print( FORKING_PREFIX_STANDARD );
 
-        writer.println( line );
+        super.writeMessage( message );
     }
 }

Modified: maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/ReporterManager.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/ReporterManager.java?rev=382008&r1=382007&r2=382008&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/ReporterManager.java
(original)
+++ maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/ReporterManager.java
Wed Mar  1 05:08:38 2006
@@ -412,6 +412,9 @@
         return completedCount;
     }
 
+    /**
+     * @todo is this here for throwables? most of these don't throw any checked exceptions
+     */
     private void handleReporterException( String reporterMethod, Exception e )
     {
         String reporterThrewException = Surefire.getResourceString( "reporterThrew" );

Modified: maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/XMLReporter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/XMLReporter.java?rev=382008&r1=382007&r2=382008&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/XMLReporter.java
(original)
+++ maven/surefire/branches/surefire-testng/surefire/src/main/java/org/apache/maven/surefire/report/XMLReporter.java
Wed Mar  1 05:08:38 2006
@@ -22,8 +22,8 @@
 
 import java.io.BufferedWriter;
 import java.io.File;
-import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
+import java.io.IOException;
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.io.UnsupportedEncodingException;
@@ -47,8 +47,6 @@
 
     private Xpp3Dom testCase;
 
-    private long batteryStartTime;
-
     public void setTestCase( Xpp3Dom testCase )
     {
         this.testCase = testCase;
@@ -59,10 +57,14 @@
         return testCase;
     }
 
+    public void writeMessage( String message )
+    {
+    }
+
     public void batteryStarting( ReportEntry report )
-        throws FileNotFoundException, UnsupportedEncodingException
+        throws IOException, UnsupportedEncodingException
     {
-        batteryStartTime = System.currentTimeMillis();
+        super.batteryStarting( report );
 
         File reportFile = new File( getReportsDirectory(), "TEST-" + report.getName() + ".xml"
);
 
@@ -81,13 +83,15 @@
 
     public void batteryCompleted( ReportEntry report )
     {
+        super.batteryCompleted( report );
+
         testSuite.setAttribute( "tests", String.valueOf( this.getNbTests() ) );
 
         testSuite.setAttribute( "errors", String.valueOf( this.getNbErrors() ) );
 
         testSuite.setAttribute( "failures", String.valueOf( this.getNbFailures() ) );
 
-        long runTime = System.currentTimeMillis() - this.batteryStartTime;
+        long runTime = System.currentTimeMillis() - batteryStartTime;
 
         testSuite.setAttribute( "time", elapsedTimeAsString( runTime ) );
 



Mime
View raw message