maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r382683 [1/2] - in /maven/surefire/branches/surefire-testng: surefire-api/src/main/java/org/apache/maven/surefire/ surefire-api/src/main/java/org/apache/maven/surefire/battery/ surefire-api/src/main/java/org/apache/maven/surefire/report/ su...
Date Fri, 03 Mar 2006 06:07:30 GMT
Author: brett
Date: Thu Mar  2 22:07:26 2006
New Revision: 382683

URL: http://svn.apache.org/viewcvs?rev=382683&view=rev
Log:
[MSUREFIRE-23] restructure to allow different test suites to behave identically. Also improved class loader separation by not merging surefire and test classloaders, and renamed 'battery' references to 'test set'. TestNG support is currently commented out, and exception handling needs a cleanup, which will follow.

Added:
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/suite/
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/suite/AbstractDirectoryTestSuite.java   (contents, props changed)
      - copied, changed from r382020, maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/battery/DirectoryBattery.java
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/suite/SurefireTestSuite.java   (with props)
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/
      - copied from r382020, maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/battery/
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/AbstractTestSet.java   (contents, props changed)
      - copied, changed from r382036, maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/battery/AbstractBattery.java
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/SurefireTestSet.java   (contents, props changed)
      - copied, changed from r382020, maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/battery/Battery.java
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/TestListenerInvocationHandler.java
      - copied, changed from r382682, maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/battery/TestListenerInvocationHandler.java
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/TestSetFailedException.java   (contents, props changed)
      - copied, changed from r382020, maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/battery/assertion/BatteryTestFailedException.java
    maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter/
    maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkConfiguration.java   (with props)
    maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkingWriterStreamConsumer.java   (contents, props changed)
      - copied, changed from r382020, maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/ForkingWriterStreamConsumer.java
    maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter/IsolatedClassLoader.java   (contents, props changed)
      - copied, changed from r382020, maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/IsolatedClassLoader.java
    maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooter.java   (contents, props changed)
      - copied, changed from r382212, maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/SurefireBooter.java
    maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireBooterForkException.java   (contents, props changed)
      - copied, changed from r382020, maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/SurefireBooterForkException.java
    maven/surefire/branches/surefire-testng/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/
    maven/surefire/branches/surefire-testng/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnitDirectoryTestSuite.java   (with props)
    maven/surefire/branches/surefire-testng/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnitTestSet.java   (contents, props changed)
      - copied, changed from r382036, maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/battery/JUnitBattery.java
    maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGDirectoryTestSuite.java   (with props)
    maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGTestSet.java   (contents, props changed)
      - copied, changed from r382212, maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGBattery.java
    maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNgXmlTestSuite.java   (contents, props changed)
      - copied, changed from r382020, maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGXMLBattery.java
Removed:
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/battery/
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/AbstractBattery.java
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/Battery.java
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/DirectoryBattery.java
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/JUnitBattery.java
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/SingleTestBattery.java
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/TestNGBattery.java
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/assertion/
    maven/surefire/branches/surefire-testng/surefire-api/src/main/resources/org/codehaus/
    maven/surefire/branches/surefire-testng/surefire-api/src/test/java/org/codehaus/
    maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/ForkingWriterStreamConsumer.java
    maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/IsolatedClassLoader.java
    maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/SurefireBooter.java
    maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/SurefireBooterForkException.java
    maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGBattery.java
    maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGXMLBattery.java
Modified:
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/Surefire.java
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractConsoleReporter.java
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractFileReporter.java
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/BriefFileReporter.java
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/FileReporter.java
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/Reporter.java
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManager.java
    maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/XMLReporter.java
    maven/surefire/branches/surefire-testng/surefire-api/src/main/resources/org/apache/maven/surefire/surefire.properties
    maven/surefire/branches/surefire-testng/surefire-api/src/test/java/org/apache/maven/surefire/TestReport.java
    maven/surefire/branches/surefire-testng/surefire-api/src/test/java/org/apache/maven/surefire/report/XMLReporterTest.java
    maven/surefire/branches/surefire-testng/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGReporter.java

Modified: maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/Surefire.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/Surefire.java?rev=382683&r1=382682&r2=382683&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/Surefire.java (original)
+++ maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/Surefire.java Thu Mar  2 22:07:26 2006
@@ -16,16 +16,13 @@
  * limitations under the License.
  */
 
-import org.apache.maven.surefire.battery.Battery;
-import org.apache.maven.surefire.battery.JUnitBattery;
-import org.apache.maven.surefire.battery.assertion.BatteryTestFailedException;
-import org.apache.maven.surefire.report.ReportEntry;
 import org.apache.maven.surefire.report.Reporter;
 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.Method;
