maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krosenv...@apache.org
Subject svn commit: r1042818 - in /maven/surefire/trunk: maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/ maven-failsafe-plugin/src/main/mdo/ maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/ maven-surefire-common/src/m...
Date Mon, 06 Dec 2010 22:28:02 GMT
Author: krosenvold
Date: Mon Dec  6 22:28:01 2010
New Revision: 1042818

URL: http://svn.apache.org/viewvc?rev=1042818&view=rev
Log:
o Refactoring only; Separated BooterConfiguration and ProviderConfiguration and renamed both.

Added:
    maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/StartupConfiguration.java
      - copied, changed from r1042451, maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java
Removed:
    maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterConfiguration.java
Modified:
    maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
    maven/surefire/trunk/maven-failsafe-plugin/src/main/mdo/failsafe-summary.mdo
    maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
    maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireHelper.java
    maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java
    maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
    maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerTest.java
    maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
    maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterConstants.java
    maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java
    maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
    maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java
    maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java
    maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireStarter.java
    maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemPropertyManager.java

Modified: maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java?rev=1042818&r1=1042817&r2=1042818&view=diff
==============================================================================
--- maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java (original)
+++ maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java Mon Dec  6 22:28:01 2010
@@ -31,8 +31,7 @@ import org.apache.maven.plugin.surefire.
 import org.apache.maven.plugin.surefire.booterclient.ForkConfiguration;
 import org.apache.maven.plugin.surefire.booterclient.ForkStarter;
 import org.apache.maven.project.MavenProject;
-import org.apache.maven.surefire.booter.BooterConfiguration;
-import org.apache.maven.surefire.booter.Classpath;
+import org.apache.maven.surefire.booter.ProviderConfiguration;
 import org.apache.maven.surefire.booter.SurefireBooterForkException;
 import org.apache.maven.surefire.booter.SurefireExecutionException;
 import org.apache.maven.surefire.failsafe.model.FailsafeSummary;
