You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ap...@apache.org on 2007/05/14 03:34:18 UTC
svn commit: r537691 [6/11] - in
/maven/sandbox/branches/surefire/surefire-collab2: ./
maven-surefire-plugin/ maven-surefire-plugin/src/
maven-surefire-plugin/src/it/ maven-surefire-plugin/src/it/test1/
maven-surefire-plugin/src/it/test1/src/ maven-sure...
Added: maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/Surefire.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/Surefire.java?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/Surefire.java (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/Surefire.java Sun May 13 18:33:45 2007
@@ -0,0 +1,263 @@
+package org.apache.maven.surefire;
+
+/*
+ * 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 org.apache.maven.surefire.report.Reporter;
+import org.apache.maven.surefire.report.ReporterException;
+import org.apache.maven.surefire.report.ReporterManager;
+import org.apache.maven.surefire.suite.SurefireTestSuite;
+import org.apache.maven.surefire.testset.TestSetFailedException;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.ResourceBundle;
+
+/**
+ * @author Jason van Zyl
+ * @version $Id: Surefire.java 510866 2007-02-23 08:13:49Z brett $
+ */
+public class Surefire
+{
+ private ResourceBundle bundle = ResourceBundle.getBundle( SUREFIRE_BUNDLE_NAME );
+
+ public static final String SUREFIRE_BUNDLE_NAME = "org.apache.maven.surefire.surefire";
+
+ public boolean run( List reportDefinitions, Object[] testSuiteDefinition, String testSetName,
+ ClassLoader surefireClassLoader, ClassLoader testsClassLoader )
+ throws ReporterException, TestSetFailedException
+ {
+ return run( reportDefinitions, testSuiteDefinition, testSetName, surefireClassLoader, testsClassLoader, null );
+ }
+
+ public boolean run( List reportDefinitions, Object[] testSuiteDefinition, String testSetName,
+ ClassLoader surefireClassLoader, ClassLoader testsClassLoader, Properties results )
+ throws ReporterException, TestSetFailedException
+ {
+ ReporterManager reporterManager =
+ new ReporterManager( instantiateReports( reportDefinitions, surefireClassLoader ) );
+
+ if ( results != null )
+ {
+ reporterManager.initResultsFromProperties( results );
+ }
+
+ int totalTests = 0;
+
+ SurefireTestSuite suite =
+ createSuiteFromDefinition( testSuiteDefinition, surefireClassLoader, testsClassLoader );
+
+ int testCount = suite.getNumTests();
+ if ( testCount > 0 )
+ {
+ totalTests += testCount;
+ }
+
+ reporterManager.runStarting( totalTests );
+
+ if ( totalTests == 0 )
+ {
+ reporterManager.writeMessage( "There are no tests to run." );
+ }
+ else
+ {
+ suite.execute( testSetName, reporterManager, testsClassLoader );
+ }
+
+ reporterManager.runCompleted();
+
+ if ( results != null )
+ {
+ reporterManager.updateResultsProperties( results );
+ }
+
+ return reporterManager.getNumErrors() == 0 && reporterManager.getNumFailures() == 0;
+ }
+
+ public boolean run( List reportDefinitions, List testSuiteDefinitions, ClassLoader surefireClassLoader,
+ ClassLoader testsClassLoader )
+ throws ReporterException, TestSetFailedException
+ {
+ ReporterManager reporterManager =
+ new ReporterManager( instantiateReports( reportDefinitions, surefireClassLoader ) );
+
+ List suites = new ArrayList();
+
+ int totalTests = 0;
+ for ( Iterator i = testSuiteDefinitions.iterator(); i.hasNext(); )
+ {
+ Object[] definition = (Object[]) i.next();
+
+ SurefireTestSuite suite = createSuiteFromDefinition( definition, surefireClassLoader, testsClassLoader );
+
+ int testCount = suite.getNumTests();
+ if ( testCount > 0 )
+ {
+ suites.add( suite );
+ totalTests += testCount;
+ }
+ }
+
+ reporterManager.runStarting( totalTests );
+
+ if ( totalTests == 0 )
+ {
+ reporterManager.writeMessage( "There are no tests to run." );
+ }
+ else
+ {
+ for ( Iterator i = suites.iterator(); i.hasNext(); )
+ {
+ SurefireTestSuite suite = (SurefireTestSuite) i.next();
+ suite.execute( reporterManager, testsClassLoader );
+ }
+ }
+
+ reporterManager.runCompleted();
+
+ return reporterManager.getNumErrors() == 0 && reporterManager.getNumFailures() == 0;
+ }
+
+ private SurefireTestSuite createSuiteFromDefinition( Object[] definition, ClassLoader surefireClassLoader,
+ ClassLoader testsClassLoader )
+ throws TestSetFailedException
+ {
+ String suiteClass = (String) definition[0];
+ Object[] params = (Object[]) definition[1];
+
+ SurefireTestSuite suite = instantiateSuite( suiteClass, params, surefireClassLoader );
+
+ suite.locateTestSets( testsClassLoader );
+
+ return suite;
+ }
+
+ private List instantiateReports( List reportDefinitions, ClassLoader classLoader )
+ throws TestSetFailedException
+ {
+ List reports = new ArrayList();
+
+ for ( Iterator i = reportDefinitions.iterator(); i.hasNext(); )
+ {
+ Object[] definition = (Object[]) i.next();
+
+ String className = (String) definition[0];
+ Object[] params = (Object[]) definition[1];
+
+ Reporter report = instantiateReport( className, params, classLoader );
+
+ reports.add( report );
+ }
+
+ return reports;
+ }
+
+ private static Reporter instantiateReport( String className, Object[] params, ClassLoader classLoader )
+ throws TestSetFailedException
+ {
+ try
+ {
+ return (Reporter) instantiateObject( className, params, classLoader );
+ }
+ catch ( ClassNotFoundException e )
+ {
+ throw new TestSetFailedException( "Unable to find class to create report '" + className + "'", e );
+ }
+ catch ( NoSuchMethodException e )
+ {
+ throw new TestSetFailedException(
+ "Unable to find appropriate constructor to create report: " + e.getMessage(), e );
+ }
+ }
+
+ public static Object instantiateObject( String className, Object[] params, ClassLoader classLoader )
+ throws TestSetFailedException, ClassNotFoundException, NoSuchMethodException
+ {
+ Class clazz = classLoader.loadClass( className );
+
+ Object object;
+ try
+ {
+ if ( params != null )
+ {
+ Class[] paramTypes = new Class[params.length];
+
+ for ( int j = 0; j < params.length; j++ )
+ {
+ if ( params[j] == null )
+ {
+ paramTypes[j] = String.class;
+ }
+ else
+ {
+ paramTypes[j] = params[j].getClass();
+ }
+ }
+
+ Constructor constructor = clazz.getConstructor( paramTypes );
+
+ object = constructor.newInstance( params );
+ }
+ else
+ {
+ object = clazz.newInstance();
+ }
+ }
+ catch ( IllegalAccessException e )
+ {
+ throw new TestSetFailedException( "Unable to instantiate object: " + e.getMessage(), e );
+ }
+ catch ( InvocationTargetException e )
+ {
+ throw new TestSetFailedException( e.getTargetException().getMessage(), e.getTargetException() );
+ }
+ catch ( InstantiationException e )
+ {
+ throw new TestSetFailedException( "Unable to instantiate object: " + e.getMessage(), e );
+ }
+ return object;
+ }
+
+ private static SurefireTestSuite instantiateSuite( String suiteClass, Object[] params, ClassLoader classLoader )
+ throws TestSetFailedException
+ {
+ try
+ {
+ return (SurefireTestSuite) instantiateObject( suiteClass, params, classLoader );
+ }
+ catch ( ClassNotFoundException e )
+ {
+ throw new TestSetFailedException( "Unable to find class to create suite '" + suiteClass + "'", e );
+ }
+ catch ( NoSuchMethodException e )
+ {
+ throw new TestSetFailedException(
+ "Unable to find appropriate constructor to create suite: " + e.getMessage(), e );
+ }
+ }
+
+ public String getResourceString( String key )
+ {
+ return bundle.getString( key );
+ }
+}
Added: maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/assertion/ComparisonTool.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/assertion/ComparisonTool.java?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/assertion/ComparisonTool.java (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/assertion/ComparisonTool.java Sun May 13 18:33:45 2007
@@ -0,0 +1,126 @@
+package org.apache.maven.surefire.assertion;
+
+/*
+ * 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.
+ */
+
+/**
+ * Utilities for displaying comparison failures.
+ */
+public class ComparisonTool
+{
+ private ComparisonTool()
+ {
+ }
+
+ /**
+ * Returns "..." in place of common prefix and "..." in
+ * place of common suffix between expected and actual.
+ * <p/>
+ * Inspired by a patch from Alex Chaffee mailto:alex@purpletech.com
+ *
+ * @param message the message to go along with the comparison
+ * @param expected the expected value
+ * @param actual the actual value
+ * @return the reduced comparison
+ */
+ static String trimComparison( String message, String expected, String actual )
+ {
+ String actualValue;
+ String expectedValue;
+
+ if ( expected == null && actual == null )
+ {
+ throw new IllegalArgumentException( "Cannot pass both expected and actual as null" );
+ }
+ else if ( expected == null || actual == null )
+ {
+ actualValue = actual;
+ expectedValue = expected;
+ }
+ else
+ {
+ int end = Math.min( expected.length(), actual.length() );
+
+ int i = 0;
+ for ( ; i < end; i++ )
+ {
+ if ( expected.charAt( i ) != actual.charAt( i ) )
+ {
+ break;
+ }
+ }
+ int j = expected.length() - 1;
+ int k = actual.length() - 1;
+ for ( ; k >= i && j >= i; k--, j-- )
+ {
+ if ( expected.charAt( j ) != actual.charAt( k ) )
+ {
+ break;
+ }
+ }
+
+ // equal strings
+ if ( j < i && k < i )
+ {
+ throw new IllegalArgumentException( "expected and actual cannot be the same" );
+ }
+ else
+ {
+ expectedValue = expected.substring( i, j + 1 );
+ actualValue = actual.substring( i, k + 1 );
+ if ( i <= end && i > 0 )
+ {
+ expectedValue = "..." + expectedValue;
+ actualValue = "..." + actualValue;
+ }
+
+ if ( j < expected.length() - 1 )
+ {
+ expectedValue = expectedValue + "...";
+ }
+ if ( k < actual.length() - 1 )
+ {
+ actualValue = actualValue + "...";
+ }
+ }
+ }
+ return formatMismatch( message, expectedValue, actualValue );
+ }
+
+ /**
+ * Format a message for a comparison failure.
+ *
+ * @param message the message to go with the failure
+ * @param expected the expected value
+ * @param actual the actual value
+ * @return the formatted string
+ */
+ static String formatMismatch( String message, Object expected, Object actual )
+ {
+ String formatted = "";
+
+ if ( message != null )
+ {
+ formatted = message + " ";
+ }
+
+ // TODO! i18n
+ return formatted + "expected:<" + expected + "> but was:<" + actual + ">";
+ }
+}
Added: maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/assertion/SurefireAssert.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/assertion/SurefireAssert.java?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/assertion/SurefireAssert.java (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/assertion/SurefireAssert.java Sun May 13 18:33:45 2007
@@ -0,0 +1,317 @@
+package org.apache.maven.surefire.assertion;
+
+/*
+ * 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.
+ */
+
+public class SurefireAssert
+{
+ private SurefireAssert()
+ {
+ // No touchy.
+ }
+
+ public static void fail()
+ {
+ throw new SurefireAssertionFailedException();
+ }
+
+ public static void fail( String message )
+ {
+ if ( message == null )
+ {
+ throw new NullPointerException( "message is null" );
+ }
+ throw new SurefireAssertionFailedException( message );
+ }
+
+ public static void fail( String message, Throwable cause )
+ {
+ if ( message == null )
+ {
+ throw new NullPointerException( "message is null" );
+ }
+
+ if ( cause == null )
+ {
+ throw new NullPointerException( "cause is null" );
+ }
+
+ throw new SurefireAssertionFailedException( message, cause );
+ }
+
+ public static void fail( Throwable cause )
+ {
+ if ( cause == null )
+ {
+ throw new NullPointerException( "cause is null" );
+ }
+
+ throw new SurefireAssertionFailedException( cause );
+ }
+
+ // ----------------------------------------------------------------------
+ // JUnit type assertions
+ // ----------------------------------------------------------------------
+
+ public static void assertTrue( String message, boolean condition )
+ {
+ if ( !condition )
+ {
+ if ( message != null )
+ {
+ fail( message );
+ }
+ else
+ {
+ fail();
+ }
+ }
+ }
+
+ public static void assertTrue( boolean condition )
+ {
+ assertTrue( null, condition );
+ }
+
+ public static void assertFalse( String message, boolean condition )
+ {
+ assertTrue( message, !condition );
+ }
+
+ public static void assertFalse( boolean condition )
+ {
+ assertFalse( null, condition );
+ }
+
+ public static void assertEquals( String message, Object expected, Object actual )
+ {
+ if ( expected != null || actual != null )
+ {
+ if ( expected == null || !expected.equals( actual ) )
+ {
+ failNotEquals( message, expected, actual );
+ }
+ }
+ }
+
+ public static void assertEquals( Object expected, Object actual )
+ {
+ assertEquals( null, expected, actual );
+ }
+
+ public static void assertEquals( String message, String expected, String actual )
+ {
+ if ( expected != null || actual != null )
+ {
+ if ( expected == null || !expected.equals( actual ) )
+ {
+ throw new SurefireComparisonFailureException( message, expected, actual );
+ }
+ }
+ }
+
+ public static void assertEquals( String expected, String actual )
+ {
+ assertEquals( null, expected, actual );
+ }
+
+ public static void assertEquals( String message, double expected, double actual, double delta )
+ {
+ // handle infinity specially since subtracting to infinite values gives NaN and the
+ // the following test fails
+ if ( Double.isInfinite( expected ) )
+ {
+ if ( !Double.isInfinite( actual ) )
+ {
+ failNotEquals( message, new Double( expected ), new Double( actual ) );
+ }
+ }
+ else if ( !( Math.abs( expected - actual ) <= delta ) ) // Because comparison with NaN always returns false
+ {
+ failNotEquals( message, new Double( expected ), new Double( actual ) );
+ }
+ }
+
+ public static void assertEquals( double expected, double actual, double delta )
+ {
+ assertEquals( null, expected, actual, delta );
+ }
+
+ public static void assertEquals( String message, float expected, float actual, float delta )
+ {
+ // handle infinity specially since subtracting to infinite values gives NaN and the
+ // the following test fails
+ if ( Float.isInfinite( expected ) )
+ {
+ if ( !Float.isInfinite( actual ) )
+ {
+ failNotEquals( message, new Float( expected ), new Float( actual ) );
+ }
+
+ }
+ else if ( !( Math.abs( expected - actual ) <= delta ) )
+ {
+ failNotEquals( message, new Float( expected ), new Float( actual ) );
+ }
+ }
+
+ public static void assertEquals( float expected, float actual, float delta )
+ {
+ assertEquals( null, expected, actual, delta );
+ }
+
+ public static void assertEquals( String message, long expected, long actual )
+ {
+ assertEquals( message, new Long( expected ), new Long( actual ) );
+ }
+
+ public static void assertEquals( long expected, long actual )
+ {
+ assertEquals( null, expected, actual );
+ }
+
+ public static void assertEquals( String message, boolean expected, boolean actual )
+ {
+ assertEquals( message, expected ? Boolean.TRUE : Boolean.FALSE, actual ? Boolean.TRUE : Boolean.FALSE );
+ }
+
+ public static void assertEquals( boolean expected, boolean actual )
+ {
+ assertEquals( null, expected, actual );
+ }
+
+ public static void assertEquals( String message, byte expected, byte actual )
+ {
+ assertEquals( message, new Byte( expected ), new Byte( actual ) );
+ }
+
+ public static void assertEquals( byte expected, byte actual )
+ {
+ assertEquals( null, expected, actual );
+ }
+
+ public static void assertEquals( String message, char expected, char actual )
+ {
+ assertEquals( message, new Character( expected ), new Character( actual ) );
+ }
+
+ public static void assertEquals( char expected, char actual )
+ {
+ assertEquals( null, expected, actual );
+ }
+
+ public static void assertEquals( String message, short expected, short actual )
+ {
+ assertEquals( message, new Short( expected ), new Short( actual ) );
+ }
+
+ public static void assertEquals( short expected, short actual )
+ {
+ assertEquals( null, expected, actual );
+ }
+
+ public static void assertEquals( String message, int expected, int actual )
+ {
+ assertEquals( message, new Integer( expected ), new Integer( actual ) );
+ }
+
+ public static void assertEquals( int expected, int actual )
+ {
+ assertEquals( null, expected, actual );
+ }
+
+ public static void assertNotNull( Object object )
+ {
+ assertNotNull( null, object );
+ }
+
+ public static void assertNotNull( String message, Object object )
+ {
+ assertTrue( message, object != null );
+ }
+
+ public static void assertNull( Object object )
+ {
+ assertNull( null, object );
+ }
+
+ public static void assertNull( String message, Object object )
+ {
+ assertTrue( message, object == null );
+ }
+
+ public static void assertSame( String message, Object expected, Object actual )
+ {
+ //noinspection ObjectEquality
+ if ( expected != actual )
+ {
+ failNotSame( message, expected, actual );
+ }
+ }
+
+ public static void assertSame( Object expected, Object actual )
+ {
+ assertSame( null, expected, actual );
+ }
+
+ public static void assertNotSame( String message, Object expected, Object actual )
+ {
+ //noinspection ObjectEquality
+ if ( expected == actual )
+ {
+ failSame( message );
+ }
+ }
+
+ public static void assertNotSame( Object expected, Object actual )
+ {
+ assertNotSame( null, expected, actual );
+ }
+
+ private static void failSame( String message )
+ {
+ String formatted = "";
+
+ if ( message != null )
+ {
+ formatted = message + " ";
+ }
+
+ // TODO! i18n
+ fail( formatted + "expected not same" );
+ }
+
+ private static void failNotSame( String message, Object expected, Object actual )
+ {
+ String formatted = "";
+
+ if ( message != null )
+ {
+ formatted = message + " ";
+ }
+
+ // TODO! i18n
+ fail( formatted + "expected same:<" + expected + "> was not:<" + actual + ">" );
+ }
+
+ private static void failNotEquals( String message, Object expected, Object actual )
+ {
+ fail( ComparisonTool.formatMismatch( message, expected, actual ) );
+ }
+}
Added: maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/assertion/SurefireAssertionFailedException.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/assertion/SurefireAssertionFailedException.java?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/assertion/SurefireAssertionFailedException.java (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/assertion/SurefireAssertionFailedException.java Sun May 13 18:33:45 2007
@@ -0,0 +1,48 @@
+package org.apache.maven.surefire.assertion;
+
+/*
+ * 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 org.apache.maven.surefire.util.NestedRuntimeException;
+
+/**
+ * @noinspection UncheckedExceptionClass
+ */
+public class SurefireAssertionFailedException
+ extends NestedRuntimeException
+{
+ public SurefireAssertionFailedException()
+ {
+ }
+
+ public SurefireAssertionFailedException( String message )
+ {
+ super( message );
+ }
+
+ public SurefireAssertionFailedException( Throwable cause )
+ {
+ super( cause );
+ }
+
+ public SurefireAssertionFailedException( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+}
\ No newline at end of file
Added: maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/assertion/SurefireComparisonFailureException.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/assertion/SurefireComparisonFailureException.java?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/assertion/SurefireComparisonFailureException.java (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/assertion/SurefireComparisonFailureException.java Sun May 13 18:33:45 2007
@@ -0,0 +1,41 @@
+package org.apache.maven.surefire.assertion;
+
+/*
+ * 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.
+ */
+
+/**
+ * Thrown when an assertion equals for Strings failed.
+ *
+ * @noinspection UncheckedExceptionClass
+ */
+public class SurefireComparisonFailureException
+ extends SurefireAssertionFailedException
+{
+ /**
+ * Constructs a comparison failure.
+ *
+ * @param message the identifying message or null
+ * @param expected the expected string value
+ * @param actual the actual string value
+ */
+ public SurefireComparisonFailureException( String message, String expected, String actual )
+ {
+ super( ComparisonTool.trimComparison( message, expected, actual ) );
+ }
+}
Added: maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractConsoleReporter.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractConsoleReporter.java?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractConsoleReporter.java (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractConsoleReporter.java Sun May 13 18:33:45 2007
@@ -0,0 +1,159 @@
+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.BufferedOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+
+/**
+ * Base class for console reporters.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public abstract class AbstractConsoleReporter
+ extends AbstractTextReporter
+{
+ private static final String TEST_SET_STARTING_PREFIX = "Running ";
+
+ private static final String TEST_SET_STARTING_GROUP_PREFIX = " (of ";
+
+ private static final String TEST_SET_STARTING_GROUP_SUFIX = ")";
+
+ protected static final int BUFFER_SIZE = 4096;
+
+ protected AbstractConsoleReporter( String format, Boolean trimStackTrace )
+ {
+ // TODO: use logger
+ super( new PrintWriter( new OutputStreamWriter( new BufferedOutputStream( System.out, BUFFER_SIZE ) ) ), format,
+ trimStackTrace );
+ }
+
+ public void testSetStarting( ReportEntry report )
+ throws ReporterException
+ {
+ super.testSetStarting( report );
+
+ writeMessage( getTestSetStartingMessage( report ) );
+ }
+
+ public void runStarting( int testCount )
+ {
+ writeHeading( "" );
+ writeHeading( "-------------------------------------------------------" );
+ writeHeading( " T E S T S" );
+ writeHeading( "-------------------------------------------------------" );
+ }
+
+ public void writeHeading( String message )
+ {
+ writer.println( message );
+ writer.flush();
+ }
+
+ public void runAborted( ReportEntry report )
+ {
+ printAbortionError( "RUN ABORTED", report );
+ }
+
+ public void testSetAborted( ReportEntry report )
+ {
+ printAbortionError( "TEST SET 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( getStackTrace( report ) );
+ writer.flush();
+ }
+
+ /**
+ * Get the test set starting message for a report.
+ * eg. "Running org.foo.BarTest ( of group )"
+ *
+ * @param report report whose test set is starting
+ * @return the message
+ * @todo internationalize
+ */
+ public static String getTestSetStartingMessage( ReportEntry report )
+ {
+ StringBuffer message = new StringBuffer();
+ message.append( TEST_SET_STARTING_PREFIX );
+ message.append( report.getName() );
+
+ if ( report.getGroup() != null && !report.getName().equals( report.getGroup() ) )
+ {
+ message.append( TEST_SET_STARTING_GROUP_PREFIX );
+ message.append( report.getGroup() );
+ message.append( TEST_SET_STARTING_GROUP_SUFIX );
+ }
+ return message.toString();
+ }
+
+ /**
+ * Parses a Surefire test set starting message into a {@link ReportEntry} object.
+ * Only name and group will be set if applicable.
+ *
+ * @param message
+ * @return the parsed {@link ReportEntry}
+ */
+ public static ReportEntry parseTestSetStartingMessage( String message )
+ {
+ ReportEntry reportEntry = new ReportEntry();
+ int i = message.indexOf( TEST_SET_STARTING_GROUP_PREFIX );
+ int j;
+ if ( i >= 0 )
+ {
+ j = message.indexOf( TEST_SET_STARTING_GROUP_SUFIX );
+ if ( j <= 0 )
+ {
+ throw new RuntimeException( "Message provided can not be parsed" );
+ }
+ reportEntry.setGroup( message.substring( i + TEST_SET_STARTING_GROUP_PREFIX.length(), j ) );
+ }
+ else
+ {
+ i = message.length();
+ if ( i <= 0 )
+ {
+ throw new RuntimeException( "Message provided can not be parsed" );
+ }
+ }
+ reportEntry.setName( message.substring( TEST_SET_STARTING_PREFIX.length(), i ) );
+ return reportEntry;
+ }
+
+ /**
+ * Check if the String passed as argument is a "test starting" message.
+ * If so it can be passed to {@link #parseTestSetStartingMessage(String)}
+ *
+ * @param message the message to check
+ * @return true if it is a "test starting" message
+ */
+ public static boolean isTestSetStartingMessage( String message )
+ {
+ return message.startsWith( TEST_SET_STARTING_PREFIX );
+ }
+
+}
Added: maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractFileReporter.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractFileReporter.java?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractFileReporter.java (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractFileReporter.java Sun May 13 18:33:45 2007
@@ -0,0 +1,84 @@
+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.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * Base class for file reporters.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public abstract class AbstractFileReporter
+ extends AbstractTextReporter
+{
+ private File reportsDirectory;
+
+ protected AbstractFileReporter( File reportsDirectory, String format, Boolean trimStackTrace )
+ {
+ super( format, trimStackTrace );
+
+ this.reportsDirectory = reportsDirectory;
+ }
+
+ public void testSetStarting( ReportEntry report )
+ throws ReporterException
+ {
+ super.testSetStarting( report );
+
+ File reportFile = new File( reportsDirectory, report.getName() + ".txt" );
+
+ File reportDir = reportFile.getParentFile();
+
+ reportDir.mkdirs();
+
+ try
+ {
+ PrintWriter writer = new PrintWriter( new FileWriter( reportFile ) );
+
+ writer.println( "-------------------------------------------------------------------------------" );
+
+ writer.println( "Test set: " + report.getName() );
+
+ writer.println( "-------------------------------------------------------------------------------" );
+
+ setWriter( writer );
+ }
+ catch ( IOException e )
+ {
+ throw new ReporterException( "Unable to create file for report: " + e.getMessage(), e );
+ }
+ }
+
+ public void testSetCompleted( ReportEntry report )
+ throws ReporterException
+ {
+ super.testSetCompleted( report );
+
+ writer.flush();
+
+ writer.close();
+
+ writer = null;
+ }
+}
Added: maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java Sun May 13 18:33:45 2007
@@ -0,0 +1,234 @@
+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.text.NumberFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
+ * @version $Id: AbstractReporter.java 510866 2007-02-23 08:13:49Z brett $
+ */
+public abstract class AbstractReporter
+ implements Reporter
+{
+ protected int completedCount;
+
+ protected int errors;
+
+ /**
+ * Holds the source(s) that causes the error(s).
+ */
+ private Collection errorSources = new ArrayList();
+
+ protected int failures;
+
+ /**
+ * Holds the source(s) that causes the failure(s).
+ */
+ private Collection failureSources = new ArrayList();
+
+ protected long startTime;
+
+ protected long endTime;
+
+ private NumberFormat numberFormat = NumberFormat.getInstance( Locale.ENGLISH );
+
+ protected static final String NL = System.getProperty( "line.separator" );
+
+ private static final int MS_PER_SEC = 1000;
+
+ protected long testSetStartTime;
+
+ protected int skipped;
+
+ private boolean trimStackTrace;
+
+ // ----------------------------------------------------------------------
+ // Report interface
+ // ----------------------------------------------------------------------
+
+
+ protected AbstractReporter( Boolean trimStackTrace )
+ {
+ this.trimStackTrace = trimStackTrace.booleanValue();
+ }
+
+ public void writeFooter( String footer )
+ {
+ writeMessage( footer );
+ }
+
+ public void runStarting( int testCount )
+ {
+ }
+
+ public void runCompleted()
+ {
+ }
+
+ public void runStopped()
+ {
+ }
+
+ public void runAborted( ReportEntry report )
+ {
+ }
+
+ public void testSetStarting( ReportEntry report )
+ throws ReporterException
+ {
+ testSetStartTime = System.currentTimeMillis();
+ }
+
+ public void testSetCompleted( ReportEntry report )
+ throws ReporterException
+ {
+ }
+
+ public void testSetAborted( ReportEntry report )
+ {
+ }
+
+ /**
+ * @see org.apache.maven.surefire.report.Reporter#getFailureSources()
+ */
+ public Collection getFailureSources()
+ {
+ return this.failureSources;
+ }
+
+ /**
+ * @see org.apache.maven.surefire.report.Reporter#getErrorSources()
+ */
+ public Collection getErrorSources()
+ {
+ return this.errorSources;
+ }
+
+ // ----------------------------------------------------------------------
+ // Test
+ // ----------------------------------------------------------------------
+
+ public void testStarting( ReportEntry report )
+ {
+ startTime = System.currentTimeMillis();
+ }
+
+ public void testSucceeded( ReportEntry report )
+ {
+ endTest();
+ }
+
+ public void testSkipped( ReportEntry report )
+ {
+ ++skipped;
+
+ endTest();
+ }
+
+ public void testError( ReportEntry report, String stdOut, String stdErr )
+ {
+ ++errors;
+ errorSources.add( report.getName() );
+ endTest();
+ }
+
+ public void testFailed( ReportEntry report, String stdOut, String stdErr )
+ {
+ ++failures;
+ failureSources.add( report.getName() );
+ endTest();
+ }
+
+ private void endTest()
+ {
+ ++completedCount;
+
+ endTime = System.currentTimeMillis();
+ }
+
+ // ----------------------------------------------------------------------
+ // Counters
+ // ----------------------------------------------------------------------
+
+ public int getNumErrors()
+ {
+ return errors;
+ }
+
+ public int getNumSkipped()
+ {
+ return skipped;
+ }
+
+ public int getNumFailures()
+ {
+ return failures;
+ }
+
+ public int getNumTests()
+ {
+ return completedCount;
+ }
+
+ // ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
+ public void reset()
+ {
+ errors = 0;
+
+ skipped = 0;
+
+ failures = 0;
+
+ completedCount = 0;
+
+ this.failureSources = new ArrayList();
+
+ this.errorSources = new ArrayList();
+
+ }
+
+ // ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
+ protected String elapsedTimeAsString( long runTime )
+ {
+ return numberFormat.format( (double) runTime / MS_PER_SEC );
+ }
+
+ /**
+ * Returns stacktrace as String.
+ *
+ * @param report ReportEntry object.
+ * @return stacktrace as string.
+ */
+ protected String getStackTrace( ReportEntry report )
+ {
+ return trimStackTrace ? report.getStackTraceWriter().writeTrimmedTraceToString()
+ : report.getStackTraceWriter().writeTraceToString();
+ }
+}
Added: maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java Sun May 13 18:33:45 2007
@@ -0,0 +1,199 @@
+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.PrintWriter;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * 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 static final String TEST_SET_COMPLETED_PREFIX = "Tests run: ";
+
+ private final String format;
+
+ private List testResults;
+
+ protected AbstractTextReporter( String format, Boolean trimStackTrace )
+ {
+ super( trimStackTrace );
+
+ this.format = format;
+ }
+
+ protected AbstractTextReporter( PrintWriter writer, String format, Boolean trimStackTrace )
+ {
+ super( trimStackTrace );
+
+ this.writer = writer;
+
+ this.format = format;
+ }
+
+ public void setWriter( PrintWriter writer )
+ {
+ this.writer = writer;
+ }
+
+ public void writeMessage( String message )
+ {
+ if ( writer != null )
+ {
+ writer.println( message );
+
+ writer.flush();
+ }
+ }
+
+ public void testSucceeded( ReportEntry report )
+ {
+ super.testSucceeded( report );
+
+ if ( PLAIN.equals( format ) )
+ {
+ testResults.add( getElapsedTimeSummary( report ) );
+ }
+ }
+
+ public void testSkipped( ReportEntry report )
+ {
+ super.testSkipped( report );
+
+ if ( PLAIN.equals( format ) )
+ {
+ testResults.add( report.getName() + " skipped" );
+ }
+ }
+
+ 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 testSetStarting( ReportEntry report )
+ throws ReporterException
+ {
+ super.testSetStarting( report );
+
+ testResults = new ArrayList();
+ }
+
+ public void testSetCompleted( ReportEntry report )
+ throws ReporterException
+ {
+ super.testSetCompleted( report );
+
+ writeMessage( getTestSetSummary() );
+
+ if ( format.equals( BRIEF ) || format.equals( PLAIN ) )
+ {
+ for ( Iterator i = testResults.iterator(); i.hasNext(); )
+ {
+ writeMessage( (String) i.next() );
+ }
+ }
+ }
+
+ protected String getTestSetSummary()
+ {
+ StringBuffer buf = new StringBuffer();
+
+ buf.append( TEST_SET_COMPLETED_PREFIX );
+ buf.append( completedCount );
+ buf.append( ", Failures: " );
+ buf.append( failures );
+ buf.append( ", Errors: " );
+ buf.append( errors );
+ buf.append( ", Skipped: " );
+ buf.append( skipped );
+ buf.append( ", Time elapsed: " );
+ buf.append( elapsedTimeAsString( System.currentTimeMillis() - testSetStartTime ) );
+ buf.append( " sec" );
+
+ if ( failures > 0 || errors > 0 )
+ {
+ buf.append( " <<< FAILURE!" );
+ }
+
+ return buf.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();
+ }
+
+ /**
+ * Check if the String passed as argument is a "test set completed" message.
+ *
+ * @param message the message to check
+ * @return true if it is a "test set completed" message
+ */
+ public static boolean isTestSetCompletedMessage( String message )
+ {
+ return message.startsWith( TEST_SET_COMPLETED_PREFIX );
+ }
+
+}
Added: maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/BriefConsoleReporter.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/BriefConsoleReporter.java?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/BriefConsoleReporter.java (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/BriefConsoleReporter.java Sun May 13 18:33:45 2007
@@ -0,0 +1,36 @@
+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.
+ */
+
+/**
+ * Brief format console reporter.
+ *
+ * @author <a href="mailto:jruiz@exist.com">Johnny R. Ruiz III</a>
+ * @version $Id: BriefConsoleReporter.java 510866 2007-02-23 08:13:49Z brett $
+ */
+
+public class BriefConsoleReporter
+ extends AbstractConsoleReporter
+{
+ public BriefConsoleReporter( Boolean trimStackTrace )
+ {
+ super( BRIEF, trimStackTrace );
+ }
+}
Added: maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/BriefFileReporter.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/BriefFileReporter.java?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/BriefFileReporter.java (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/BriefFileReporter.java Sun May 13 18:33:45 2007
@@ -0,0 +1,37 @@
+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.File;
+
+/**
+ * Brief format file reporter.
+ *
+ * @author <a href="mailto:jruiz@exist.com">Johnny R. Ruiz III</a>
+ * @version $Id: BriefFileReporter.java 510866 2007-02-23 08:13:49Z brett $
+ */
+public class BriefFileReporter
+ extends AbstractFileReporter
+{
+ public BriefFileReporter( File reportsDirectory, Boolean trimStackTrace )
+ {
+ super( reportsDirectory, BRIEF, trimStackTrace );
+ }
+}
Added: maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleReporter.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleReporter.java?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleReporter.java (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleReporter.java Sun May 13 18:33:45 2007
@@ -0,0 +1,35 @@
+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.
+ */
+
+/**
+ * Console reporter.
+ *
+ * @author <a href="mailto:jruiz@exist.com">Johnny R. Ruiz III</a>
+ * @version $Id: ConsoleReporter.java 510866 2007-02-23 08:13:49Z brett $
+ */
+public class ConsoleReporter
+ extends AbstractConsoleReporter
+{
+ public ConsoleReporter( Boolean trimStackTrace )
+ {
+ super( SUMMARY, trimStackTrace );
+ }
+}
Added: maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/DetailedConsoleReporter.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/DetailedConsoleReporter.java?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/DetailedConsoleReporter.java (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/DetailedConsoleReporter.java Sun May 13 18:33:45 2007
@@ -0,0 +1,35 @@
+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.
+ */
+
+/**
+ * Detailed console reporter.
+ *
+ * @author <a href="mailto:jruiz@exist.com">Johnny R. Ruiz III</a>
+ * @version $Id: DetailedConsoleReporter.java 510866 2007-02-23 08:13:49Z brett $
+ */
+public class DetailedConsoleReporter
+ extends AbstractConsoleReporter
+{
+ public DetailedConsoleReporter( Boolean trimStackTrace )
+ {
+ super( PLAIN, trimStackTrace );
+ }
+}
Added: maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/FileReporter.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/FileReporter.java?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/FileReporter.java (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/FileReporter.java Sun May 13 18:33:45 2007
@@ -0,0 +1,37 @@
+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.File;
+
+/**
+ * Text file reporter.
+ *
+ * @author <a href="mailto:jruiz@exist.com">Johnny R. Ruiz III</a>
+ * @version $Id: FileReporter.java 510866 2007-02-23 08:13:49Z brett $
+ */
+public class FileReporter
+ extends AbstractFileReporter
+{
+ public FileReporter( File reportsDirectory, Boolean trimStackTrace )
+ {
+ super( reportsDirectory, PLAIN, trimStackTrace );
+ }
+}
Added: maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/ForkingConsoleReporter.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/ForkingConsoleReporter.java?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/ForkingConsoleReporter.java (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/ForkingConsoleReporter.java Sun May 13 18:33:45 2007
@@ -0,0 +1,81 @@
+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.
+ */
+
+/**
+ * Surefire reporter that will prefix surefire output to make it easier to parse when forking tests
+ *
+ * @version $Id: ForkingConsoleReporter.java 510866 2007-02-23 08:13:49Z brett $
+ */
+public class ForkingConsoleReporter
+ extends ConsoleReporter
+{
+ /**
+ * Surefire output lines not part of header or footer, nor test output will start with this value.
+ * eg. "Running org.foo.BarTest" or "Tests run: ..."
+ */
+ public static final String FORKING_PREFIX_STANDARD = "@SL";
+
+ /**
+ * Surefire output lines part of the header will start with this value
+ */
+ public static final String FORKING_PREFIX_HEADING = "@HL";
+
+ /**
+ * Surefire output lines part of the footer will start with this value
+ */
+ public static final String FORKING_PREFIX_FOOTER = "@FL";
+
+ public ForkingConsoleReporter( Boolean trimStackTrace )
+ {
+ super( trimStackTrace );
+ }
+
+ /**
+ * Write a header line prepending {@link #FORKING_PREFIX_HEADING}
+ */
+ public void writeHeading( String message )
+ {
+ writer.print( FORKING_PREFIX_HEADING );
+
+ super.writeHeading( message );
+ }
+
+ /**
+ * Write a footer line prepending {@link #FORKING_PREFIX_FOOTER}
+ */
+ public void writeFooter( String footer )
+ {
+ writer.print( FORKING_PREFIX_FOOTER );
+
+ // Deliberately set to writeMessage
+ super.writeMessage( footer );
+ }
+
+ /**
+ * Write a surefire message line prepending {@link #FORKING_PREFIX_STANDARD}
+ */
+ public void writeMessage( String message )
+ {
+ writer.print( FORKING_PREFIX_STANDARD );
+
+ super.writeMessage( message );
+ }
+}
Added: maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/PojoStackTraceWriter.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/PojoStackTraceWriter.java?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/PojoStackTraceWriter.java (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/PojoStackTraceWriter.java Sun May 13 18:33:45 2007
@@ -0,0 +1,102 @@
+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 org.codehaus.plexus.util.StringUtils;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+/**
+ * Write the trace out for a POJO test.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public class PojoStackTraceWriter
+ implements StackTraceWriter
+{
+ private final Throwable t;
+
+ protected final String testClass;
+
+ protected final String testMethod;
+
+ public PojoStackTraceWriter( String testClass, String testMethod, Throwable t )
+ {
+ this.testClass = testClass;
+ this.testMethod = testMethod;
+ this.t = t;
+ }
+
+ public String writeTraceToString()
+ {
+ StringWriter w = new StringWriter();
+ t.printStackTrace( new PrintWriter( w ) );
+ w.flush();
+ return w.toString();
+ }
+
+ public String writeTrimmedTraceToString()
+ {
+ String text = writeTraceToString();
+
+ String marker = "at " + testClass + "." + testMethod;
+
+ String[] lines = StringUtils.split( text, "\n" );
+ int lastLine = lines.length - 1;
+ // skip first
+ for ( int i = 1; i < lines.length; i++ )
+ {
+ if ( lines[i].trim().startsWith( marker ) )
+ {
+ lastLine = i;
+ }
+ }
+
+ StringBuffer trace = new StringBuffer();
+ for ( int i = 0; i <= lastLine; i++ )
+ {
+ trace.append( lines[i] );
+ trace.append( "\n" );
+ }
+
+ for ( int i = lastLine; i < lines.length; i++ )
+ {
+ if ( lines[i].trim().startsWith( "Caused by" ) )
+ {
+ lastLine = i;
+ break;
+ }
+ }
+
+ for ( int i = lastLine; i < lines.length; i++ )
+ {
+ trace.append( lines[i] );
+ trace.append( "\n" );
+ }
+
+ return trace.toString();
+ }
+
+ public Throwable getThrowable()
+ {
+ return t;
+ }
+}
Added: maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportEntry.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportEntry.java?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportEntry.java (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/ReportEntry.java Sun May 13 18:33:45 2007
@@ -0,0 +1,178 @@
+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 org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+public class ReportEntry
+{
+ private Object source;
+
+ private String name;
+
+ private String group;
+
+ private String message;
+
+ private StackTraceWriter stackTraceWriter;
+
+ public ReportEntry()
+ {
+ }
+
+ public ReportEntry( Object source, String name, String message )
+ {
+ this( source, name, null, message );
+ }
+
+ public ReportEntry( Object source, String name, String group, String message )
+ {
+ this( source, name, group, message, null );
+ }
+
+ public ReportEntry( Object source, String name, String message, StackTraceWriter stackTraceWriter )
+ {
+ this( source, name, null, message, stackTraceWriter );
+ }
+
+ public ReportEntry( Object source, String name, String group, String message, StackTraceWriter stackTraceWriter )
+ {
+ if ( source == null )
+ {
+ throw new NullPointerException( "source is null" );
+ }
+ if ( name == null )
+ {
+ throw new NullPointerException( "name is null" );
+ }
+ if ( message == null )
+ {
+ throw new NullPointerException( "message is null" );
+ }
+
+ this.setSource( source );
+
+ this.setName( name );
+
+ this.setGroup( group );
+
+ this.setMessage( message );
+
+ this.setStackTraceWriter( stackTraceWriter );
+ }
+
+ public void setSource( Object source )
+ {
+ this.source = source;
+ }
+
+ public Object getSource()
+ {
+ return source;
+ }
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setGroup( String group )
+ {
+ this.group = group;
+ }
+
+ public String getGroup()
+ {
+ return group;
+ }
+
+ public void setMessage( String message )
+ {
+ this.message = message;
+ }
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ public void setStackTraceWriter( StackTraceWriter stackTraceWriter )
+ {
+ this.stackTraceWriter = stackTraceWriter;
+ }
+
+ public StackTraceWriter getStackTraceWriter()
+ {
+ return stackTraceWriter;
+ }
+
+ public boolean equals( Object obj )
+ {
+ if ( obj instanceof ReportEntry == false )
+ {
+ return false;
+ }
+ if ( this == obj )
+ {
+ return true;
+ }
+ ReportEntry rhs = (ReportEntry) obj;
+ return new EqualsBuilder()
+ .append( getSource(), rhs.getSource() )
+ .append( getName(), rhs.getName() )
+ .append( getGroup(), rhs.getGroup() )
+ .append( getMessage(), rhs.getMessage() )
+ .append( getStackTraceWriter(), rhs.getStackTraceWriter() )
+ .isEquals();
+ }
+
+ public String toString()
+ {
+ return new ToStringBuilder( this )
+ .append( "source", getSource() )
+ .append( "name", getName() )
+ .append( "group", getGroup() )
+ .append( "message", getMessage() )
+ .append( "stackTraceWriter", getStackTraceWriter() )
+ .toString();
+ }
+
+ public int hashCode()
+ {
+ // you pick a hard-coded, randomly chosen, non-zero, odd number
+ // ideally different for each class
+ // good resource at http://primes.utm.edu/lists/small/1000.txt
+ return new HashCodeBuilder( 5897, 6653 )
+ .append( getSource() )
+ .append( getName() )
+ .append( getGroup() )
+ .append( getMessage() )
+ .append( getStackTraceWriter() )
+ .toHashCode();
+ }
+
+}
Added: maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/Reporter.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/Reporter.java?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/Reporter.java (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/Reporter.java Sun May 13 18:33:45 2007
@@ -0,0 +1,133 @@
+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.util.Collection;
+
+/**
+ * Contract between the different implementations of the Surefire reporters
+ *
+ * @version $Id: Reporter.java 510866 2007-02-23 08:13:49Z brett $
+ */
+public interface Reporter
+{
+ void writeMessage( String message );
+
+ void writeFooter( String footer );
+
+ // The entire run
+ void runStarting( int testCount );
+
+ void runCompleted();
+
+ void runStopped();
+
+ void runAborted( ReportEntry report );
+
+ // Test Sets
+ void testSetStarting( ReportEntry report )
+ throws ReporterException;
+
+ void testSetCompleted( ReportEntry report )
+ throws ReporterException;
+
+ void testSetAborted( ReportEntry report );
+
+ // Tests
+
+ /**
+ * Event fired when a test is about to start
+ *
+ * @param report
+ */
+ void testStarting( ReportEntry report );
+
+ /**
+ * Event fired when a test ended successfully
+ *
+ * @param report
+ */
+ void testSucceeded( ReportEntry report );
+
+ /**
+ * Event fired when a test ended with an error (non anticipated problem)
+ *
+ * @param report
+ * @param stdOut standard output from the test case
+ * @param stdErr error output from the test case
+ */
+ void testError( ReportEntry report, String stdOut, String stdErr );
+
+ /**
+ * Event fired when a test ended with a failure (anticipated problem)
+ *
+ * @param report
+ * @param stdOut standard output from the test case
+ * @param stdErr error output from the test case
+ */
+ void testFailed( ReportEntry report, String stdOut, String stdErr );
+
+ void testSkipped( ReportEntry report );
+
+ // Counters
+ void reset();
+
+ /**
+ * Get the number of errors
+ *
+ * @return
+ */
+ int getNumErrors();
+
+ /**
+ * Get the number of failures
+ *
+ * @return
+ */
+ int getNumFailures();
+
+ /**
+ * Get the number of tests
+ *
+ * @return
+ */
+ int getNumTests();
+
+ /**
+ * Get the number of tests skipped
+ *
+ * @return
+ */
+ int getNumSkipped();
+
+ /**
+ * Gives the source(s) that causes the error(s).
+ *
+ * @return The source(s).
+ */
+ Collection getErrorSources();
+
+ /**
+ * Gives the source(s) that causes the failures(s).
+ *
+ * @return The source(s).
+ */
+ Collection getFailureSources();
+}
Added: maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterException.java
URL: http://svn.apache.org/viewvc/maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterException.java?view=auto&rev=537691
==============================================================================
--- maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterException.java (added)
+++ maven/sandbox/branches/surefire/surefire-collab2/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterException.java Sun May 13 18:33:45 2007
@@ -0,0 +1,36 @@
+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 org.apache.maven.surefire.util.NestedCheckedException;
+
+/**
+ * Exception occurring during report generation.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public class ReporterException
+ extends NestedCheckedException
+{
+ public ReporterException( String message, Exception nested )
+ {
+ super( message, nested );
+ }
+}