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/05/01 00:31:00 UTC
svn commit: r1098178 - in /maven/surefire/trunk:
maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/
surefire-api/src/main/java/org/apache/maven/surefire/report/
surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefi...
Author: krosenvold
Date: Sat Apr 30 22:31:00 2011
New Revision: 1098178
URL: http://svn.apache.org/viewvc?rev=1098178&view=rev
Log:
o Fixed console output of test report, slightly botched in r1097246
Added:
maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputDirectReporter.java (with props)
Modified:
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java
maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java
maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java?rev=1098178&r1=1098177&r2=1098178&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java Sat Apr 30 22:31:00 2011
@@ -55,6 +55,7 @@ import org.apache.maven.surefire.booter.
import org.apache.maven.surefire.booter.StartupConfiguration;
import org.apache.maven.surefire.report.BriefConsoleReporter;
import org.apache.maven.surefire.report.BriefFileReporter;
+import org.apache.maven.surefire.report.ConsoleOutputDirectReporter;
import org.apache.maven.surefire.report.ConsoleOutputFileReporter;
import org.apache.maven.surefire.report.ConsoleReporter;
import org.apache.maven.surefire.report.DetailedConsoleReporter;
@@ -266,10 +267,10 @@ public abstract class AbstractSurefireMo
protected ProviderConfiguration createProviderConfiguration( ForkConfiguration forkConfiguration )
throws MojoExecutionException, MojoFailureException
{
- final String consoleReporter = getConsoleReporter();
+ final String consoleReporter = getConsoleResultSummaryReporter();
final String fileReporter = getFileReporter();
final String xmlReporterName = getXmlReporterName();
- final String consoleOutputFileReporterName = getConsoleOutputFileReporterName();
+ final String consoleOutputFileReporterName = getConsoleOutputReporterName();
Integer timeoutSet =
getForkedProcessTimeoutInSeconds() > 0 ? Integer.valueOf( getForkedProcessTimeoutInSeconds() ) : null;
ReporterConfiguration reporterConfiguration =
@@ -1013,12 +1014,8 @@ public abstract class AbstractSurefireMo
*
* @return a console reporter of null if no console reporting
*/
- private String getConsoleReporter()
+ private String getConsoleResultSummaryReporter()
{
- if (isRedirectTestOutputToFile())
- {
- return null;
- }
if ( isUseFile() )
{
return isPrintSummary() ? ConsoleReporter.class.getName() : null;
@@ -1034,13 +1031,16 @@ public abstract class AbstractSurefireMo
return null;
}
- private String getConsoleOutputFileReporterName()
+ private String getConsoleOutputReporterName()
{
if ( isRedirectTestOutputToFile() )
{
return ConsoleOutputFileReporter.class.getName();
}
- return null;
+ else
+ {
+ return ConsoleOutputDirectReporter.class.getName();
+ }
}
Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java?rev=1098178&r1=1098177&r2=1098178&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java (original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java Sat Apr 30 22:31:00 2011
@@ -75,6 +75,14 @@ public abstract class AbstractReporter
writeMessage( footer );
}
+
+ public void writeMessage( byte[] b, int off, int len )
+ {
+ // Keep quiet about console output
+ // Reporting is itching for a cleanup
+ }
+
+
public void testSetStarting( ReportEntry report )
throws ReporterException
{
Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java?rev=1098178&r1=1098177&r2=1098178&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java (original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java Sat Apr 30 22:31:00 2011
@@ -23,7 +23,6 @@ import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import org.apache.maven.surefire.util.internal.ByteBuffer;
/**
* Text based reporter.
@@ -79,15 +78,6 @@ public abstract class AbstractTextReport
}
}
- public void writeMessage( byte[] b, int off, int len )
- {
- if ( writer != null )
- {
- writer.write( ByteBuffer.toChar( b, off, len ) );
- }
- }
-
-
public void writeDetailMessage( String message )
{
writeMessage( message );
Added: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputDirectReporter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputDirectReporter.java?rev=1098178&view=auto
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputDirectReporter.java (added)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputDirectReporter.java Sat Apr 30 22:31:00 2011
@@ -0,0 +1,94 @@
+package org.apache.maven.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 java.io.PrintStream;
+
+/**
+ * Outputs test system out/system err directly to the console
+ * <p/>
+ * Just a step on the road to getting the separation of reporting concerns
+ * operating properly.
+ *
+ * @author Kristian Rosenvold
+ */
+public class ConsoleOutputDirectReporter
+ implements Reporter
+{
+ private final PrintStream reportsDirectory;
+
+ public ConsoleOutputDirectReporter( ReporterConfiguration reporterConfiguration )
+ {
+ this.reportsDirectory = reporterConfiguration.getOriginalSystemOut();
+ }
+
+ public void testSetStarting( ReportEntry reportEntry )
+ {
+ }
+
+ public void testSetCompleted( ReportEntry report )
+ {
+ }
+
+ public void testStarting( ReportEntry report )
+ {
+ }
+
+ public void testSucceeded( ReportEntry report )
+ {
+ }
+
+ public void testError( ReportEntry report )
+ {
+ }
+
+ public void testFailed( ReportEntry report )
+ {
+ }
+
+ public void testSkipped( ReportEntry report )
+ {
+ }
+
+ public void testError( ReportEntry report, String stdOut, String stdErr )
+ {
+ }
+
+ public void testFailed( ReportEntry report, String stdOut, String stdErr )
+ {
+ }
+
+ public void writeMessage( String message )
+ {
+ }
+
+ public void writeMessage( byte[] b, int off, int len )
+ {
+ reportsDirectory.write( b, off, len );
+ }
+
+ public void writeDetailMessage( String message )
+ {
+ }
+
+ public void reset()
+ {
+ }
+}
Propchange: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputDirectReporter.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java?rev=1098178&r1=1098177&r2=1098178&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java (original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java Sat Apr 30 22:31:00 2011
@@ -104,10 +104,6 @@ public class JUnit4Provider
closeRunNotifer( jUnit4TestSetReporter, customRunListeners );
- ConsoleOutputReceiver consoleOutputReceiver = (ConsoleOutputReceiver) reporter;
- final String s = "Done after " + ( System.currentTimeMillis() - start );
- consoleOutputReceiver.writeTestOutput( s.getBytes(), 0, s.getBytes().length, true );
-
//asynchRunListener.close();
return reporterFactory.close();
}