@@ -601,30 +600,25 @@ public class IntegrationTestMojo
     public void execute()
         throws MojoExecutionException, MojoFailureException
     {
-        final AbstractSurefireMojo.WellKnownProvider provider = initialize();
         if ( verifyParameters() )
         {
-            final Classpath bootClasspathConfiguration = new Classpath();
-            ForkConfiguration forkConfiguration = getForkConfiguration( bootClasspathConfiguration );
+            logReportsDirectory();
 
-            BooterConfiguration booterConfiguration = createBooterConfiguration( forkConfiguration, provider );
-            ForkStarter booter = new ForkStarter( booterConfiguration, reportsDirectory, forkConfiguration,
-                                                  getForkedProcessTimeoutInSeconds() );
-
-            getLog().info(
-                StringUtils.capitalizeFirstLetter( getPluginName() ) + " report directory: " + getReportsDirectory() );
+            final AbstractSurefireMojo.WellKnownProvider provider = initialize();
+            ForkConfiguration forkConfiguration = getForkConfiguration();
+            ForkStarter forkStarter = createForkStarter( provider, forkConfiguration );
 
             FailsafeSummary result = new FailsafeSummary();
             try
             {
-                result.setResult( booter.run() );
+                result.setResult( forkStarter.run() );
             }
             catch ( SurefireBooterForkException e )
             {
                 // Don't stop processing when timeout or other exception occures
                 // Otherwise, the following life cycles (e.g. post-integration-test)
                 // won't be executed
-                result.setResult( BooterConfiguration.TESTS_FAILED_EXIT_CODE );
+                result.setResult( ProviderConfiguration.TESTS_FAILED_EXIT_CODE );
                 result.setException( e.getMessage() );
             }
             catch ( SurefireExecutionException e )
@@ -632,7 +626,7 @@ public class IntegrationTestMojo
                 // Don't stop processing when timeout or other exception occures
                 // Otherwise, the following life cycles (e.g. post-integration-test)
                 // won't be executed
-                result.setResult( BooterConfiguration.TESTS_FAILED_EXIT_CODE );
+                result.setResult( ProviderConfiguration.TESTS_FAILED_EXIT_CODE );
                 result.setException( e.getMessage() );
             }
 

Modified: maven/surefire/trunk/maven-failsafe-plugin/src/main/mdo/failsafe-summary.mdo
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-failsafe-plugin/src/main/mdo/failsafe-summary.mdo?rev=1042818&r1=1042817&r2=1042818&view=diff
==============================================================================
--- maven/surefire/trunk/maven-failsafe-plugin/src/main/mdo/failsafe-summary.mdo (original)
+++ maven/surefire/trunk/maven-failsafe-plugin/src/main/mdo/failsafe-summary.mdo Mon Dec  6 22:28:01 2010
@@ -72,17 +72,17 @@ under the License.
     {
         switch ( this.result )
         {
-            case org.apache.maven.surefire.booter.BooterConfiguration.TESTS_SUCCEEDED_EXIT_CODE:
+            case org.apache.maven.surefire.booter.ProviderConfiguration.TESTS_SUCCEEDED_EXIT_CODE:
                 this.result = summary.result;
                 break;
-            case org.apache.maven.surefire.booter.BooterConfiguration.NO_TESTS_EXIT_CODE:
+            case org.apache.maven.surefire.booter.ProviderConfiguration.NO_TESTS_EXIT_CODE:
                 switch ( summary.result )
                 {
-                    case org.apache.maven.surefire.booter.BooterConfiguration.TESTS_SUCCEEDED_EXIT_CODE:
+                    case org.apache.maven.surefire.booter.ProviderConfiguration.TESTS_SUCCEEDED_EXIT_CODE:
                         break;
-                    case org.apache.maven.surefire.booter.BooterConfiguration.NO_TESTS_EXIT_CODE:
+                    case org.apache.maven.surefire.booter.ProviderConfiguration.NO_TESTS_EXIT_CODE:
                         break;
-                    case org.apache.maven.surefire.booter.BooterConfiguration.TESTS_FAILED_EXIT_CODE:
+                    case org.apache.maven.surefire.booter.ProviderConfiguration.TESTS_FAILED_EXIT_CODE:
                         this.result = summary.result;
                         break;
                     default:
@@ -90,14 +90,14 @@ under the License.
                         break;
                 }
                 break;
-            case org.apache.maven.surefire.booter.BooterConfiguration.TESTS_FAILED_EXIT_CODE:
+            case org.apache.maven.surefire.booter.ProviderConfiguration.TESTS_FAILED_EXIT_CODE:
                 switch ( summary.result )
                 {
-                    case org.apache.maven.surefire.booter.BooterConfiguration.TESTS_SUCCEEDED_EXIT_CODE:
+                    case org.apache.maven.surefire.booter.ProviderConfiguration.TESTS_SUCCEEDED_EXIT_CODE:
                         break;
-                    case org.apache.maven.surefire.booter.BooterConfiguration.NO_TESTS_EXIT_CODE:
+                    case org.apache.maven.surefire.booter.ProviderConfiguration.NO_TESTS_EXIT_CODE:
                         break;
-                    case org.apache.maven.surefire.booter.BooterConfiguration.TESTS_FAILED_EXIT_CODE:
+                    case org.apache.maven.surefire.booter.ProviderConfiguration.TESTS_FAILED_EXIT_CODE:
                         break;
                     default:
                         this.result = summary.result;

Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java?rev=1042818&r1=1042817&r2=1042818&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java Mon Dec  6 22:28:01 2010
@@ -34,12 +34,13 @@ import org.apache.maven.plugin.AbstractM
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugin.surefire.booterclient.ForkConfiguration;
+import org.apache.maven.plugin.surefire.booterclient.ForkStarter;
 import org.apache.maven.shared.artifact.filter.PatternIncludesArtifactFilter;
-import org.apache.maven.surefire.booter.BooterConfiguration;
 import org.apache.maven.surefire.booter.Classpath;
 import org.apache.maven.surefire.booter.ClasspathConfiguration;
 import org.apache.maven.surefire.booter.ProviderConfiguration;
 import org.apache.maven.surefire.booter.ProviderDetector;
+import org.apache.maven.surefire.booter.StartupConfiguration;
 import org.apache.maven.surefire.providerapi.SurefireProvider;
 import org.apache.maven.surefire.report.BriefConsoleReporter;
 import org.apache.maven.surefire.report.BriefFileReporter;
@@ -141,6 +142,13 @@ public abstract class AbstractSurefireMo
         }
     }
 
+    protected void logReportsDirectory()
+    {
+        getLog().info(
+            StringUtils.capitalizeFirstLetter( getPluginName() ) + " report directory: " + getReportsDirectory() );
+    }
+
+
     private String getManuallyConfiguredProviderName()
     {
         try
@@ -153,7 +161,8 @@ public abstract class AbstractSurefireMo
             }
             if ( objects.size() > 1 )
             {
-                throw new IllegalArgumentException( "Surefire currently only supports on manually configured provider" );
+                throw new IllegalArgumentException(
+                    "Surefire currently only supports on manually configured provider" );
             }
             return (String) objects.iterator().next();
 
@@ -268,12 +277,11 @@ public abstract class AbstractSurefireMo
         return ForkConfiguration.FORK_NEVER.equals( getForkMode() );
     }
 
-    protected BooterConfiguration createBooterConfiguration( ForkConfiguration forkConfiguration,
-                                                             WellKnownProvider provider )
+    protected ProviderConfiguration createProviderConfiguration( ForkConfiguration forkConfiguration,
+                                                                 WellKnownProvider provider,
+                                                                 StartupConfiguration startupConfiguration )
         throws MojoExecutionException, MojoFailureException
     {
-        final ClasspathConfiguration classpathConfiguration =
-            new ClasspathConfiguration( isEnableAssertions(), isChildDelegation() );
 
         List reports = getReporters( forkConfiguration.isForking() );
         ReporterConfiguration reporterConfiguration =
@@ -289,7 +297,6 @@ public abstract class AbstractSurefireMo
 
         Artifact junitArtifact;
         Artifact testNgArtifact;
-        String providerName;
         try
         {
             addArtifact( forkConfiguration.getBootClasspath(), surefireArtifact );
@@ -300,8 +307,7 @@ public abstract class AbstractSurefireMo
 
             provider.addProviderProperties();
             provider.addProviderArtifactToBootClasspath( forkConfiguration.getBootClasspath() );
-            provider.addProviderArtifactToSurefireClasspath( classpathConfiguration );
-            providerName = provider.getProviderName();
+            provider.addProviderArtifactToSurefireClasspath( startupConfiguration.getClasspathConfiguration() );
         }
         catch ( ArtifactNotFoundException e )
         {
@@ -357,35 +363,10 @@ public abstract class AbstractSurefireMo
         {
             providerProperties = new Properties();
         }
-        ProviderConfiguration surefireStarterConfiguration =
-            new ProviderConfiguration( providerName, classpathConfiguration,
-                                       forkConfiguration.getClassLoaderConfiguration(), forkConfiguration.isForking(),
-                                       false, isRedirectTestOutputToFile() );
-
-        BooterConfiguration booterConfiguration =
-            new BooterConfiguration( surefireStarterConfiguration, reports, directoryScannerParameters, failIfNoTests,
-                                     reporterConfiguration, testNg, testSuiteDefinition, providerProperties, null );
 
-        List classpathElements;
-        try
-        {
-            classpathElements = generateTestClasspath();
-        }
-        catch ( DependencyResolutionRequiredException e )
-        {
-            throw new MojoExecutionException( "Unable to generate test classpath: " + e, e );
-        }
-
-        getLog().debug( "Test Classpath :" );
-
-        for ( Iterator i = classpathElements.iterator(); i.hasNext(); )
-        {
-            String classpathElement = (String) i.next();
-
-            getLog().debug( "  " + classpathElement );
-
-            classpathConfiguration.addClasspathUrl( classpathElement );
-        }
+        ProviderConfiguration providerConfiguration1 =
+            new ProviderConfiguration( reports, directoryScannerParameters, failIfNoTests, reporterConfiguration,
+                                       testNg, testSuiteDefinition, providerProperties, null );
 
         Toolchain tc = getToolchain();
 
@@ -406,9 +387,70 @@ public abstract class AbstractSurefireMo
             }
         }
 
-        return booterConfiguration;
+        return providerConfiguration1;
+    }
+
+    protected StartupConfiguration createStartupConfiguration( ForkConfiguration forkConfiguration,
+                                                               WellKnownProvider provider )
+        throws MojoExecutionException, MojoFailureException
+    {
+        final ClasspathConfiguration classpathConfiguration =
+            new ClasspathConfiguration( isEnableAssertions(), isChildDelegation() );
+
+        surefireArtifact = (Artifact) getPluginArtifactMap().get( "org.apache.maven.surefire:surefire-booter" );
+        if ( surefireArtifact == null )
+        {
+            throw new MojoExecutionException( "Unable to locate surefire-booter in the list of plugin artifacts" );
+        }
+
+        surefireArtifact.isSnapshot(); // MNG-2961: before Maven 2.0.8, fixes getBaseVersion to be -SNAPSHOT if needed
+
+        String providerName;
+        try
+        {
+            addArtifact( forkConfiguration.getBootClasspath(), surefireArtifact );
+
+            provider.addProviderProperties();
+            provider.addProviderArtifactToBootClasspath( forkConfiguration.getBootClasspath() );
+            provider.addProviderArtifactToSurefireClasspath( classpathConfiguration );
+            providerName = provider.getProviderName();
+        }
+        catch ( ArtifactNotFoundException e )
+        {
+            throw new MojoExecutionException(
+                "Unable to locate required surefire provider dependency: " + e.getMessage(), e );
+        }
+        catch ( ArtifactResolutionException e )
+        {
+            throw new MojoExecutionException( "Error to resolving surefire provider dependency: " + e.getMessage(), e );
+        }
+
+        List classpathElements;
+        try
+        {
+            classpathElements = generateTestClasspath();
+        }
+        catch ( DependencyResolutionRequiredException e )
+        {
+            throw new MojoExecutionException( "Unable to generate test classpath: " + e, e );
+        }
+
+        getLog().debug( "Test Classpath :" );
+
+        for ( Iterator i = classpathElements.iterator(); i.hasNext(); )
+        {
+            String classpathElement = (String) i.next();
+
+            getLog().debug( "  " + classpathElement );
+
+            classpathConfiguration.addClasspathUrl( classpathElement );
+        }
+        return new StartupConfiguration( providerName, classpathConfiguration,
+                                         forkConfiguration.getClassLoaderConfiguration(), forkConfiguration.isForking(),
+                                         false, isRedirectTestOutputToFile() );
     }
 
+
     private boolean isSpecificTestSpecified()
     {
         return getTest() != null;
@@ -517,8 +559,20 @@ public abstract class AbstractSurefireMo
         return junitArtifact;
     }
 