-import java.lang.reflect.Modifier;
+import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -37,397 +34,219 @@
  */
 public class Surefire
 {
-    private static ResourceBundle resources = ResourceBundle.getBundle( "org.apache.maven.surefire.surefire" );
+    private ResourceBundle bundle = ResourceBundle.getBundle( "org.apache.maven.surefire.surefire" );
 
-    private List batteryHolders;
-
-    private List reports;
-
-    private ReporterManager reporterManager;
-
-    private ClassLoader classLoader;
-
-    private String reportsDirectory;
-
-    private String testSourceDirectory;
-
-    private String groups;
-
-    private String excludedGroups;
-
-    private int threadCount;
-
-    private boolean parallel;
-
-    public boolean run( List reports, List batteryHolders, String reportsDirectory )
-        throws Exception
+    public boolean run( List reportDefinitions, Object[] testSuiteDefinition, String testSetName,
+                        ClassLoader surefireClassLoader, ClassLoader testsClassLoader )
     {
-        ClassLoader classLoader = this.getClass().getClassLoader();
+        ReporterManager reporterManager =
+            new ReporterManager( instantiateReports( reportDefinitions, surefireClassLoader ) );
 
-        return run( reports, batteryHolders, classLoader, reportsDirectory );
-    }
+        int totalTests = 0;
 
-    public boolean run( List reports, List batteryHolders, ClassLoader classLoader, String reportsDirectory )
-        throws Exception
-    {
-        return run( reports, batteryHolders, classLoader, reportsDirectory, null, null, new Integer( 0 ), Boolean.FALSE,
-                    null );
-    }
+        SurefireTestSuite suite =
+            createSuiteFromDefinition( testSuiteDefinition, surefireClassLoader, testsClassLoader );
 
-    public boolean run( List reports, List batteryHolders, ClassLoader classLoader, String reportsDirectory,
-                        String groups, String excludedGroups, Integer threadCount, Boolean parallel,
-                        String testSourceDirectory )
-        throws Exception
-    {
-        if ( reports == null || batteryHolders == null || classLoader == null )
+        int testCount = suite.getNumTests();
+        if ( testCount > 0 )
         {
-            throw new NullPointerException();
+            totalTests += testCount;
         }
 
-        if ( batteryHolders.size() == 0 )
+        reporterManager.runStarting( totalTests );
+
+        if ( totalTests == 0 )
         {
-            throw new IllegalArgumentException();
+            reporterManager.writeMessage( "There are no tests to run." );
+        }
+        else
+        {
+            suite.execute( testSetName, reporterManager, testsClassLoader );
         }
 
-        this.batteryHolders = batteryHolders;
-
-        this.reports = reports;
-
-        this.classLoader = classLoader;
-
-        this.reportsDirectory = reportsDirectory;
-
-        this.groups = groups;
-
-        this.excludedGroups = excludedGroups;
-
-        this.threadCount = threadCount.intValue();
-
-        this.parallel = parallel.booleanValue();
-
-        this.testSourceDirectory = testSourceDirectory;
+        reporterManager.runCompleted();
 
-        return run();
+        return reporterManager.getNumErrors() == 0 && reporterManager.getNumFailures() == 0;
     }
 
-    public boolean run()
-        throws Exception
+    public boolean run( List reportDefinitions, List testSuiteDefinitions, ClassLoader surefireClassLoader,
+                        ClassLoader testsClassLoader )
     {
-        List batts = instantiateBatteries( batteryHolders, classLoader, testSourceDirectory, groups );
+        ReporterManager reporterManager =
+            new ReporterManager( instantiateReports( reportDefinitions, surefireClassLoader ) );
 
-        reporterManager = new ReporterManager( instantiateReports( reports, classLoader ), reportsDirectory );
+        List suites = new ArrayList();
 
-        try
+        int totalTests = 0;
+        for ( Iterator i = testSuiteDefinitions.iterator(); i.hasNext(); )
         {
-            reporterManager.runStarting( 100 );
-
-            if ( batts.size() > 0 )
-            {
-                int nbTests = 0;
-
-                for ( Iterator i = batts.iterator(); i.hasNext(); )
-                {
-                    Battery battery = (Battery) i.next();
-
-                    int testCount = 0;
-
-                    try
-                    {
-                        testCount = battery.getTestCount();
-                    }
-                    catch ( BatteryTestFailedException e )
-                    {
-                        e.printStackTrace();
-
-                        ReportEntry report = new ReportEntry( e, "org.apache.maven.surefire.Runner",
-                                                              getResourceString( "bigProblems" ), e );
-
-                        reporterManager.batteryAborted( report );
-                    }
-
-                    //TestNG needs a little config love -- TODO
-/*                    if ( battery instanceof TestNGXMLBattery )
-                    {
-                        TestNGXMLBattery xbat = (TestNGXMLBattery) battery;
-                        xbat.setOutputDirectory( reportsDirectory );
-                        xbat.setReporter( new TestNGReporter( reporterManager, this ) );
-                        xbat.execute( reporterManager );
-                        nbTests += xbat.getTestCount();
-                    }
-                    else */
-                    if ( testCount > 0 )
-                    {
-                        executeBattery( battery, reporterManager );
-
-                        nbTests += testCount;
-                    }
+            Object[] definition = (Object[]) i.next();
 
-                    List list = new ArrayList();
-
-                    for ( Iterator j = battery.getSubBatteryClassNames().iterator(); j.hasNext(); )
-                    {
-                        String s = (String) j.next();
-
-                        list.add( new Object[]{s, null} );
-                    }
-
-                    List subBatteries = instantiateBatteries( list, classLoader, testSourceDirectory, groups );
-
-                    //continue normal mode
-                    for ( Iterator j = subBatteries.iterator(); j.hasNext(); )
-                    {
-                        Battery b = (Battery) j.next();
-
-                        testCount = 0;
-
-                        try
-                        {
-                            testCount = b.getTestCount();
-                        }
-                        catch ( BatteryTestFailedException e )
-                        {
-                            e.printStackTrace();
-
-                            ReportEntry report = new ReportEntry( e, "org.apache.maven.surefire.SurefireRunner",
-                                                                  getResourceString( "bigProblems" ), e );
-
-                            reporterManager.batteryAborted( report );
-                        }
-
-                        if ( testCount > 0 )
-                        {
-                            executeBattery( b, reporterManager );
-
-                            nbTests += testCount;
-                        }
-                    }
+            SurefireTestSuite suite = createSuiteFromDefinition( definition, surefireClassLoader, testsClassLoader );
 
-                }
-
-                if ( nbTests == 0 )
-                {
-                    reporterManager.writeMessage( "There are no tests to run." );
-                }
-            }
-            else
+            int testCount = suite.getNumTests();
+            if ( testCount > 0 )
             {
-                reporterManager.writeMessage( "There are no batteries to run." );
+                suites.add( suite );
+                totalTests += testCount;
             }
-
-            reporterManager.runCompleted();
         }
-        catch ( Throwable ex )
-        {
-            ex.printStackTrace();
 
-            ReportEntry report =
-                new ReportEntry( ex, "org.apache.maven.surefire.Runner", getResourceString( "bigProblems" ), ex );
+        reporterManager.runStarting( totalTests );
 
-            reporterManager.runAborted( report );
+        if ( totalTests == 0 )
+        {
+            reporterManager.writeMessage( "There are no tests to run." );
         }
-
-        reporterManager.resume();
-
-        return !( reporterManager.getNbErrors() > 0 || reporterManager.getNbFailures() > 0 );
-    }
-
-    /**
-     * @throws Exception
-     */
-    public void executeBattery( Battery battery, ReporterManager reportManager )
-        throws Exception
-    {
-        try
+        else
         {
-            String rawString = getResourceString( "suiteExecutionStarting" );
-
-            ReportEntry report = new ReportEntry( this, battery.getBatteryName(), battery.getBatteryName(), rawString );
-
-            reportManager.batteryStarting( report );
-
-            try
+            for ( Iterator i = suites.iterator(); i.hasNext(); )
             {
-                battery.execute( reportManager );
-
-                rawString = getResourceString( "suiteCompletedNormally" );
-
-                report = new ReportEntry( this, battery.getBatteryName(), battery.getBatteryName(), rawString );
-
-                reportManager.batteryCompleted( report );
+                SurefireTestSuite suite = (SurefireTestSuite) i.next();
+                suite.execute( reporterManager, testsClassLoader );
             }
-            catch ( RuntimeException e )
-            {
-                e.printStackTrace();
+        }
 
-                rawString = getResourceString( "executeException" );
+        reporterManager.runCompleted();
 
-                report = new ReportEntry( this, battery.getBatteryName(), battery.getBatteryName(), rawString, e );
+        return reporterManager.getNumErrors() == 0 && reporterManager.getNumFailures() == 0;
+    }
 
-                reportManager.batteryAborted( report );
-            }
+    private SurefireTestSuite createSuiteFromDefinition( Object[] definition, ClassLoader surefireClassLoader,
+                                                         ClassLoader testsClassLoader )
+    {
+        String suiteClass = (String) definition[0];
+        Object[] params = (Object[]) definition[1];
 
-            reportManager.runCompleted();
+        SurefireTestSuite suite = instantiateSuite( suiteClass, params, surefireClassLoader );
 
-            reportManager.dispose();
+        try
+        {
+            suite.locateTestSets( testsClassLoader );
         }
-        catch ( Throwable ex )
+        catch ( ClassNotFoundException e )
         {
-            ReportEntry report =
-                new ReportEntry( ex, "org.apache.maven.surefire.Runner", getResourceString( "bigProblems" ), ex );
-
-            reportManager.runAborted( report );
+            // TODO
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
         }
-    }
-
-    /**
-     * @param batteryHolders
-     * @param loader
-     * @return
-     * @throws Exception
-     */
-    public static List instantiateBatteries( List batteryHolders, ClassLoader loader, String testSourceDirectory,
-                                             String groups )
-        throws Exception
-    {
-        List batteries = new ArrayList();
-
-        for ( int i = 0; i < batteryHolders.size(); i++ )
+        catch ( TestSetFailedException e )
         {
-            Object[] holder = (Object[]) batteryHolders.get( i );
-
-            Object battery = instantiateBattery( holder, loader, testSourceDirectory, groups );
-
-            if ( battery != null )
-            {
-                batteries.add( battery );
-            }
+            // TODO
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
         }
-
-        return batteries;
+        return suite;
     }
 
-    protected List instantiateReports( List reportClassNames, ClassLoader classLoader )
-        throws Exception
+    /*
+                    //TestNG needs a little config love -- TODO
+//                    if ( testset instanceof TestNGXMLBattery )
+//                    {
+//                        TestNGXMLBattery xbat = (TestNGXMLBattery) testset;
+//                        xbat.setOutputDirectory( reportsDirectory );
+//                        xbat.setReporter( new TestNGReporter( reporterManager, this ) );
+//                        xbat.execute( reporterManager );
+//                        nbTests += xbat.getTestCount();
+//                    }
+    }
+*/
+    private List instantiateReports( List reportDefinitions, ClassLoader classLoader )
     {
         List reports = new ArrayList();
 
-        boolean fail = false;
-
-        ClassLoader reporterClassLoader = Reporter.class.getClassLoader();
-
-        for ( Iterator i = reportClassNames.iterator(); i.hasNext(); )
+        for ( Iterator i = reportDefinitions.iterator(); i.hasNext(); )
         {
-            String reportClassName = (String) i.next();
-
-            try
-            {
-                Class reportClass = reporterClassLoader.loadClass( reportClassName );
-
-                // assert Reporter.class.isAssignableFrom(reportClass);
-
-                Reporter report = (Reporter) reportClass.newInstance();
+            Object[] definition = (Object[]) i.next();
 
-                report.setReportsDirectory( reportsDirectory );
+            String className = (String) definition[0];
+            Object[] params = (Object[]) definition[1];
 
-                reports.add( report );
-            }
-            catch ( Exception e )
-            {
-                e.printStackTrace();
-            }
-        }
+            Reporter report = instantiateReport( className, params, classLoader );
 
-        if ( fail )
-        {
-            throw new RuntimeException( "couldn't assign reports as expected" );
+            reports.add( report );
         }
 
         return reports;
     }
 
-    public static String getResourceString( String key )
+    private static Reporter instantiateReport( String className, Object[] params, ClassLoader classLoader )
     {
-        return resources.getString( key );
+        return (Reporter) instantiateObject( className, params, classLoader );
     }
 
-    private static Object instantiateBattery( Object[] holder, ClassLoader loader, String testSourceDirectory,
-                                              String groups )
-        throws Exception
+    public static Object instantiateObject( String className, Object[] params, ClassLoader classLoader )
     {
-        Class testClass;
-
-        Class batteryClass;
-
+        Object object = null;
         try
         {
-            testClass = loader.loadClass( (String) holder[0] );
+            Class clazz = classLoader.loadClass( className );
 
-            batteryClass = loader.loadClass( "org.apache.maven.surefire.battery.Battery" );
-        }
-        catch ( Exception e )
-        {
-            return null;
-        }
-
-        if ( Modifier.isAbstract( testClass.getModifiers() ) )
-        {
-            return null;
-        }
-
-        Object battery = null;
-
-        if ( batteryClass.isAssignableFrom( testClass ) )
-        {
-            if ( holder[1] != null )
+            if ( params != null )
             {
-                Object[] params = (Object[]) holder[1];
-
                 Class[] paramTypes = new Class[params.length];
 
                 for ( int j = 0; j < params.length; j++ )
                 {
-                    paramTypes[j] = params[j].getClass();
+                    if ( params[j] == null )
+                    {
+                        paramTypes[j] = String.class;
+                    }
+                    else
+                    {
+                        paramTypes[j] = params[j].getClass();
+                    }
                 }
 
-                Constructor constructor = testClass.getConstructor( paramTypes );
+                Constructor constructor = clazz.getConstructor( paramTypes );
 
-                battery = constructor.newInstance( params );
+                object = constructor.newInstance( params );
             }
             else
             {
-                battery = testClass.newInstance();
+                object = clazz.newInstance();
             }
         }
-
-        if ( battery == null )
+        catch ( ClassNotFoundException e )
         {
-            // TODO: this hard coding should be removed. Would be real nice to just use Plexus :)
-            //   We could probably have BatteryFactory instances in each provider that say canInstantiate(), and instantiate()
-
-            try
-            {
-                batteryClass = loader.loadClass( "org.apache.maven.surefire.testng.TestNGBattery" );
-
-                Method m = batteryClass.getMethod( "canInstantiate", new Class[]{Class.class} );
-                Boolean b = (Boolean) m.invoke( null, new Object[]{testClass} );
-                if ( b.booleanValue() )
-                {
-                    Constructor constructor = batteryClass.getConstructor(
-                        new Class[]{Class.class, ClassLoader.class, String.class, String.class} );
-                    battery = constructor.newInstance( new Object[]{testClass, loader, testSourceDirectory, groups} );
-                }
-            }
-            catch ( ClassNotFoundException e )
-            {
-                // ignore
-            }
+            // TODO
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
         }
-
-        if ( battery == null )
+        catch ( NoSuchMethodException e )
+        {
+            // TODO
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+        catch ( InstantiationException e )
+        {
+            // TODO
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+        catch ( IllegalAccessException e )
+        {
+            // TODO
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+        catch ( InvocationTargetException e )
         {
-            battery = new JUnitBattery( testClass, loader );
+            // TODO
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
         }
+        return object;
+    }
+
+    private static SurefireTestSuite instantiateSuite( String suiteClass, Object[] params, ClassLoader classLoader )
+    {
+        return (SurefireTestSuite) instantiateObject( suiteClass, params, classLoader );
+    }
 
-        return battery;
+    public String getResourceString( String key )
+    {
+        return bundle.getString( key );
+    }
+
+/* TODO: should catch this elsewhere
+    if ( Modifier.isAbstract( testClass.getModifiers() ) )
+    {
+        return null;
     }
+*/
 }

Modified: maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractConsoleReporter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractConsoleReporter.java?rev=382683&r1=382682&r2=382683&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractConsoleReporter.java (original)
+++ maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractConsoleReporter.java Thu Mar  2 22:07:26 2006
@@ -33,14 +33,15 @@
 
     protected AbstractConsoleReporter( String format )
     {
+        // TODO: use logger
         super( new PrintWriter( new OutputStreamWriter( new BufferedOutputStream( System.out, BUFFER_SIZE ) ) ),
                format );
     }
 
-    public void batteryStarting( ReportEntry report )
+    public void testSetStarting( ReportEntry report )
         throws IOException
     {
-        super.batteryStarting( report );
+        super.testSetStarting( report );
 
         String message = "Running " + report.getName();
         if ( !report.getGroup().equals( report.getName() ) )
@@ -69,9 +70,9 @@
         printAbortionError( "RUN ABORTED", report );
     }
 
-    public void batteryAborted( ReportEntry report )
+    public void testSetAborted( ReportEntry report )
     {
-        printAbortionError( "BATTERY ABORTED", report );
+        printAbortionError( "TEST SET ABORTED", report );
     }
 
     private void printAbortionError( String msg, ReportEntry report )

Modified: maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractFileReporter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractFileReporter.java?rev=382683&r1=382682&r2=382683&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractFileReporter.java (original)
+++ maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractFileReporter.java Thu Mar  2 22:07:26 2006
@@ -29,17 +29,21 @@
 public abstract class AbstractFileReporter
     extends AbstractTextReporter
 {
-    protected AbstractFileReporter( String format )
+    private File reportsDirectory;
+
+    protected AbstractFileReporter( File reportsDirectory, String format )
     {
         super( format );
+
+        this.reportsDirectory = reportsDirectory;
     }
 
-    public void batteryStarting( ReportEntry report )
+    public void testSetStarting( ReportEntry report )
         throws IOException
     {
-        super.batteryStarting( report );
+        super.testSetStarting( report );
 
-        File reportFile = new File( getReportsDirectory(), report.getName() + ".txt" );
+        File reportFile = new File( reportsDirectory, report.getName() + ".txt" );
 
         File reportDir = reportFile.getParentFile();
 
@@ -49,16 +53,16 @@
 
         writer.println( "-------------------------------------------------------------------------------" );
 
-        writer.println( "Battery: " + report.getName() );
+        writer.println( "Test set: " + report.getName() );
 
         writer.println( "-------------------------------------------------------------------------------" );
 
         setWriter( writer );
     }
 
-    public void batteryCompleted( ReportEntry report )
+    public void testSetCompleted( ReportEntry report )
     {
-        super.batteryCompleted( report );
+        super.testSetCompleted( report );
 
         writer.flush();
 

Modified: maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java?rev=382683&r1=382682&r2=382683&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java (original)
+++ maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractReporter.java Thu Mar  2 22:07:26 2006
@@ -28,8 +28,6 @@
 public abstract class AbstractReporter
     implements Reporter
 {
-    private String reportsDirectory;
-
     protected int completedCount;
 
     protected int errors;
@@ -46,17 +44,7 @@
 
     private static final int MS_PER_SEC = 1000;
 
-    protected long batteryStartTime;
-
-    public void setReportsDirectory( String reportsDirectory )
-    {
-        this.reportsDirectory = reportsDirectory;
-    }
-
-    public String getReportsDirectory()
-    {
-        return reportsDirectory;
-    }
+    protected long testSetStartTime;
 
     // ----------------------------------------------------------------------
     // Report interface
@@ -78,17 +66,17 @@
     {
     }
 
-    public void batteryStarting( ReportEntry report )
+    public void testSetStarting( ReportEntry report )
         throws IOException
     {
-        batteryStartTime = System.currentTimeMillis();
+        testSetStartTime = System.currentTimeMillis();
     }
 
-    public void batteryCompleted( ReportEntry report )
+    public void testSetCompleted( ReportEntry report )
     {
     }
 
-    public void batteryAborted( ReportEntry report )
+    public void testSetAborted( ReportEntry report )
     {
     }
 
@@ -131,12 +119,12 @@
     // Counters
     // ----------------------------------------------------------------------
 
-    public int getNbErrors()
+    public int getNumErrors()
     {
         return errors;
     }
 
-    public int getNbFailures()
+    public int getNumFailures()
     {
         return failures;
     }
@@ -150,7 +138,7 @@
     //
     // ----------------------------------------------------------------------
 
-    public void dispose()
+    public void reset()
     {
         errors = 0;
 

Modified: maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java?rev=382683&r1=382682&r2=382683&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java (original)
+++ maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/AbstractTextReporter.java Thu Mar  2 22:07:26 2006
@@ -93,19 +93,19 @@
         testResults.add( getOutput( report, "FAILURE" ) );
     }
 
-    public void batteryStarting( ReportEntry report )
+    public void testSetStarting( ReportEntry report )
         throws IOException
     {
-        super.batteryStarting( report );
+        super.testSetStarting( report );
 
         testResults = new ArrayList();
     }
 
-    public void batteryCompleted( ReportEntry report )
+    public void testSetCompleted( ReportEntry report )
     {
-        super.batteryCompleted( report );
+        super.testSetCompleted( report );
 
-        writeMessage( getBatterySummary() );
+        writeMessage( getTestSetSummary() );
 
         if ( format.equals( BRIEF ) || format.equals( PLAIN ) )
         {
@@ -116,26 +116,26 @@
         }
     }
 
-    protected String getBatterySummary()
+    protected String getTestSetSummary()
     {
-        StringBuffer batterySummary = new StringBuffer();
+        StringBuffer buf = 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" );
+        buf.append( "Tests run: " );
+        buf.append( completedCount );
+        buf.append( ", Failures: " );
+        buf.append( failures );
+        buf.append( ", Errors: " );
+        buf.append( errors );
+        buf.append( ", Time elapsed: " );
+        buf.append( elapsedTimeAsString( System.currentTimeMillis() - testSetStartTime ) );
+        buf.append( " sec" );
 
         if ( failures > 0 || errors > 0 )
         {
-            batterySummary.append( " <<< FAILURE!" );
+            buf.append( " <<< FAILURE!" );
         }
 
-        return batterySummary.toString();
+        return buf.toString();
     }
 
     protected String getElapsedTimeSummary( ReportEntry report )

Modified: maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/BriefFileReporter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/BriefFileReporter.java?rev=382683&r1=382682&r2=382683&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/BriefFileReporter.java (original)
+++ maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/BriefFileReporter.java Thu Mar  2 22:07:26 2006
@@ -1,5 +1,7 @@
 package org.apache.maven.surefire.report;
 
+import java.io.File;
+
 /*
  * Copyright 2001-2006 The Apache Software Foundation.
  *
@@ -25,8 +27,8 @@
 public class BriefFileReporter
     extends AbstractFileReporter
 {
-    public BriefFileReporter()
+    public BriefFileReporter( File reportsDirectory )
     {
-        super( BRIEF );
+        super( reportsDirectory, BRIEF );
     }
 }

Modified: maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/FileReporter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/FileReporter.java?rev=382683&r1=382682&r2=382683&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/FileReporter.java (original)
+++ maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/FileReporter.java Thu Mar  2 22:07:26 2006
@@ -1,5 +1,7 @@
 package org.apache.maven.surefire.report;
 
+import java.io.File;
+
 /*
  * Copyright 2001-2006 The Apache Software Foundation.
  *
@@ -25,8 +27,8 @@
 public class FileReporter
     extends AbstractFileReporter
 {
-    public FileReporter()
+    public FileReporter( File reportsDirectory )
     {
-        super( PLAIN );
+        super( reportsDirectory, PLAIN );
     }
 }

Modified: maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/Reporter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/Reporter.java?rev=382683&r1=382682&r2=382683&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/Reporter.java (original)
+++ maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/Reporter.java Thu Mar  2 22:07:26 2006
@@ -29,13 +29,13 @@
 
     void runAborted( ReportEntry report );
 
-    // Battery
-    void batteryStarting( ReportEntry report )
+    // Test Sets
+    void testSetStarting( ReportEntry report )
         throws Exception;
 
-    void batteryCompleted( ReportEntry report );
+    void testSetCompleted( ReportEntry report );
 
-    void batteryAborted( ReportEntry report );
+    void testSetAborted( ReportEntry report );
 
     // Tests
     void testStarting( ReportEntry report );
@@ -46,14 +46,12 @@
 
     void testFailed( ReportEntry report, String stdOut, String stdErr );
 
-    void dispose();
+    void reset();
 
-    // Counters
-    int getNbErrors();
+    // Counters... TODO (remove?)
+    int getNumErrors();
 
-    int getNbFailures();
+    int getNumFailures();
 
     int getNbTests();
-
-    void setReportsDirectory( String reportsDirectory );
 }

Modified: maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManager.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManager.java?rev=382683&r1=382682&r2=382683&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManager.java (original)
+++ maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/ReporterManager.java Thu Mar  2 22:07:26 2006
@@ -16,13 +16,10 @@
  * limitations under the License.
  */
 
-import org.apache.maven.surefire.Surefire;
 import org.apache.maven.surefire.util.TeeStream;
 
 import java.io.ByteArrayOutputStream;
-import java.io.File;
 import java.io.PrintStream;
-import java.text.MessageFormat;
 import java.util.Iterator;
 import java.util.List;
 
@@ -36,8 +33,6 @@
 
     private List reports;
 
-    private String reportsDirectory;
-
     private PrintStream oldOut;
 
     private PrintStream oldErr;
@@ -46,15 +41,8 @@
 
     private PrintStream newOut;
 
-    public ReporterManager( List reports, String reportsDirectory )
+    public ReporterManager( List reports )
     {
-        if ( reports == null )
-        {
-            throw new NullPointerException();
-        }
-
-        this.reportsDirectory = reportsDirectory;
-
         this.reports = reports;
     }
 
@@ -99,14 +87,6 @@
         }
     }
 
-    public void resume()
-    {
-        writeMessage( "" );
-        writeMessage( "Results :" );
-        writeMessage( "Tests run: " + completedCount + ", Failures: " + failures + ", Errors: " + errors );
-        writeMessage( "" );
-    }
-
     // ----------------------------------------------------------------------
     // Run
     // ----------------------------------------------------------------------
@@ -189,17 +169,18 @@
                 handleReporterException( "runCompleted", e );
             }
         }
-    }
 
-    // ----------------------------------------------------------------------
-    // Battery
-    // ----------------------------------------------------------------------
+        writeMessage( "" );
+        writeMessage( "Results :" );
+        writeMessage( "Tests run: " + completedCount + ", Failures: " + failures + ", Errors: " + errors );
+        writeMessage( "" );
+    }
 
     private ByteArrayOutputStream stdOut;
 
     private ByteArrayOutputStream stdErr;
 
-    public void batteryStarting( ReportEntry report )
+    public void testSetStarting( ReportEntry report )
     {
         for ( Iterator it = reports.iterator(); it.hasNext(); )
         {
@@ -207,7 +188,7 @@
 
             try
             {
-                reporter.batteryStarting( report );
+                reporter.testSetStarting( report );
             }
             catch ( Exception e )
             {
@@ -216,15 +197,15 @@
         }
     }
 
-    public void batteryCompleted( ReportEntry report )
+    public void testSetCompleted( ReportEntry report )
     {
         if ( !reports.isEmpty() )
         {
             Reporter reporter = (Reporter) reports.get( 0 );
 
-            errors += reporter.getNbErrors();
+            errors += reporter.getNumErrors();
 
-            failures += reporter.getNbFailures();
+            failures += reporter.getNumFailures();
 
             completedCount += reporter.getNbTests();
         }
@@ -235,7 +216,7 @@
 
             try
             {
-                reporter.batteryCompleted( report );
+                reporter.testSetCompleted( report );
             }
             catch ( Exception e )
             {
@@ -243,7 +224,7 @@
         }
     }
 
-    public void batteryAborted( ReportEntry report )
+    public void testSetAborted( ReportEntry report )
     {
         for ( Iterator it = reports.iterator(); it.hasNext(); )
         {
@@ -251,7 +232,7 @@
 
             try
             {
-                reporter.batteryAborted( report );
+                reporter.testSetAborted( report );
             }
             catch ( Exception e )
             {
@@ -268,13 +249,6 @@
 
     public void testStarting( ReportEntry report )
     {
-        File f = new File( reportsDirectory );
-
-        if ( !f.exists() )
-        {
-            f.mkdirs();
-        }
-
         stdOut = new ByteArrayOutputStream();
 
         newOut = new PrintStream( stdOut );
@@ -376,7 +350,7 @@
         newErr.close();
     }
 
-    public void dispose()
+    public void reset()
     {
         for ( Iterator it = reports.iterator(); it.hasNext(); )
         {
@@ -384,11 +358,11 @@
 
             try
             {
-                report.dispose();
+                report.reset();
             }
             catch ( Exception e )
             {
-                handleReporterException( "dispose", e );
+                handleReporterException( "reset", e );
             }
         }
     }
@@ -397,12 +371,12 @@
     // Counters
     // ----------------------------------------------------------------------
 
-    public int getNbErrors()
+    public int getNumErrors()
     {
         return errors;
     }
 
-    public int getNbFailures()
+    public int getNumFailures()
     {
         return failures;
     }
@@ -417,6 +391,7 @@
      */
     private void handleReporterException( String reporterMethod, Exception e )
     {
+/*
         String reporterThrewException = Surefire.getResourceString( "reporterThrew" );
 
         MessageFormat msgFmt = new MessageFormat( reporterThrewException );
@@ -428,10 +403,7 @@
         System.err.println( stringToPrint );
 
         e.printStackTrace( System.err );
+*/
     }
 
-    public String getReportsDirectory()
-    {
-        return reportsDirectory;
-    }
 }

Modified: maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/XMLReporter.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/XMLReporter.java?rev=382683&r1=382682&r2=382683&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/XMLReporter.java (original)
+++ maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/report/XMLReporter.java Thu Mar  2 22:07:26 2006
@@ -47,6 +47,13 @@
 
     private Xpp3Dom testCase;
 
+    private File reportsDirectory;
+
+    public XMLReporter( File reportsDirectory )
+    {
+        this.reportsDirectory = reportsDirectory;
+    }
+
     public void setTestCase( Xpp3Dom testCase )
     {
         this.testCase = testCase;
@@ -61,12 +68,12 @@
     {
     }
 
-    public void batteryStarting( ReportEntry report )
+    public void testSetStarting( ReportEntry report )
         throws IOException, UnsupportedEncodingException
     {
-        super.batteryStarting( report );
+        super.testSetStarting( report );
 
-        File reportFile = new File( getReportsDirectory(), "TEST-" + report.getName() + ".xml" );
+        File reportFile = new File( reportsDirectory, "TEST-" + report.getName() + ".xml" );
 
         File reportDir = reportFile.getParentFile();
 
@@ -81,17 +88,17 @@
         showProperties();
     }
 
-    public void batteryCompleted( ReportEntry report )
+    public void testSetCompleted( ReportEntry report )
     {
-        super.batteryCompleted( report );
+        super.testSetCompleted( report );
 
         testSuite.setAttribute( "tests", String.valueOf( this.getNbTests() ) );
 
-        testSuite.setAttribute( "errors", String.valueOf( this.getNbErrors() ) );
+        testSuite.setAttribute( "errors", String.valueOf( this.getNumErrors() ) );
 
-        testSuite.setAttribute( "failures", String.valueOf( this.getNbFailures() ) );
+        testSuite.setAttribute( "failures", String.valueOf( this.getNumFailures() ) );
 
-        long runTime = System.currentTimeMillis() - batteryStartTime;
+        long runTime = System.currentTimeMillis() - testSetStartTime;
 
         testSuite.setAttribute( "time", elapsedTimeAsString( runTime ) );
 

Copied: maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/suite/AbstractDirectoryTestSuite.java (from r382020, maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/battery/DirectoryBattery.java)
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/suite/AbstractDirectoryTestSuite.java?p2=maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/suite/AbstractDirectoryTestSuite.java&p1=maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/battery/DirectoryBattery.java&r1=382020&r2=382683&rev=382683&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/battery/DirectoryBattery.java (original)
+++ maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/suite/AbstractDirectoryTestSuite.java Thu Mar  2 22:07:26 2006
@@ -1,4 +1,4 @@
-package org.apache.maven.surefire.battery;
+package org.apache.maven.surefire.suite;
 
 /*
  * Copyright 2001-2006 The Apache Software Foundation.
@@ -16,16 +16,27 @@
  * limitations under the License.
  */
 
+import org.apache.maven.surefire.report.ReportEntry;
+import org.apache.maven.surefire.report.ReporterManager;
+import org.apache.maven.surefire.testset.SurefireTestSet;
+import org.apache.maven.surefire.testset.TestSetFailedException;
 import org.codehaus.plexus.util.DirectoryScanner;
 import org.codehaus.plexus.util.StringUtils;
 
 import java.io.File;
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.ResourceBundle;
 
-public final class DirectoryBattery
-    extends AbstractBattery
+public abstract class AbstractDirectoryTestSuite
+    implements SurefireTestSuite
 {
+    private ResourceBundle bundle = ResourceBundle.getBundle( "org.apache.maven.surefire.surefire" );
+
     private static final String FS = System.getProperty( "file.separator" );
 
     private File basedir;
@@ -34,63 +45,163 @@
 
     private List excludes;
 
-    public DirectoryBattery( File basedir, ArrayList includes, ArrayList excludes )
-        throws Exception
+    private Map testSets;
+
+    private int totalTests;
+
+    private static final String[] EMPTY_STRING_ARRAY = new String[0];
+
+    protected AbstractDirectoryTestSuite( File basedir, List includes, List excludes )
     {
         this.basedir = basedir;
 
-        this.includes = includes;
+        this.includes = new ArrayList( includes );
 
-        this.excludes = excludes;
-
-        discoverBatteryClassNames();
+        this.excludes = new ArrayList( excludes );
     }
 
-    public void discoverBatteryClassNames()
-        throws Exception
+    public Map locateTestSets( ClassLoader classLoader )
+        throws ClassNotFoundException, TestSetFailedException
     {
+        if ( testSets != null )
+        {
+            throw new IllegalStateException( "You can't call locateTestSets twice" );
+        }
+        testSets = new LinkedHashMap();
+
         String[] tests = collectTests( basedir, includes, excludes );
 
-        if ( tests != null )
+        for ( int i = 0; i < tests.length; i++ )
         {
-            for ( int i = 0; i < tests.length; i++ )
+            String className = tests[i];
+
+            SurefireTestSet testSet = createTestSet( className, classLoader );
+
+            if ( testSets.containsKey( testSet.getName() ) )
             {
-                String s = tests[i];
+                // TODO: better error
+                throw new TestSetFailedException( "Duplicate test set '" + testSet.getName() + "'" );
+            }
 
-                s = s.substring( 0, s.indexOf( "." ) );
+            testSets.put( testSet.getName(), testSet );
 
-                s = s.replace( FS.charAt( 0 ), ".".charAt( 0 ) );
+            totalTests += testSet.getTestCount();
+        }
 
-                addSubBatteryClassName( s );
-            }
+        return Collections.unmodifiableMap( testSets );
+    }
+
+    protected abstract Object[] createConstructorArguments( String className );
+
+    protected abstract SurefireTestSet createTestSet( String className, ClassLoader classLoader )
+        throws ClassNotFoundException;
+
+    public void execute( ReporterManager reporterManager, ClassLoader classLoader )
+    {
+        if ( testSets == null )
+        {
+            throw new IllegalStateException( "You must call locateTestSets before calling execute" );
+        }
+        for ( Iterator i = testSets.values().iterator(); i.hasNext(); )
+        {
+            SurefireTestSet testSet = (SurefireTestSet) i.next();
+
+            executeTestSet( testSet, reporterManager, classLoader );
+        }
+    }
+
+    private void executeTestSet( SurefireTestSet testSet, ReporterManager reporterManager, ClassLoader classLoader )
+    {
+        try
+        {
+            // TODO: fix all these messages, and improve bundle resolution
+            String rawString = bundle.getString( "testSetStarting" );
+
+            ReportEntry report = new ReportEntry( this, testSet.getName(), rawString );
+
+            reporterManager.testSetStarting( report );
+
+            testSet.execute( reporterManager, classLoader );
+
+            rawString = bundle.getString( "testSetCompletedNormally" );
+
+            report = new ReportEntry( this, testSet.getName(), rawString );
+
+            reporterManager.testSetCompleted( report );
+
+            reporterManager.reset();
+        }
+        catch ( Exception e )
+        {
+            // TODO
+            e.printStackTrace();
         }
     }
 
-    public String[] collectTests( File basedir, List includes, List excludes )
-        throws Exception
+    public void execute( String testSetName, ReporterManager reporterManager, ClassLoader classLoader )
     {
-        if ( !basedir.exists() )
+        if ( testSets == null )
         {
-            return null;
+            throw new IllegalStateException( "You must call locateTestSets before calling execute" );
         }
+        SurefireTestSet testSet = (SurefireTestSet) testSets.get( testSetName );
 
-        DirectoryScanner scanner = new DirectoryScanner();
+        if ( testSet == null )
+        {
+            // TODO: throw exception
+        }
 
-        scanner.setBasedir( basedir );
+        executeTestSet( testSet, reporterManager, classLoader );
+    }
 
-        if ( includes != null )
+    public int getNumTests()
+    {
+        if ( testSets == null )
         {
-            scanner.setIncludes( processIncludesExcludes( includes ) );
+            throw new IllegalStateException( "You must call locateTestSets before calling getNumTestSets" );
         }
+        return totalTests;
+    }
 
-        if ( excludes != null )
+    public int getNumTestSets()
+    {
+        if ( testSets == null )
         {
-            scanner.setExcludes( processIncludesExcludes( excludes ) );
+            throw new IllegalStateException( "You must call locateTestSets before calling getNumTestSets" );
         }
+        return testSets.size();
+    }
 
-        scanner.scan();
+    private String[] collectTests( File basedir, List includes, List excludes )
+    {
+        String[] tests = EMPTY_STRING_ARRAY;
+        if ( basedir.exists() )
+        {
+            DirectoryScanner scanner = new DirectoryScanner();
+
+            scanner.setBasedir( basedir );
+
+            if ( includes != null )
+            {
+                scanner.setIncludes( processIncludesExcludes( includes ) );
+            }
+
+            if ( excludes != null )
+            {
+                scanner.setExcludes( processIncludesExcludes( excludes ) );
+            }
 
-        return scanner.getIncludedFiles();
+            scanner.scan();
+
+            tests = scanner.getIncludedFiles();
+            for ( int i = 0; i < tests.length; i++ )
+            {
+                String test = tests[i];
+                test = test.substring( 0, test.indexOf( "." ) );
+                tests[i] = test.replace( FS.charAt( 0 ), '.' );
+            }
+        }
+        return tests;
     }
 
     private static String[] processIncludesExcludes( List list )

Propchange: maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/suite/AbstractDirectoryTestSuite.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Added: maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/suite/SurefireTestSuite.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/suite/SurefireTestSuite.java?rev=382683&view=auto
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/suite/SurefireTestSuite.java (added)
+++ maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/suite/SurefireTestSuite.java Thu Mar  2 22:07:26 2006
@@ -0,0 +1,41 @@
+package org.apache.maven.surefire.suite;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.surefire.report.ReporterManager;
+import org.apache.maven.surefire.testset.TestSetFailedException;
+
+import java.util.Map;
+
+/**
+ * A complete test suite that contains one or more test sets.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public interface SurefireTestSuite
+{
+    void execute( ReporterManager reporterManager, ClassLoader classLoader );
+
+    void execute( String testSetName, ReporterManager reporterManager, ClassLoader classLoader );
+
+    int getNumTests();
+
+    int getNumTestSets();
+
+    Map locateTestSets( ClassLoader classLoader )
+        throws ClassNotFoundException, TestSetFailedException;
+}

Propchange: maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/suite/SurefireTestSuite.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Copied: maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/AbstractTestSet.java (from r382036, maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/battery/AbstractBattery.java)
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/AbstractTestSet.java?p2=maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/AbstractTestSet.java&p1=maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/battery/AbstractBattery.java&r1=382036&r2=382683&rev=382683&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/battery/AbstractBattery.java (original)
+++ maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/AbstractTestSet.java Thu Mar  2 22:07:26 2006
@@ -1,4 +1,4 @@
-package org.apache.maven.surefire.battery;
+package org.apache.maven.surefire.testset;
 
 /*
  * Copyright 2001-2006 The Apache Software Foundation.
@@ -16,30 +16,30 @@
  * limitations under the License.
  */
 
-import org.apache.maven.surefire.Surefire;
 import org.apache.maven.surefire.report.ReportEntry;
 import org.apache.maven.surefire.report.ReporterManager;
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
-import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.List;
 
-public abstract class AbstractBattery
-    implements Battery
+/**
+ * @todo trim it up. Those implementing don't need any of this except for discoverTestMethods, getName and isValidMethod
+ * @todo bring back other helpers and put in a separate package
+ */
+public abstract class AbstractTestSet
+    implements SurefireTestSet
 {
     private static final String TEST_METHOD_PREFIX = "test";
 
     protected List testMethods;
 
-    protected List subBatteryClassNames;
-
     private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
 
-    public void execute( ReporterManager reportManager )
-        throws Exception
+    public void execute( ReporterManager reportManager, ClassLoader loader )
+        throws TestSetFailedException
     {
         if ( reportManager == null )
         {
@@ -95,6 +95,7 @@
         }
         catch ( Exception e )
         {
+/* TODO
             // Treat any exception from setUpFixture as a failure of the test.
             String rawString = Surefire.getResourceString( "setupFixtureFailed" );
 
@@ -107,6 +108,7 @@
             report = new ReportEntry( this, getTestName( userFriendlyMethodName ), stringToPrint, e );
 
             reportManager.testFailed( report );
+*/
 
             // A return value of true indicates to this class's executeTestMethods
             // method that it should abort and not attempt to execute
@@ -165,6 +167,7 @@
         catch ( Exception e )
         {
 
+/* TODO
             // Treat any exception from tearDownFixture as a failure of the test.
             String rawString = Surefire.getResourceString( "cleanupFixtureFailed" );
 
@@ -177,6 +180,7 @@
             report = new ReportEntry( this, getTestName( userFriendlyMethodName ), stringToPrint, e );
 
             reportManager.testFailed( report );
+*/
 
             // A return value of true indicates to this class's executeTestMethods
             // method that it should abort and not attempt to execute
@@ -194,7 +198,7 @@
         return false;
     }
 
-    public String getBatteryName()
+    public String getName()
     {
         return getClass().getName();
     }
@@ -210,6 +214,7 @@
     }
 
     public int getTestCount()
+        throws TestSetFailedException
     {
         discoverTestMethods();
 
@@ -232,6 +237,7 @@
     }
 
     protected Object getTestClassInstance()
+        throws IllegalAccessException, InstantiationException
     {
         return this;
     }
@@ -271,26 +277,6 @@
     // ----------------------------------------------------------------------
     // Batteries
     // ----------------------------------------------------------------------
-
-    public void discoverBatteryClassNames()
-        throws Exception
-    {
-    }
-
-    public void addSubBatteryClassName( String batteryClassName )
-    {
-        getSubBatteryClassNames().add( batteryClassName );
-    }
-
-    public List getSubBatteryClassNames()
-    {
-        if ( subBatteryClassNames == null )
-        {
-            subBatteryClassNames = new ArrayList();
-        }
-
-        return subBatteryClassNames;
-    }
 
     public static boolean isValidMethod( Method m )
     {

Propchange: maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/AbstractTestSet.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Copied: maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/SurefireTestSet.java (from r382020, maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/battery/Battery.java)
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/SurefireTestSet.java?p2=maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/SurefireTestSet.java&p1=maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/battery/Battery.java&r1=382020&r2=382683&rev=382683&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/battery/Battery.java (original)
+++ maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/SurefireTestSet.java Thu Mar  2 22:07:26 2006
@@ -1,4 +1,4 @@
-package org.apache.maven.surefire.battery;
+package org.apache.maven.surefire.testset;
 
 /*
  * Copyright 2001-2006 The Apache Software Foundation.
@@ -18,19 +18,15 @@
 
 import org.apache.maven.surefire.report.ReporterManager;
 
-import java.util.List;
-
-public interface Battery
+public interface SurefireTestSet
 {
-    void execute( ReporterManager reportManager )
+    void execute( ReporterManager reportManager, ClassLoader loader )
         throws Exception;
 
-    int getTestCount();
-
-    String getBatteryName();
+    // TODO: fix exception and its propogation
+    int getTestCount()
+        throws TestSetFailedException;
 
-    void discoverBatteryClassNames()
-        throws Exception;
+    String getName();
 
-    List getSubBatteryClassNames();
 }

Propchange: maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/SurefireTestSet.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Copied: maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/TestListenerInvocationHandler.java (from r382682, maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/battery/TestListenerInvocationHandler.java)
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/TestListenerInvocationHandler.java?p2=maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/TestListenerInvocationHandler.java&p1=maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/battery/TestListenerInvocationHandler.java&r1=382682&r2=382683&rev=382683&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/battery/TestListenerInvocationHandler.java (original)
+++ maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/TestListenerInvocationHandler.java Thu Mar  2 22:07:26 2006
@@ -1,4 +1,4 @@
-package org.apache.maven.surefire.battery;
+package org.apache.maven.surefire.testset;
 
 /*
  * Copyright 2001-2006 The Apache Software Foundation.

Copied: maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/TestSetFailedException.java (from r382020, maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/battery/assertion/BatteryTestFailedException.java)
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/TestSetFailedException.java?p2=maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/TestSetFailedException.java&p1=maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/battery/assertion/BatteryTestFailedException.java&r1=382020&r2=382683&rev=382683&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/battery/assertion/BatteryTestFailedException.java (original)
+++ maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/TestSetFailedException.java Thu Mar  2 22:07:26 2006
@@ -1,4 +1,4 @@
-package org.apache.maven.surefire.battery.assertion;
+package org.apache.maven.surefire.testset;
 
 /*
  * Copyright 2001-2006 The Apache Software Foundation.
@@ -21,13 +21,13 @@
  *
  * @author Bill Venners
  */
-public class BatteryTestFailedException
-    extends RuntimeException
+public class TestSetFailedException
+    extends Exception
 {
     /**
      * Create a <code>TestFailedException</code> with no detail message.
      */
-    public BatteryTestFailedException()
+    public TestSetFailedException()
     {
     }
 
@@ -38,7 +38,7 @@
      *                <code>null</code>. If <code>null</code> is passed, the <code>getMessage</code>
      *                method will return an empty <code>String</code>.
      */
-    public BatteryTestFailedException( String message )
+    public TestSetFailedException( String message )
     {
         super( message );
     }
@@ -55,7 +55,7 @@
      * @param cause   the cause, which is saved for later retrieval by the <code>getCause</code> method.
      *                (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
      */
-    public BatteryTestFailedException( String message, Throwable cause )
+    public TestSetFailedException( String message, Throwable cause )
     {
         super( message, cause );
     }
@@ -65,7 +65,7 @@
      * <code>getMessage</code> method of this exception object will return
      * <code>(cause == null ? "" : cause.toString())</code>.
      */
-    public BatteryTestFailedException( Throwable cause )
+    public TestSetFailedException( Throwable cause )
     {
         super( cause == null ? "" : cause.toString(), cause );
     }

Propchange: maven/surefire/branches/surefire-testng/surefire-api/src/main/java/org/apache/maven/surefire/testset/TestSetFailedException.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Modified: maven/surefire/branches/surefire-testng/surefire-api/src/main/resources/org/apache/maven/surefire/surefire.properties
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-api/src/main/resources/org/apache/maven/surefire/surefire.properties?rev=382683&r1=382682&r2=382683&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-api/src/main/resources/org/apache/maven/surefire/surefire.properties (original)
+++ maven/surefire/branches/surefire-testng/surefire-api/src/main/resources/org/apache/maven/surefire/surefire.properties Thu Mar  2 22:07:26 2006
@@ -18,10 +18,10 @@
 reporterThrew=Reporter method {0} completed abruptly with an exception.
 setupFixtureFailed=Method setupFixture threw an exception prior to calling {0}.
 cleanupFixtureFailed=Method cleanupFixture threw an exception prior to calling {0}.
-suiteExecutionStarting=The execute method of a subsuite is about to be invoked.
 executeException=Exception encountered when invoking execute on a subsuite.
-suiteCompletedNormally=The execute method of a subsuite returned normally.
 bigProblems=An exception or error caused a run to abort.
 testStarting=Test starting.
 testSuccessful=Test completed successfully.
-testSkipped=Test skipped.
\ No newline at end of file
+testSkipped=Test skipped.
+testSetStarting=Test class starting.
+testSetCompletedNormally=Test class completed.

Modified: maven/surefire/branches/surefire-testng/surefire-api/src/test/java/org/apache/maven/surefire/TestReport.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-api/src/test/java/org/apache/maven/surefire/TestReport.java?rev=382683&r1=382682&r2=382683&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-api/src/test/java/org/apache/maven/surefire/TestReport.java (original)
+++ maven/surefire/branches/surefire-testng/surefire-api/src/test/java/org/apache/maven/surefire/TestReport.java Thu Mar  2 22:07:26 2006
@@ -56,17 +56,17 @@
         System.out.println( "TestReport::testFailed -> " + reportEntry.getMessage() );
     }
 
-    public void batteryStarting( ReportEntry reportEntry )
+    public void testSetStarting( ReportEntry reportEntry )
     {
         System.out.println( "TestReport::suiteStarting -> " + reportEntry.getMessage() );
     }
 
-    public void batteryCompleted( ReportEntry reportEntry )
+    public void testSetCompleted( ReportEntry reportEntry )
     {
         System.out.println( "TestReport::suiteCompleted -> " + reportEntry.getMessage() );
     }
 
-    public void batteryAborted( ReportEntry reportEntry )
+    public void testSetAborted( ReportEntry reportEntry )
     {
         System.out.println( "TestReport::suiteAborted -> " + reportEntry.getMessage() );
     }
@@ -91,20 +91,20 @@
         System.out.println( "TestReport::runCompleted" );
     }
 
-    public void dispose()
+    public void reset()
     {
         System.out.println( "TestReport::dispose" );
     }
 
-    public int getNbErrors()
+    public int getNumErrors()
     {
-        System.out.println( "TestReport::getNbErrors" );
+        System.out.println( "TestReport::getNumErrors" );
         return 0;
     }
 
-    public int getNbFailures()
+    public int getNumFailures()
     {
-        System.out.println( "TestReport::getNbFailures" );
+        System.out.println( "TestReport::getNumFailures" );
         return 0;
     }
 

Modified: maven/surefire/branches/surefire-testng/surefire-api/src/test/java/org/apache/maven/surefire/report/XMLReporterTest.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-api/src/test/java/org/apache/maven/surefire/report/XMLReporterTest.java?rev=382683&r1=382682&r2=382683&view=diff
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-api/src/test/java/org/apache/maven/surefire/report/XMLReporterTest.java (original)
+++ maven/surefire/branches/surefire-testng/surefire-api/src/test/java/org/apache/maven/surefire/report/XMLReporterTest.java Thu Mar  2 22:07:26 2006
@@ -34,7 +34,7 @@
         throws Exception
     {
         super.setUp();
-        reporter = new XMLReporter();
+        reporter = new XMLReporter( null );
         message = "junit.framework.AssertionFailedError";
         reportEntry = new ReportEntry( this, "XMLReporterTest", message, new AssertionFailedError() );
         reporter.setTestCase( new Xpp3Dom( "" ) );

Added: maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkConfiguration.java
URL: http://svn.apache.org/viewcvs/maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkConfiguration.java?rev=382683&view=auto
==============================================================================
--- maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkConfiguration.java (added)
+++ maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkConfiguration.java Thu Mar  2 22:07:26 2006
@@ -0,0 +1,172 @@
+package org.apache.maven.surefire.booter;
+
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.cli.Commandline;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+/*
+ * 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.
+ */
+
+/**
+ * TODO: Description.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ */
+public class ForkConfiguration
+{
+    public static final String FORK_ONCE = "once";
+
+    public static final String FORK_PERTEST = "pertest";
+
+    public static final String FORK_NONE = "none";
+
+    private String forkMode;
+
+    private boolean childDelegation;
+
+    private Properties systemProperties;
+
+    private String jvmExecutable;
+
+    private String argLine;
+
+    private Map environmentVariables;
+
+    private File workingDirectory;
+
+    private boolean debug;
+
+    public void setForkMode( String forkMode )
+    {
+        if ( forkMode.equals( FORK_NONE ) || forkMode.equals( FORK_ONCE ) || forkMode.equals( FORK_PERTEST ) )
+        {
+            this.forkMode = forkMode;
+        }
+        else
+        {
+            throw new IllegalArgumentException( "Fork mode " + forkMode + " is not a legal value" );
+        }
+    }
+
+    public void setChildDelegation( boolean childDelegation )
+    {
+        this.childDelegation = childDelegation;
+    }
+
+    public boolean isChildDelegation()
+    {
+        return childDelegation;
+    }
+
+    public boolean isForking()
+    {
+        return !FORK_NONE.equals( forkMode );
+    }
+
+    public void setSystemProperties( Properties systemProperties )
+    {
+        this.systemProperties = new Properties( systemProperties );
+    }
+
+    // TODO: remove once mojo is back to Properties
+    public void setSystemProperties( Map systemProperties )
+    {
+        this.systemProperties = new Properties();
+        systemProperties.putAll( systemProperties );
+    }
+
+    public void setJvmExecutable( String jvmExecutable )
+    {
+        this.jvmExecutable = jvmExecutable;
+    }
+
+    public void setArgLine( String argLine )
+    {
+        this.argLine = argLine;
+    }
+
+    public void setEnvironmentVariables( Map environmentVariables )
+    {
+        this.environmentVariables = new HashMap( environmentVariables );
+    }
+
+    public void setWorkingDirectory( File workingDirectory )
+    {
+        this.workingDirectory = workingDirectory;
+    }
+
+    public String getForkMode()
+    {
+        return forkMode;
+    }
+
+    public Properties getSystemProperties()
+    {
+        return systemProperties;
+    }
+
+    public Commandline createCommandLine( List classPath )
+    {
+        Commandline cli = new Commandline();
+
+        cli.setExecutable( jvmExecutable );
+
+        if ( argLine != null )
+        {
+            cli.addArguments( StringUtils.split( argLine, " " ) );
+        }
+
+        if ( environmentVariables != null )
+        {
+            Iterator iter = environmentVariables.keySet().iterator();
+
+            while ( iter.hasNext() )
+            {
+                String key = (String) iter.next();
+
+                String value = (String) environmentVariables.get( key );
+
+                cli.addEnvironment( key, value );
+            }
+        }
+
+        cli.createArgument().setValue( "-classpath" );
+
+        cli.createArgument().setValue( StringUtils.join( classPath.iterator(), File.pathSeparator ) );
+
+        cli.createArgument().setValue( SurefireBooter.class.getName() );
+
+        cli.setWorkingDirectory( workingDirectory.getAbsolutePath() );
+
+        return cli;
+    }
+
+    public void setDebug( boolean debug )
+    {
+        this.debug = debug;
+    }
+
+    public boolean isDebug()
+    {
+        return debug;
+    }
+}

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

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

Copied: maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkingWriterStreamConsumer.java (from r382020, 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/booter/ForkingWriterStreamConsumer.java?p2=maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkingWriterStreamConsumer.java&p1=maven/surefire/branches/surefire-testng/surefire-booter/src/main/java/org/apache/maven/surefire/ForkingWriterStreamConsumer.java&r1=382020&r2=382683&rev=382683&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/booter/ForkingWriterStreamConsumer.java Thu Mar  2 22:07:26 2006
@@ -1,4 +1,4 @@
-package org.apache.maven.surefire;
+package org.apache.maven.surefire.booter;
 
 /*
  * Copyright 2001-2006 The Apache Software Foundation.
@@ -35,7 +35,7 @@
 
     private int headingPrefixLength;
 
-    boolean showHeading;
+    private boolean showHeading;
 
     public ForkingWriterStreamConsumer( Writer writer, boolean showHeading )
     {

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

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



Mime
View raw message