-    protected ForkConfiguration getForkConfiguration( Classpath bootClasspathConfiguration )
+    protected ForkStarter createForkStarter( WellKnownProvider provider, ForkConfiguration forkConfiguration )
+        throws MojoExecutionException, MojoFailureException
     {
+        StartupConfiguration startupConfiguration = createStartupConfiguration( forkConfiguration, provider );
+        ProviderConfiguration providerConfiguration =
+            createProviderConfiguration( forkConfiguration, provider, startupConfiguration );
+        return new ForkStarter( providerConfiguration, startupConfiguration, getReportsDirectory(), forkConfiguration,
+                                getForkedProcessTimeoutInSeconds() );
+    }
+
+    protected ForkConfiguration getForkConfiguration()
+    {
+        final Classpath bootClasspathConfiguration = new Classpath();
+
         ForkConfiguration fork = new ForkConfiguration( bootClasspathConfiguration );
 
         fork.setForkMode( getForkMode() );

Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireHelper.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireHelper.java?rev=1042818&r1=1042817&r2=1042818&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireHelper.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireHelper.java Mon Dec  6 22:28:01 2010
@@ -21,7 +21,7 @@ package org.apache.maven.plugin.surefire
 
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.surefire.booter.BooterConfiguration;
+import org.apache.maven.surefire.booter.ProviderConfiguration;
 
 /**
  * Helper class for surefire plugins
@@ -47,7 +47,7 @@ public final class SurefireHelper
 
         String msg;
 
-        if ( result == BooterConfiguration.NO_TESTS_EXIT_CODE )
+        if ( result == ProviderConfiguration.NO_TESTS_EXIT_CODE )
         {
             if ( ( reportParameters.getFailIfNoTests() == null ) || !reportParameters.getFailIfNoTests().booleanValue() )
             {

Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java?rev=1042818&r1=1042817&r2=1042818&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java Mon Dec  6 22:28:01 2010
@@ -18,10 +18,10 @@ package org.apache.maven.plugin.surefire
  * under the License.
  */
 
-import org.apache.maven.surefire.booter.BooterConfiguration;
+import org.apache.maven.surefire.booter.ProviderConfiguration;
 import org.apache.maven.surefire.booter.BooterConstants;
 import org.apache.maven.surefire.booter.ClassLoaderConfiguration;
-import org.apache.maven.surefire.booter.ProviderConfiguration;
+import org.apache.maven.surefire.booter.StartupConfiguration;
 import org.apache.maven.surefire.booter.SystemPropertyManager;
 import org.apache.maven.surefire.report.ReporterConfiguration;
 import org.apache.maven.surefire.testset.DirectoryScannerParameters;
@@ -53,7 +53,6 @@ import java.util.Properties;
  * @version $Id$
  */
 public class BooterSerializer
-    implements BooterConstants
 {
     private final ForkConfiguration forkConfiguration;
 
@@ -63,18 +62,18 @@ public class BooterSerializer
     }
 
 
-    public File serialize( Properties properties, BooterConfiguration booterConfiguration,
-                           ForkConfiguration forkConfiguration, Object testSet )
+    public File serialize( Properties properties, ProviderConfiguration booterConfiguration, StartupConfiguration providerConfiguration,
+                           Object testSet )
         throws IOException
     {
-        setForkProperties( properties, booterConfiguration, testSet );
+        setForkProperties( properties, booterConfiguration, providerConfiguration, testSet );
 
         SystemPropertyManager systemPropertyManager = new SystemPropertyManager();
         return systemPropertyManager.writePropertiesFile( properties, forkConfiguration.getTempDirectory(), "surefire",
                                                           forkConfiguration.isDebug() );
     }
 
-    public void setForkProperties( Properties properties, BooterConfiguration booterConfiguration, Object testSet )
+    private void setForkProperties(Properties properties, ProviderConfiguration booterConfiguration, StartupConfiguration providerConfiguration, Object testSet)
     {
         if ( properties == null )
         {
@@ -82,25 +81,23 @@ public class BooterSerializer
         }
         addList( booterConfiguration.getReports(), properties, BooterConstants.REPORT_PROPERTY_PREFIX );
         List params = new ArrayList();
-        params.add( new Object[]{ DIRSCANNER_OPTIONS, booterConfiguration.getDirScannerParamsArray() } );
+        params.add( new Object[]{ BooterConstants.DIRSCANNER_OPTIONS, booterConfiguration.getDirScannerParamsArray() } );
         addPropertiesForTypeHolder( params, properties, BooterConstants.DIRSCANNER_PROPERTY_PREFIX );
 
-        final ProviderConfiguration surefireStarterConfiguration =
-            booterConfiguration.getSurefireStarterConfiguration();
-        surefireStarterConfiguration.getClasspathConfiguration().setForkProperties( properties );
+        providerConfiguration.getClasspathConfiguration().setForkProperties( properties );
 
         ReporterConfiguration reporterConfiguration = booterConfiguration.getReporterConfiguration();
 
-        TestArtifactInfo testNg = booterConfiguration.getTestNg();
+        TestArtifactInfo testNg = booterConfiguration.getTestArtifact();
         if ( testNg != null )
         {
             if ( testNg.getVersion() != null )
             {
-                properties.setProperty( BooterConstants.TESTNGVERSION, testNg.getVersion() );
+                properties.setProperty( BooterConstants.TESTARTIFACT_VERSION, testNg.getVersion() );
             }
             if ( testNg.getClassifier() != null )
             {
-                properties.setProperty( BooterConstants.TESTNG_CLASSIFIER, testNg.getClassifier() );
+                properties.setProperty( BooterConstants.TESTARTIFACT_CLASSIFIER, testNg.getClassifier() );
             }
         }
 
@@ -151,22 +148,9 @@ public class BooterSerializer
         properties.setProperty( BooterConstants.FAILIFNOTESTS,
                                 String.valueOf( booterConfiguration.isFailIfNoTests() ) );
         properties.setProperty( BooterConstants.PROVIDER_CONFIGURATION,
-                                surefireStarterConfiguration.getProviderClassName() );
+                                providerConfiguration.getProviderClassName() );
     }
 
-    public File writePropertiesFile( String name, Properties properties )
-        throws IOException
-    {
-        File file = File.createTempFile( name, "tmp", forkConfiguration.getTempDirectory() );
-        if ( !forkConfiguration.isDebug() )
-        {
-            file.deleteOnExit();
-        }
-
-        writePropertiesFile( file, name, properties );
-
-        return file;
-    }
 
     void writePropertiesFile( File file, String name, Properties properties )
         throws IOException

Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java?rev=1042818&r1=1042817&r2=1042818&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java Mon Dec  6 22:28:01 2010
@@ -24,10 +24,10 @@ import org.apache.maven.plugin.surefire.
 import org.apache.maven.plugin.surefire.booterclient.output.StandardOutputConsumer;
 import org.apache.maven.plugin.surefire.booterclient.output.SupressFooterOutputConsumerProxy;
 import org.apache.maven.plugin.surefire.booterclient.output.SupressHeaderOutputConsumerProxy;
-import org.apache.maven.surefire.booter.BooterConfiguration;
 import org.apache.maven.surefire.booter.Classpath;
 import org.apache.maven.surefire.booter.ProviderConfiguration;
 import org.apache.maven.surefire.booter.ProviderFactory;
+import org.apache.maven.surefire.booter.StartupConfiguration;
 import org.apache.maven.surefire.booter.SurefireBooterForkException;
 import org.apache.maven.surefire.booter.SurefireExecutionException;
 import org.apache.maven.surefire.booter.SurefireStarter;
@@ -64,19 +64,22 @@ public class ForkStarter
 {
     private final int forkedProcessTimeoutInSeconds;
 
-    private final BooterConfiguration booterConfiguration;
+    private final ProviderConfiguration providerConfiguration;
+
+    private final StartupConfiguration startupConfiguration;
 
     private final ForkConfiguration forkConfiguration;
 
     private final File reportsDirectory;
 
-    public ForkStarter( BooterConfiguration booterConfiguration, File reportsDirectory,
-                        ForkConfiguration forkConfiguration, int forkedProcessTimeoutInSeconds )
+    public ForkStarter( ProviderConfiguration providerConfiguration, StartupConfiguration startupConfiguration,
+                        File reportsDirectory, ForkConfiguration forkConfiguration, int forkedProcessTimeoutInSeconds )
     {
         this.forkConfiguration = forkConfiguration;
-        this.booterConfiguration = booterConfiguration;
+        this.providerConfiguration = providerConfiguration;
         this.reportsDirectory = reportsDirectory;
         this.forkedProcessTimeoutInSeconds = forkedProcessTimeoutInSeconds;
+        this.startupConfiguration = startupConfiguration;
     }
 
     public int run()
@@ -87,9 +90,9 @@ public class ForkStarter
         final String requestedForkMode = forkConfiguration.getForkMode();
         if ( ForkConfiguration.FORK_NEVER.equals( requestedForkMode ) )
         {
-            SurefireStarter testVmBooter = new SurefireStarter( booterConfiguration );
-            RunResult runResult = testVmBooter.runSuitesInProcess();
-            result = testVmBooter.processRunCount( runResult );
+            SurefireStarter surefireStarter = new SurefireStarter( startupConfiguration, providerConfiguration );
+            RunResult runResult = surefireStarter.runSuitesInProcess();
+            result = surefireStarter.processRunCount( runResult );
         }
         else if ( ForkConfiguration.FORK_ONCE.equals( requestedForkMode ) )
         {
@@ -109,7 +112,7 @@ public class ForkStarter
     private int runSuitesForkOnce()
         throws SurefireBooterForkException
     {
-        return fork( null, booterConfiguration.getProviderProperties(), true, true );
+        return fork( null, providerConfiguration.getProviderProperties(), true, true );
     }
 
     private int runSuitesForkPerTestSet()
@@ -119,13 +122,12 @@ public class ForkStarter
 
         ClassLoader testsClassLoader;
         ClassLoader surefireClassLoader;
-        final ProviderConfiguration starterConfiguration = booterConfiguration.getSurefireStarterConfiguration();
         try
         {
-            testsClassLoader = starterConfiguration.getClasspathConfiguration().createTestClassLoader( false );
+            testsClassLoader = startupConfiguration.getClasspathConfiguration().createTestClassLoader( false );
             // TODO: assertions = true shouldn't be required if we had proper separation (see TestNG)
             surefireClassLoader =
-                starterConfiguration.getClasspathConfiguration().createSurefireClassLoader( testsClassLoader );
+                startupConfiguration.getClasspathConfiguration().createSurefireClassLoader( testsClassLoader );
         }
         catch ( SurefireExecutionException e )
         {
@@ -133,7 +135,8 @@ public class ForkStarter
         }
 
         boolean showHeading = true;
-        final ProviderFactory providerFactory = new ProviderFactory( booterConfiguration, surefireClassLoader );
+        final ProviderFactory providerFactory =
+            new ProviderFactory( startupConfiguration, providerConfiguration, surefireClassLoader );
         SurefireProvider surefireProvider = providerFactory.createProvider( testsClassLoader );
 
         Properties properties = new Properties();
@@ -165,7 +168,7 @@ public class ForkStarter
             BooterSerializer booterSerializer = new BooterSerializer( forkConfiguration );
 
             surefireProperties =
-                booterSerializer.serialize( properties, booterConfiguration, forkConfiguration, testSet );
+                booterSerializer.serialize( properties, providerConfiguration, startupConfiguration, testSet );
 
             if ( forkConfiguration.getSystemProperties() != null )
             {
@@ -180,10 +183,9 @@ public class ForkStarter
             throw new SurefireBooterForkException( "Error creating properties files for forking", e );
         }
 
-        final ProviderConfiguration starterConfiguration = booterConfiguration.getSurefireStarterConfiguration();
         final Classpath bootClasspathConfiguration = forkConfiguration.getBootClasspath();
-        final Classpath additionlClassPathUrls = starterConfiguration.useSystemClassLoader()
-            ? starterConfiguration.getClasspathConfiguration().getTestClasspath()
+        final Classpath additionlClassPathUrls = startupConfiguration.useSystemClassLoader()
+            ? startupConfiguration.getClasspathConfiguration().getTestClasspath()
             : null;
 
         Classpath bootClasspath = bootClasspathConfiguration.append( additionlClassPathUrls );
@@ -197,14 +199,14 @@ public class ForkStarter
             cli.createArg().setFile( systemProperties );
         }
 
-        final boolean willBeSharingConsumer = starterConfiguration.isRedirectTestOutputToFile();
+        final boolean willBeSharingConsumer = startupConfiguration.isRedirectTestOutputToFile();
 
         ForkingStreamConsumer out =
-            getForkingStreamConsumer( showHeading, showFooter, starterConfiguration.isRedirectTestOutputToFile() );
+            getForkingStreamConsumer( showHeading, showFooter, startupConfiguration.isRedirectTestOutputToFile() );
 
         StreamConsumer err = willBeSharingConsumer
             ? out
-            : getForkingStreamConsumer( showHeading, showFooter, starterConfiguration.isRedirectTestOutputToFile() );
+            : getForkingStreamConsumer( showHeading, showFooter, startupConfiguration.isRedirectTestOutputToFile() );
 
         if ( forkConfiguration.isDebug() )
         {
@@ -222,7 +224,7 @@ public class ForkStarter
             throw new SurefireBooterForkException( "Error while executing forked tests.", e );
         }
 
-        if ( starterConfiguration.isRedirectTestOutputToFile() )
+        if ( startupConfiguration.isRedirectTestOutputToFile() )
         {
             // ensure the FileOutputConsumerProxy flushes/closes the output file
             try

Modified: maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerTest.java?rev=1042818&r1=1042817&r2=1042818&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerTest.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerTest.java Mon Dec  6 22:28:01 2010
@@ -21,11 +21,12 @@ package org.apache.maven.plugin.surefire
 
 import junit.framework.Assert;
 import junit.framework.TestCase;
-import org.apache.maven.surefire.booter.BooterConfiguration;
 import org.apache.maven.surefire.booter.BooterDeserializer;
 import org.apache.maven.surefire.booter.ClassLoaderConfiguration;
 import org.apache.maven.surefire.booter.ClasspathConfiguration;
 import org.apache.maven.surefire.booter.ProviderConfiguration;
+import org.apache.maven.surefire.booter.StartupConfiguration;
+import org.apache.maven.surefire.booter.SystemPropertyManager;
 import org.apache.maven.surefire.report.ReporterConfiguration;
 import org.apache.maven.surefire.testset.DirectoryScannerParameters;
 import org.apache.maven.surefire.testset.TestArtifactInfo;
@@ -72,9 +73,10 @@ public class BooterDeserializerTest
         DirectoryScannerParameters directoryScannerParameters =
             new DirectoryScannerParameters( aDir, includes, excludes, Boolean.TRUE );
         ClassLoaderConfiguration forkConfiguration = getForkConfiguration();
-        BooterConfiguration booterConfiguration =
+        final StartupConfiguration testProviderConfiguration = getTestProviderConfiguration( forkConfiguration );
+        ProviderConfiguration booterConfiguration =
             getTestBooterConfiguration( forkConfiguration, directoryScannerParameters, new ArrayList() );
-        BooterConfiguration read = saveAndReload( forkConfiguration, booterConfiguration );
+        ProviderConfiguration read = saveAndReload( booterConfiguration, testProviderConfiguration );
 
         Assert.assertEquals( aDir, read.getBaseDir() );
         Assert.assertEquals( includes.get( 0 ), read.getIncludes().get( 0 ) );
@@ -94,14 +96,15 @@ public class BooterDeserializerTest
         reports.add( "cde" );
         reports.add( "efg" );
 
-        BooterConfiguration booterConfiguration =
+        ProviderConfiguration booterConfiguration =
             getTestBooterConfiguration( forkConfiguration, directoryScannerParameters, reports );
 
         booterConfiguration.getReports().add( "abc" );
         booterConfiguration.getReports().add( "cde" );
         booterConfiguration.getReports().add( "efg" );
 
-        BooterConfiguration reloaded = saveAndReload( forkConfiguration, booterConfiguration );
+        final StartupConfiguration testProviderConfiguration = getTestProviderConfiguration( forkConfiguration );
+        ProviderConfiguration reloaded = saveAndReload( booterConfiguration, testProviderConfiguration );
 
         Assert.assertEquals( "abc", reloaded.getReports().get( 0 ) );
         Assert.assertEquals( "cde", reloaded.getReports().get( 1 ) );
@@ -111,16 +114,16 @@ public class BooterDeserializerTest
     public void testTestNgArtifact()
         throws IOException
     {
-        BooterConfiguration reloaded = getReloladedConfig();
+        ProviderConfiguration reloaded = getReloladedConfig();
 
-        Assert.assertEquals( "5.0", reloaded.getTestNg().getVersion() );
-        Assert.assertEquals( "ABC", reloaded.getTestNg().getClassifier() );
+        Assert.assertEquals( "5.0", reloaded.getTestArtifact().getVersion() );
+        Assert.assertEquals( "ABC", reloaded.getTestArtifact().getClassifier() );
     }
 
     public void testTestSuiteDefinition()
         throws IOException
     {
-        BooterConfiguration reloaded = getReloladedConfig();
+        ProviderConfiguration reloaded = getReloladedConfig();
 
         TestRequest testSuiteDefinition = reloaded.getTestSuiteDefinition();
         File[] suiteXmlFiles = testSuiteDefinition.getSuiteXmlFiles();
@@ -137,28 +140,35 @@ public class BooterDeserializerTest
     public void testProvider()
         throws IOException
     {
-        BooterConfiguration reloaded = getReloladedConfig();
-
-        assertEquals( "com.provider", reloaded.getSurefireStarterConfiguration().getProviderClassName() );
+        assertEquals( "com.provider", getReloadedProviderConfiguration().getProviderClassName() );
 
     }
 
     public void testFailIfNoTests()
         throws IOException
     {
-        BooterConfiguration reloaded = getReloladedConfig();
+        ProviderConfiguration reloaded = getReloladedConfig();
         assertTrue( reloaded.isFailIfNoTests().booleanValue() );
 
     }
 
-    private BooterConfiguration getReloladedConfig()
+    private ProviderConfiguration getReloladedConfig()
         throws IOException
     {
         DirectoryScannerParameters directoryScannerParameters = getDirectoryScannerParameters();
         ClassLoaderConfiguration forkConfiguration = getForkConfiguration();
-        BooterConfiguration booterConfiguration =
+        ProviderConfiguration booterConfiguration =
             getTestBooterConfiguration( forkConfiguration, directoryScannerParameters, new ArrayList() );
-        return saveAndReload( forkConfiguration, booterConfiguration );
+        final StartupConfiguration testProviderConfiguration = getTestProviderConfiguration( forkConfiguration );
+        return saveAndReload( booterConfiguration, testProviderConfiguration );
+    }
+
+    private StartupConfiguration getReloadedProviderConfiguration()
+        throws IOException
+    {
+        DirectoryScannerParameters directoryScannerParameters = getDirectoryScannerParameters();
+        ClassLoaderConfiguration forkConfiguration = getForkConfiguration();
+        return getTestProviderConfiguration( forkConfiguration );
     }
 
     private DirectoryScannerParameters getDirectoryScannerParameters()
@@ -174,35 +184,44 @@ public class BooterDeserializerTest
         return new DirectoryScannerParameters( aDir, includes, excludes, Boolean.TRUE );
     }
 
-    private BooterConfiguration saveAndReload( ClassLoaderConfiguration forkConfiguration,
-                                               BooterConfiguration booterConfiguration )
+    private ProviderConfiguration saveAndReload( ProviderConfiguration booterConfiguration,
+                                                 StartupConfiguration testProviderConfiguration )
         throws IOException
     {
-        BooterSerializer booterSerializer = new BooterSerializer( ForkConfigurationTest.getForkConfiguration() );
+        final ForkConfiguration forkConfiguration = ForkConfigurationTest.getForkConfiguration();
+        BooterSerializer booterSerializer = new BooterSerializer( forkConfiguration );
         Properties props = new Properties();
-        booterSerializer.setForkProperties( props, booterConfiguration, aTest );
-        final File propsTest = booterSerializer.writePropertiesFile( "propsTest", props );
-        BooterDeserializer booterDeserializer = new BooterDeserializer();
-        return booterDeserializer.deserialize( new FileInputStream( propsTest ) );
+        booterSerializer.serialize( props, booterConfiguration, testProviderConfiguration, aTest );
+        final File propsTest =
+            SystemPropertyManager.writePropertiesFile( props, forkConfiguration.getTempDirectory(), "propsTest", true );
+        BooterDeserializer booterDeserializer = new BooterDeserializer( new FileInputStream( propsTest ) );
+        return booterDeserializer.deserialize();
     }
 
-    private BooterConfiguration getTestBooterConfiguration( ClassLoaderConfiguration classLoaderConfiguration,
-                                                            DirectoryScannerParameters directoryScannerParameters,
-                                                            List reports )
+    private ProviderConfiguration getTestBooterConfiguration( ClassLoaderConfiguration classLoaderConfiguration,
+                                                              DirectoryScannerParameters directoryScannerParameters,
+                                                              List reports )
         throws IOException
     {
         ClasspathConfiguration classpathConfiguration = new ClasspathConfiguration( true, true );
 
-        ReporterConfiguration reporterConfiguration = new ReporterConfiguration(reports, new File( "." ), Boolean.TRUE );
+        ReporterConfiguration reporterConfiguration =
+            new ReporterConfiguration( reports, new File( "." ), Boolean.TRUE );
         TestRequest testSuiteDefinition =
             new TestRequest( getSuiteXmlFileStrings(), getTEstSourceDirectory(), aUserRequestedTest );
-        ProviderConfiguration surefireStarterConfiguration =
-            new ProviderConfiguration( "com.provider", classpathConfiguration, classLoaderConfiguration, false, false,
-                                       false );
-
-        return new BooterConfiguration( surefireStarterConfiguration, reports, directoryScannerParameters, true,
-                                        reporterConfiguration, new TestArtifactInfo( "5.0", "ABC" ),
-                                        testSuiteDefinition, new Properties(), aTest );
+        StartupConfiguration surefireStarterConfiguration = getTestProviderConfiguration( classLoaderConfiguration );
+
+        return new ProviderConfiguration( reports, directoryScannerParameters, true, reporterConfiguration,
+                                          new TestArtifactInfo( "5.0", "ABC" ), testSuiteDefinition, new Properties(),
+                                          aTest );
+    }
+
+    private StartupConfiguration getTestProviderConfiguration( ClassLoaderConfiguration classLoaderConfiguration )
+    {
+        ClasspathConfiguration classpathConfiguration = new ClasspathConfiguration( true, true );
+
+        return new StartupConfiguration( "com.provider", classpathConfiguration, classLoaderConfiguration, false, false,
+                                         false );
     }
 
     private File getTEstSourceDirectory()
@@ -214,8 +233,9 @@ public class BooterDeserializerTest
     {
         return new File[]{ new File( "A1" ), new File( "A2" ) };
     }
+
     private Object[] getSuiteXmlFileStrings()
     {
-        return new Object[]{  "A1" , "A2" };
+        return new Object[]{ "A1", "A2" };
     }
 }

Modified: maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java?rev=1042818&r1=1042817&r2=1042818&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java (original)
+++ maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java Mon Dec  6 22:28:01 2010
@@ -29,8 +29,6 @@ import org.apache.maven.plugin.MojoFailu
 import org.apache.maven.plugin.surefire.booterclient.ForkConfiguration;
 import org.apache.maven.plugin.surefire.booterclient.ForkStarter;
 import org.apache.maven.project.MavenProject;
-import org.apache.maven.surefire.booter.BooterConfiguration;
-import org.apache.maven.surefire.booter.Classpath;
 import org.apache.maven.surefire.booter.SurefireBooterForkException;
 import org.apache.maven.surefire.booter.SurefireExecutionException;
 import org.apache.maven.toolchain.ToolchainManager;
@@ -567,19 +565,13 @@ public class SurefirePlugin
     public void execute()
         throws MojoExecutionException, MojoFailureException
     {
-        final WellKnownProvider provider = initialize();
         if ( verifyParameters() )
         {
-            final Classpath bootClasspathConfiguration = new Classpath();
-            ForkConfiguration forkConfiguration = getForkConfiguration( bootClasspathConfiguration );
+            logReportsDirectory();
 
-            BooterConfiguration booterConfiguration = createBooterConfiguration( forkConfiguration, provider );
-
-            getLog().info(
-                StringUtils.capitalizeFirstLetter( getPluginName() ) + " report directory: " + getReportsDirectory() );
-
-            ForkStarter forkStarter = new ForkStarter( booterConfiguration, reportsDirectory, forkConfiguration,
-                                                       getForkedProcessTimeoutInSeconds() );
+            final WellKnownProvider provider = initialize();
+            ForkConfiguration forkConfiguration = getForkConfiguration();
+            ForkStarter forkStarter = createForkStarter( provider, forkConfiguration );
 
             int result;
             try

Modified: maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterConstants.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterConstants.java?rev=1042818&r1=1042817&r2=1042818&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterConstants.java (original)
+++ maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterConstants.java Mon Dec  6 22:28:01 2010
@@ -1,5 +1,25 @@
 package org.apache.maven.surefire.booter;
 
+/*
+ * 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.
+ */
+
+
 /**
  * Constants used by the serializer/deserializer
  * @author Kristian Rosenvold
@@ -22,8 +42,8 @@ public interface BooterConstants
     String FAILIFNOTESTS = "failIfNoTests";
     String ISTRIMSTACKTRACE = "isTrimStackTrace";
     String REPORTSDIRECTORY = "reportsDirectory";
-    String TESTNGVERSION = "testNgVersion";
-    String TESTNG_CLASSIFIER = "testNgClassifier";
+    String TESTARTIFACT_VERSION = "testFwJarVersion";
+    String TESTARTIFACT_CLASSIFIER = "testFwJarClassifier";
     String REQUESTEDTEST = "requestedTest";
     String SOURCE_DIRECTORY = "testSuiteDefinitionTestSourceDirectory";
     String TEST_CLASSES_DIRECTORY = "testClassesDirectory";

Modified: maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java?rev=1042818&r1=1042817&r2=1042818&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java (original)
+++ maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/BooterDeserializer.java Mon Dec  6 22:28:01 2010
@@ -53,10 +53,15 @@ public class BooterDeserializer
 {
 
 
-    public BooterConfiguration deserialize( InputStream inputStream )
+    final PropertiesWrapper properties;
+
+    public BooterDeserializer(InputStream inputStream ) throws IOException {
+        properties = SystemPropertyManager.loadProperties( inputStream );
+    }
+
+    public ProviderConfiguration deserialize()
         throws IOException
     {
-        PropertiesWrapper properties = SystemPropertyManager.loadProperties( inputStream );
         DirectoryScannerParameters dirScannerParams;
         boolean enableAssertions = false;
         boolean childDelegation = true;
@@ -140,13 +145,13 @@ public class BooterDeserializer
             {
                 reportsDirectory = new File( properties.getProperty( REPORTSDIRECTORY ) );
             }
-            else if ( TESTNGVERSION.equals( name ) )
+            else if ( TESTARTIFACT_VERSION.equals( name ) )
             {
-                testNgVersion = properties.getProperty( TESTNGVERSION );
+                testNgVersion = properties.getProperty( TESTARTIFACT_VERSION );
             }
-            else if ( TESTNG_CLASSIFIER.equals( name ) )
+            else if ( TESTARTIFACT_CLASSIFIER.equals( name ) )
             {
-                testNgClassifier = properties.getProperty( TESTNG_CLASSIFIER );
+                testNgClassifier = properties.getProperty( TESTARTIFACT_CLASSIFIER );
             }
             else if ( FORKTESTSET.equals( name ) )
             {
@@ -194,13 +199,74 @@ public class BooterDeserializer
         ReporterConfiguration reporterConfiguration =
             new ReporterConfiguration( reports, reportsDirectory, valueOf( isTrimStackTrace ) );
 
-        ProviderConfiguration surefireStarterConfiguration =
-            ProviderConfiguration.inForkedVm( providerConfiguration, classpathConfiguration, classLoaderConfiguration );
-        return new BooterConfiguration( surefireStarterConfiguration, reports, dirScannerParams, failIfNotests,
+        StartupConfiguration surefireStarterConfiguration =
+            StartupConfiguration.inForkedVm( providerConfiguration, classpathConfiguration, classLoaderConfiguration );
+        return new ProviderConfiguration(reports, dirScannerParams, failIfNotests,
                                         reporterConfiguration, testNg, testSuiteDefinition, properties.getProperties(),
                                         testForFork );
     }
 
+    public StartupConfiguration getProviderConfiguration()
+        throws IOException
+    {
+        boolean enableAssertions = false;
+        boolean childDelegation = true;
+        boolean useSystemClassLoader = false; // todo check default value
+        boolean useManifestOnlyJar = false; // todo check default value
+
+        SortedMap classPathUrls = new TreeMap();
+
+        SortedMap surefireClassPathUrls = new TreeMap();
+
+        String providerConfiguration = null;
+
+        for ( Enumeration e = properties.propertyNames(); e.hasMoreElements(); )
+        {
+            String name = (String) e.nextElement();
+
+            if ( name.startsWith( CLASSPATH_URL ) )
+            {
+                classPathUrls.put( Integer.valueOf( name.substring( name.indexOf( '.' ) + 1 ) ),
+                                   properties.getProperty( name ) );
+            }
+            else if ( name.startsWith( SUREFIRE_CLASSPATHURL ) )
+            {
+                surefireClassPathUrls.put( Integer.valueOf( name.substring( name.indexOf( '.' ) + 1 ) ),
+                                           properties.getProperty( name ) );
+            }
+            else if ( CHILD_DELEGATION.equals( name ) )
+            {
+                childDelegation = properties.getBooleanProperty( CHILD_DELEGATION );
+            }
+            else if ( ENABLE_ASSERTIONS.equals( name ) )
+            {
+                enableAssertions = properties.getBooleanProperty( ENABLE_ASSERTIONS );
+            }
+            else if ( USESYSTEMCLASSLOADER.equals( name ) )
+            {
+                useSystemClassLoader = properties.getBooleanProperty( USESYSTEMCLASSLOADER );
+            }
+            else if ( USEMANIFESTONLYJAR.equals( name ) )
+            {
+                useManifestOnlyJar = properties.getBooleanProperty( USEMANIFESTONLYJAR );
+            }
+            else if ( PROVIDER_CONFIGURATION.equals( name ) )
+            {
+                providerConfiguration = properties.getProperty( PROVIDER_CONFIGURATION );
+            }
+        }
+
+
+        ClassLoaderConfiguration classLoaderConfiguration =
+            new ClassLoaderConfiguration( useSystemClassLoader, useManifestOnlyJar );
+
+        ClasspathConfiguration classpathConfiguration =
+            new ClasspathConfiguration( classPathUrls, surefireClassPathUrls, enableAssertions, childDelegation );
+
+        return StartupConfiguration.inForkedVm( providerConfiguration, classpathConfiguration,
+                                                classLoaderConfiguration );
+    }
+
     private Boolean valueOf( boolean aBoolean )
     {  // jdk1.3 compat
         return aBoolean ? Boolean.TRUE : Boolean.FALSE;

Modified: maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java?rev=1042818&r1=1042817&r2=1042818&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java (original)
+++ maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java Mon Dec  6 22:28:01 2010
@@ -60,10 +60,11 @@ public class ForkedBooter
 
             File surefirePropertiesFile = new File( args[0] );
             InputStream stream = surefirePropertiesFile.exists() ? new FileInputStream( surefirePropertiesFile ) : null;
-            BooterDeserializer booterDeserializer = new BooterDeserializer();
-            BooterConfiguration booterConfiguration = booterDeserializer.deserialize( stream );
+            BooterDeserializer booterDeserializer = new BooterDeserializer(stream);
+            ProviderConfiguration booterConfiguration = booterDeserializer.deserialize();
+            final StartupConfiguration providerConfiguration = booterDeserializer.getProviderConfiguration();
 
-            SurefireStarter booter = new SurefireStarter( booterConfiguration );
+            SurefireStarter booter = new SurefireStarter( providerConfiguration, booterConfiguration );
 
             Object forkedTestSet = booterConfiguration.getTestForFork();
             Properties p = booterConfiguration.getProviderProperties();

Modified: maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java?rev=1042818&r1=1042817&r2=1042818&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java (original)
+++ maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java Mon Dec  6 22:28:01 2010
@@ -19,67 +19,143 @@ package org.apache.maven.surefire.booter
  * under the License.
  */
 
+import org.apache.maven.surefire.report.ReporterConfiguration;
+import org.apache.maven.surefire.testset.DirectoryScannerParameters;
+import org.apache.maven.surefire.testset.TestArtifactInfo;
+import org.apache.maven.surefire.testset.TestRequest;
+
+import java.io.File;
+import java.util.List;
+import java.util.Properties;
+
 /**
- * Configuration that is used by the surefirestarter but does not make it into the provider itself.
+ * Represents the surefire configuration that passes all the way into the provider
+ * classloader and the provider.
+ * <p/>
  *
+ * @author Jason van Zyl
+ * @author Emmanuel Venisse
  * @author Kristian Rosenvold
+ * @version $Id$
  */
 public class ProviderConfiguration
 {
-    private final String providerClassName;
+    /**
+     * @noinspection UnusedDeclaration
+     */
+    public static final int TESTS_SUCCEEDED_EXIT_CODE = 0;
+
+    public static final int TESTS_FAILED_EXIT_CODE = 255;
+
+    public static final int NO_TESTS_EXIT_CODE = 254;
+
+    private final DirectoryScannerParameters dirScannerParams;
+
+    private final ReporterConfiguration reporterConfiguration;
+
+    private final List reports;
+
+    private final TestArtifactInfo testArtifact;
+
+    private final TestRequest testSuiteDefinition;
 
-    private final ClasspathConfiguration classpathConfiguration;
+    private Properties providerProperties;
 
-    private final ClassLoaderConfiguration classLoaderConfiguration;
+    private final boolean failIfNoTests;
 
-    private final boolean isForkRequested;
+    private final Object forkTestSet;
 
-    private final boolean isInForkedVm;
+    public ProviderConfiguration( List reports, DirectoryScannerParameters directoryScannerParameters,
+                                  boolean failIfNoTests, ReporterConfiguration reporterConfiguration,
+                                  TestArtifactInfo testArtifact, TestRequest testSuiteDefinition,
+                                  Properties providerProperties, Object forkTestSet )
+    {
+        this.providerProperties = providerProperties;
+        this.reporterConfiguration = reporterConfiguration;
+        this.testArtifact = testArtifact;
+        this.testSuiteDefinition = testSuiteDefinition;
+        this.dirScannerParams = directoryScannerParameters;
+        this.failIfNoTests = failIfNoTests;
+        this.reports = reports;
+        this.forkTestSet = forkTestSet;
+    }
 
-    private final boolean redirectTestOutputToFile;
+
+    public ReporterConfiguration getReporterConfiguration()
+    {
+        return reporterConfiguration;
+    }
 
 
-    public ProviderConfiguration( String providerClassName, ClasspathConfiguration classpathConfiguration,
-                                  ClassLoaderConfiguration classLoaderConfiguration, boolean forkRequested,
-                                  boolean inForkedVm, boolean redirectTestOutputToFile )
+    public List getReports()
     {
-        this.providerClassName = providerClassName;
-        this.classpathConfiguration = classpathConfiguration;
-        this.classLoaderConfiguration = classLoaderConfiguration;
-        isForkRequested = forkRequested;
-        isInForkedVm = inForkedVm;
-        this.redirectTestOutputToFile = redirectTestOutputToFile;
+        return reports;
     }
 
-    public static ProviderConfiguration inForkedVm(String providerClassName, ClasspathConfiguration classpathConfiguration,
-                                  ClassLoaderConfiguration classLoaderConfiguration){
-        return new ProviderConfiguration( providerClassName, classpathConfiguration, classLoaderConfiguration, false, true, false );
+    public Boolean isFailIfNoTests()
+    {
+        return ( failIfNoTests ) ? Boolean.TRUE : Boolean.FALSE;
     }
 
-    public ClasspathConfiguration getClasspathConfiguration()
+    public File getBaseDir()
     {
-        return classpathConfiguration;
+        return dirScannerParams.getTestClassesDirectory();
     }
 
-    public boolean useSystemClassLoader()
+
+    public DirectoryScannerParameters getDirScannerParams()
     {
-        // todo; I am not totally convinced this logic is as simple as it could be
-        return classLoaderConfiguration.isUseSystemClassLoader() && ( isInForkedVm || isForkRequested );
+        return dirScannerParams;
     }
 
-    public boolean isManifestOnlyJarRequestedAndUsable()
+    public Object[] getDirScannerParamsArray()
     {
-        return classLoaderConfiguration.isManifestOnlyJarRequestedAndUsable();
+        if ( dirScannerParams == null )
+        {
+            return null;
+        }
+        return new Object[]{ dirScannerParams.getTestClassesDirectory(), dirScannerParams.getIncludes(),
+            dirScannerParams.getExcludes() };
     }
 
-    public boolean isRedirectTestOutputToFile()
+    public List getIncludes()
     {
-        return redirectTestOutputToFile;
+        return dirScannerParams.getIncludes();
     }
 
-    public String getProviderClassName()
+    public List getExcludes()
     {
-        return providerClassName;
+        return dirScannerParams.getExcludes();
     }
 
+    public TestArtifactInfo getTestArtifact()
+    {
+        return testArtifact;
+    }
+
+    public TestRequest getTestSuiteDefinition()
+    {
+        return testSuiteDefinition;
+    }
+
+    public Properties getProviderProperties()
+    {
+        return providerProperties;
+    }
+
+    public Object getTestForFork()
+    {
+        return forkTestSet;
+    }
+
+    public String getTestForForkString()
+    {
+        if ( forkTestSet instanceof File )
+        {
+            return forkTestSet.toString();
+        }
+        return (String) forkTestSet;
+    }
+
+
 }

Modified: maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java?rev=1042818&r1=1042817&r2=1042818&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java (original)
+++ maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java Mon Dec  6 22:28:01 2010
@@ -34,16 +34,21 @@ import java.lang.reflect.Proxy;
  */
 public class ProviderFactory
 {
-    private final BooterConfiguration booterConfiguration;
+    private final StartupConfiguration startupConfiguration;
+
+    private final ProviderConfiguration providerConfiguration;
 
     private final ClassLoader surefireClassLoader;
 
     private final SurefireReflector surefireReflector;
 
-    public ProviderFactory( BooterConfiguration booterConfiguration, ClassLoader surefireClassLoader )
+
+    public ProviderFactory( StartupConfiguration startupConfiguration, ProviderConfiguration providerConfiguration,
+                            ClassLoader surefireClassLoader )
     {
-        this.booterConfiguration = booterConfiguration;
+        this.providerConfiguration = providerConfiguration;
         this.surefireClassLoader = surefireClassLoader;
+        this.startupConfiguration = startupConfiguration;
         this.surefireReflector = new SurefireReflector( surefireClassLoader );
     }
 
@@ -52,15 +57,15 @@ public class ProviderFactory
         ClassLoader context = java.lang.Thread.currentThread().getContextClassLoader();
         Thread.currentThread().setContextClassLoader( surefireClassLoader );
 
-        ProviderConfiguration starterConfiguration = booterConfiguration.getSurefireStarterConfiguration();
+        StartupConfiguration starterConfiguration = startupConfiguration;
         final Object o =
             surefireReflector.createBooterConfiguration();
-        surefireReflector.setTestSuiteDefinitionAware( o, booterConfiguration.getTestSuiteDefinition() );
-        surefireReflector.setProviderPropertiesAware( o, booterConfiguration.getProviderProperties() );
-        surefireReflector.setReporterConfigurationAware( o, booterConfiguration.getReporterConfiguration() );
+        surefireReflector.setTestSuiteDefinitionAware( o, providerConfiguration.getTestSuiteDefinition() );
+        surefireReflector.setProviderPropertiesAware( o, providerConfiguration.getProviderProperties() );
+        surefireReflector.setReporterConfigurationAware( o, providerConfiguration.getReporterConfiguration() );
         surefireReflector.setTestClassLoaderAware( o, surefireClassLoader, testClassLoader );
-        surefireReflector.setTestArtifactInfoAware( o, booterConfiguration.getTestNg() );
-        surefireReflector.setIfDirScannerAware( o, booterConfiguration.getDirScannerParams() );
+        surefireReflector.setTestArtifactInfoAware( o, providerConfiguration.getTestArtifact() );
+        surefireReflector.setIfDirScannerAware( o, providerConfiguration.getDirScannerParams() );
 
         Object provider = surefireReflector.instantiateProvider( starterConfiguration.getProviderClassName(), o );
         Thread.currentThread().setContextClassLoader( context );

Copied: maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/StartupConfiguration.java (from r1042451, maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java)
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/StartupConfiguration.java?p2=maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/StartupConfiguration.java&p1=maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java&r1=1042451&r2=1042818&rev=1042818&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderConfiguration.java (original)
+++ maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/StartupConfiguration.java Mon Dec  6 22:28:01 2010
@@ -20,11 +20,11 @@ package org.apache.maven.surefire.booter
  */
 
 /**
- * Configuration that is used by the surefirestarter but does not make it into the provider itself.
+ * Configuration that is used by the SurefireStarter but does not make it into the provider itself.
  *
  * @author Kristian Rosenvold
  */
-public class ProviderConfiguration
+public class StartupConfiguration
 {
     private final String providerClassName;
 
@@ -39,9 +39,9 @@ public class ProviderConfiguration
     private final boolean redirectTestOutputToFile;
 
 
-    public ProviderConfiguration( String providerClassName, ClasspathConfiguration classpathConfiguration,
-                                  ClassLoaderConfiguration classLoaderConfiguration, boolean forkRequested,
-                                  boolean inForkedVm, boolean redirectTestOutputToFile )
+    public StartupConfiguration( String providerClassName, ClasspathConfiguration classpathConfiguration,
+                                 ClassLoaderConfiguration classLoaderConfiguration, boolean forkRequested,
+                                 boolean inForkedVm, boolean redirectTestOutputToFile )
     {
         this.providerClassName = providerClassName;
         this.classpathConfiguration = classpathConfiguration;
@@ -51,9 +51,9 @@ public class ProviderConfiguration
         this.redirectTestOutputToFile = redirectTestOutputToFile;
     }
 
-    public static ProviderConfiguration inForkedVm(String providerClassName, ClasspathConfiguration classpathConfiguration,
+    public static StartupConfiguration inForkedVm(String providerClassName, ClasspathConfiguration classpathConfiguration,
                                   ClassLoaderConfiguration classLoaderConfiguration){
-        return new ProviderConfiguration( providerClassName, classpathConfiguration, classLoaderConfiguration, false, true, false );
+        return new StartupConfiguration( providerClassName, classpathConfiguration, classLoaderConfiguration, false, true, false );
     }
 
     public ClasspathConfiguration getClasspathConfiguration()

Modified: maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireStarter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireStarter.java?rev=1042818&r1=1042817&r2=1042818&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireStarter.java (original)
+++ maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SurefireStarter.java Mon Dec  6 22:28:01 2010
@@ -41,17 +41,20 @@ public class SurefireStarter
 {
     private static final int NO_TESTS = 254;
 
-    private final BooterConfiguration booterConfiguration;
+    private final ProviderConfiguration booterConfiguration;
 
-    public SurefireStarter( BooterConfiguration booterConfiguration )
+    private final StartupConfiguration providerConfiguration;
+
+    public SurefireStarter( StartupConfiguration providerConfiguration, ProviderConfiguration booterConfiguration )
     {
         this.booterConfiguration = booterConfiguration;
+        this.providerConfiguration = providerConfiguration;
     }
 
     public RunResult runSuitesInProcess( Object testSet )
         throws SurefireExecutionException
     {
-        final ProviderConfiguration starterConfiguration = booterConfiguration.getSurefireStarterConfiguration();
+        final StartupConfiguration starterConfiguration = providerConfiguration;
         final ClasspathConfiguration classpathConfiguration = starterConfiguration.getClasspathConfiguration();
 
         ClassLoader testsClassLoader = classpathConfiguration.createTestClassLoaderConditionallySystem(
@@ -70,7 +73,7 @@ public class SurefireStarter
         ClassLoader testsClassLoader = createInProcessTestClassLoader();
 
         final ClasspathConfiguration classpathConfiguration =
-            booterConfiguration.getSurefireStarterConfiguration().getClasspathConfiguration();
+            providerConfiguration.getClasspathConfiguration();
 
         ClassLoader surefireClassLoader = classpathConfiguration.createSurefireClassLoader( testsClassLoader );
 
@@ -82,13 +85,12 @@ public class SurefireStarter
     {
         ClassLoader testsClassLoader;
 
-        final ProviderConfiguration starterConfiguration = booterConfiguration.getSurefireStarterConfiguration();
-        final ClasspathConfiguration classpathConfiguration = starterConfiguration.getClasspathConfiguration();
+        final ClasspathConfiguration classpathConfiguration = providerConfiguration.getClasspathConfiguration();
 
         String testClassPath = classpathConfiguration.getTestClasspath().getClassPathAsString();
 
         System.setProperty( "surefire.test.class.path", testClassPath );
-        if ( starterConfiguration.isManifestOnlyJarRequestedAndUsable() )
+        if ( providerConfiguration.isManifestOnlyJarRequestedAndUsable() )
         {
             testsClassLoader = getClass().getClassLoader(); // ClassLoader.getSystemClassLoader()
             // SUREFIRE-459, trick the app under test into thinking its classpath was conventional
@@ -122,7 +124,8 @@ public class SurefireStarter
 
     private RunResult invokeProvider( Object testSet, ClassLoader testsClassLoader, ClassLoader surefireClassLoader )
     {
-        ProviderFactory providerFactory = new ProviderFactory( booterConfiguration, surefireClassLoader );
+        ProviderFactory providerFactory = new ProviderFactory( providerConfiguration, booterConfiguration,
+                                                               surefireClassLoader );
         final SurefireProvider provider = providerFactory.createProvider( testsClassLoader );
 
         try

Modified: maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemPropertyManager.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemPropertyManager.java?rev=1042818&r1=1042817&r2=1042818&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemPropertyManager.java (original)
+++ maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/SystemPropertyManager.java Mon Dec  6 22:28:01 2010
@@ -70,7 +70,8 @@ public class SystemPropertyManager
         p.setAsSystemProperties();
     }
 
-    public File writePropertiesFile( Properties properties, File tempDirectory, String name, boolean deleteOnExit )
+    public static File writePropertiesFile( Properties properties, File tempDirectory, String name,
+                                            boolean deleteOnExit )
         throws IOException
     {
         File file = File.createTempFile( name, "tmp", tempDirectory );
@@ -84,7 +85,7 @@ public class SystemPropertyManager
         return file;
     }
 
-    static void writePropertiesFile( File file, String name, Properties properties )
+    public static void writePropertiesFile( File file, String name, Properties properties )
         throws IOException
     {
         FileOutputStream out = new FileOutputStream( file );
@@ -99,12 +100,6 @@ public class SystemPropertyManager
         }
     }
 
-
-    /**
-     * Closes the input stream. The input stream can be null and any IOException's will be swallowed.
-     *
-     * @param inputStream The stream to close.
-     */
     public static void close( InputStream inputStream )
     {
         if ( inputStream == null )



Mime
View raw message