You are viewing a plain text version of this content. The canonical link for it is here.
Posted to surefire-commits@maven.apache.org by kr...@apache.org on 2010/12/08 23:11:33 UTC
svn commit: r1043721 - in /maven/surefire/trunk:
maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/
maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/
maven-surefire-common/src/main/java/org/apache/maven/plugin/sur...
Author: krosenvold
Date: Wed Dec 8 22:11:32 2010
New Revision: 1043721
URL: http://svn.apache.org/viewvc?rev=1043721&view=rev
Log:
o Removed a field from serialization, cleaned up a few more
Modified:
maven/surefire/trunk/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
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/booterclient/BooterSerializer.java
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.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-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java
maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/suite/AbstractDirectoryTestSuite.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/ProviderConfiguration.java
maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/StartupConfiguration.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=1043721&r1=1043720&r2=1043721&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 Wed Dec 8 22:11:32 2010
@@ -32,6 +32,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.ClassLoaderConfiguration;
import org.apache.maven.surefire.booter.ProviderConfiguration;
import org.apache.maven.surefire.booter.SurefireBooterForkException;
import org.apache.maven.surefire.booter.SurefireExecutionException;
@@ -615,7 +616,8 @@ public class IntegrationTestMojo
{
ProviderInfo provider = (ProviderInfo) iter.next();
forkConfiguration = getForkConfiguration();
- ForkStarter forkStarter = createForkStarter( provider, forkConfiguration );
+ ClassLoaderConfiguration classLoaderConfiguration = getClassLoaderConfiguration( forkConfiguration );
+ ForkStarter forkStarter = createForkStarter( provider, forkConfiguration, classLoaderConfiguration );
try
{
result.setResult( forkStarter.run() );
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=1043721&r1=1043720&r2=1043721&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 Wed Dec 8 22:11:32 2010
@@ -36,6 +36,7 @@ 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.shared.artifact.filter.PatternIncludesArtifactFilter;
+import org.apache.maven.surefire.booter.ClassLoaderConfiguration;
import org.apache.maven.surefire.booter.Classpath;
import org.apache.maven.surefire.booter.ClasspathConfiguration;
import org.apache.maven.surefire.booter.ProviderConfiguration;
@@ -106,11 +107,11 @@ public abstract class AbstractSurefireMo
try
{
- wellKnownProviders = new ProviderList(new ProviderInfo[]{ new TestNgProviderInfo( getTestNgArtifact() ),
+ wellKnownProviders = new ProviderList( new ProviderInfo[]{ new TestNgProviderInfo( getTestNgArtifact() ),
new JUnitCoreProviderInfo( getJunitArtifact() ), new JUnit4ProviderInfo( getJunitArtifact() ),
new JUnit3ProviderInfo() }, new DynamicProviderInfo( null ) );
- return wellKnownProviders.resolve(getLog());
+ return wellKnownProviders.resolve( getLog() );
}
catch ( InvalidVersionSpecificationException e )
{
@@ -300,8 +301,8 @@ public abstract class AbstractSurefireMo
}
ProviderConfiguration providerConfiguration1 =
- new ProviderConfiguration( reports, directoryScannerParameters, failIfNoTests, reporterConfiguration,
- testNg, testSuiteDefinition, providerProperties, null );
+ new ProviderConfiguration( directoryScannerParameters, failIfNoTests, reporterConfiguration, testNg,
+ testSuiteDefinition, providerProperties, null );
Toolchain tc = getToolchain();
@@ -326,7 +327,8 @@ public abstract class AbstractSurefireMo
}
protected StartupConfiguration createStartupConfiguration( ForkConfiguration forkConfiguration,
- ProviderInfo provider )
+ ProviderInfo provider,
+ ClassLoaderConfiguration classLoaderConfiguration )
throws MojoExecutionException, MojoFailureException
{
final ClasspathConfiguration classpathConfiguration =
@@ -380,9 +382,8 @@ public abstract class AbstractSurefireMo
classpathConfiguration.addClasspathUrl( classpathElement );
}
- return new StartupConfiguration( providerName, classpathConfiguration,
- forkConfiguration.getClassLoaderConfiguration(), forkConfiguration.isForking(),
- false, isRedirectTestOutputToFile() );
+ return new StartupConfiguration( providerName, classpathConfiguration, classLoaderConfiguration,
+ forkConfiguration.isForking(), false, isRedirectTestOutputToFile() );
}
@@ -494,12 +495,13 @@ public abstract class AbstractSurefireMo
return junitArtifact;
}
- protected ForkStarter createForkStarter( ProviderInfo provider, ForkConfiguration forkConfiguration )
+ protected ForkStarter createForkStarter( ProviderInfo provider, ForkConfiguration forkConfiguration,
+ ClassLoaderConfiguration classLoaderConfiguration )
throws MojoExecutionException, MojoFailureException
{
- StartupConfiguration startupConfiguration = createStartupConfiguration( forkConfiguration, provider );
- ProviderConfiguration providerConfiguration =
- createProviderConfiguration( forkConfiguration );
+ StartupConfiguration startupConfiguration =
+ createStartupConfiguration( forkConfiguration, provider, classLoaderConfiguration );
+ ProviderConfiguration providerConfiguration = createProviderConfiguration( forkConfiguration );
return new ForkStarter( providerConfiguration, startupConfiguration, getReportsDirectory(), forkConfiguration,
getForkedProcessTimeoutInSeconds() );
}
@@ -527,8 +529,6 @@ public abstract class AbstractSurefireMo
if ( fork.isForking() )
{
setUseSystemClassLoader( getUseSystemClassLoader() == null ? Boolean.TRUE : getUseSystemClassLoader() );
- fork.setUseSystemClassLoader( getUseSystemClassLoader().booleanValue() );
- fork.setUseManifestOnlyJar( isUseManifestOnlyJar() );
fork.setSystemProperties( getInternalSystemProperties() );
@@ -581,6 +581,13 @@ public abstract class AbstractSurefireMo
return fork;
}
+ protected ClassLoaderConfiguration getClassLoaderConfiguration( ForkConfiguration fork )
+ {
+ return fork.isForking() ? new ClassLoaderConfiguration( getUseSystemClassLoader().booleanValue(),
+ isUseManifestOnlyJar() )
+ : new ClassLoaderConfiguration( false, false );
+ }
+
protected abstract String[] getDefaultIncludes();
/**
@@ -1040,6 +1047,7 @@ public abstract class AbstractSurefireMo
}
}
+
public class DynamicProviderInfo
implements ConfigurableProviderInfo
{
@@ -1050,8 +1058,9 @@ public abstract class AbstractSurefireMo
this.providerName = providerName;
}
- public ProviderInfo instantiate(String providerName){
- return new DynamicProviderInfo(providerName);
+ public ProviderInfo instantiate( String providerName )
+ {
+ return new DynamicProviderInfo( providerName );
}
public String getProviderName()
@@ -1079,7 +1088,7 @@ public abstract class AbstractSurefireMo
throws ArtifactResolutionException, ArtifactNotFoundException
{
final Map pluginArtifactMap = getPluginArtifactMap();
- Artifact plugin = (Artifact) pluginArtifactMap.get( "org.apache.maven.plugins:maven-surefire-plugin");
+ Artifact plugin = (Artifact) pluginArtifactMap.get( "org.apache.maven.plugins:maven-surefire-plugin" );
dependencyResolver.addProviderToClasspath( classpathConfiguration, pluginArtifactMap, plugin );
}
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=1043721&r1=1043720&r2=1043721&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 Wed Dec 8 22:11:32 2010
@@ -18,21 +18,19 @@ package org.apache.maven.plugin.surefire
* under the License.
*/
-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;
import org.apache.maven.surefire.testset.TestArtifactInfo;
import org.apache.maven.surefire.testset.TestRequest;
-import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.StringUtils;
import java.io.ByteArrayOutputStream;
import java.io.File;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -62,32 +60,30 @@ public class BooterSerializer
}
- public File serialize( Properties properties, ProviderConfiguration booterConfiguration, StartupConfiguration providerConfiguration,
- Object testSet )
+ public File serialize( Properties properties, ProviderConfiguration booterConfiguration,
+ StartupConfiguration providerConfiguration, Object testSet )
throws IOException
{
setForkProperties( properties, booterConfiguration, providerConfiguration, testSet );
- SystemPropertyManager systemPropertyManager = new SystemPropertyManager();
- return systemPropertyManager.writePropertiesFile( properties, forkConfiguration.getTempDirectory(), "surefire",
+ return SystemPropertyManager.writePropertiesFile( properties, forkConfiguration.getTempDirectory(), "surefire",
forkConfiguration.isDebug() );
}
- private void setForkProperties(Properties properties, ProviderConfiguration booterConfiguration, StartupConfiguration providerConfiguration, Object testSet)
+ private void setForkProperties( Properties properties, ProviderConfiguration booterConfiguration,
+ StartupConfiguration providerConfiguration, Object testSet )
{
if ( properties == null )
{
throw new IllegalStateException( "Properties cannot be null" );
}
- addList( booterConfiguration.getReports(), properties, BooterConstants.REPORT_PROPERTY_PREFIX );
List params = new ArrayList();
- params.add( new Object[]{ BooterConstants.DIRSCANNER_OPTIONS, booterConfiguration.getDirScannerParamsArray() } );
+ params.add(
+ new Object[]{ BooterConstants.DIRSCANNER_OPTIONS, booterConfiguration.getDirScannerParamsArray() } );
addPropertiesForTypeHolder( params, properties, BooterConstants.DIRSCANNER_PROPERTY_PREFIX );
providerConfiguration.getClasspathConfiguration().setForkProperties( properties );
- ReporterConfiguration reporterConfiguration = booterConfiguration.getReporterConfiguration();
-
TestArtifactInfo testNg = booterConfiguration.getTestArtifact();
if ( testNg != null )
{
@@ -136,38 +132,29 @@ public class BooterSerializer
directoryScannerParameters.getTestClassesDirectory().toString() );
}
+ ReporterConfiguration reporterConfiguration = booterConfiguration.getReporterConfiguration();
+ addList( reporterConfiguration.getReports(), properties, BooterConstants.REPORT_PROPERTY_PREFIX );
+
Boolean rep = reporterConfiguration.isTrimStackTrace();
properties.setProperty( BooterConstants.ISTRIMSTACKTRACE, rep.toString() );
properties.setProperty( BooterConstants.REPORTSDIRECTORY,
reporterConfiguration.getReportsDirectory().toString() );
- ClassLoaderConfiguration classLoaderConfiguration = this.forkConfiguration.getClassLoaderConfiguration();
+ ClassLoaderConfiguration classLoaderConfiguration = providerConfiguration.getClassLoaderConfiguration();
properties.setProperty( BooterConstants.USESYSTEMCLASSLOADER,
String.valueOf( classLoaderConfiguration.isUseSystemClassLoader() ) );
+ // Note that using isManifestOnlyJarRequestedAndUsable has a really nasty code smell to it.
+ // Should probably be using the staright "isManifestOnlyJar" attribute.
+ // But this actually still does the correct thing as is.
properties.setProperty( BooterConstants.USEMANIFESTONLYJAR,
String.valueOf( classLoaderConfiguration.isManifestOnlyJarRequestedAndUsable() ) );
properties.setProperty( BooterConstants.FAILIFNOTESTS,
String.valueOf( booterConfiguration.isFailIfNoTests() ) );
- properties.setProperty( BooterConstants.PROVIDER_CONFIGURATION,
- providerConfiguration.getProviderClassName() );
+ properties.setProperty( BooterConstants.PROVIDER_CONFIGURATION, providerConfiguration.getProviderClassName() );
}
- void writePropertiesFile( File file, String name, Properties properties )
- throws IOException
+ private String getTypeEncoded( Object value )
{
- FileOutputStream out = new FileOutputStream( file );
-
- try
- {
- properties.store( out, name );
- }
- finally
- {
- IOUtil.close( out );
- }
- }
-
- private String getTypeEncoded(Object value){
return value.getClass().getName() + "|" + value.toString();
}
Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java?rev=1043721&r1=1043720&r2=1043721&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java Wed Dec 8 22:11:32 2010
@@ -58,10 +58,6 @@ public class ForkConfiguration
private String forkMode;
- private boolean useSystemClassLoader;
-
- private boolean useManifestOnlyJar;
-
private Properties systemProperties;
private String jvmExecutable;
@@ -88,11 +84,6 @@ public class ForkConfiguration
return bootClasspathConfiguration;
}
- public ClassLoaderConfiguration getClassLoaderConfiguration()
- {
- return new ClassLoaderConfiguration( isUseSystemClassLoader(), isUseManifestOnlyJar() );
- }
-
public void setForkMode( String forkMode )
{
if ( "pertest".equalsIgnoreCase( forkMode ) )
@@ -118,16 +109,6 @@ public class ForkConfiguration
return !FORK_NEVER.equals( forkMode );
}
- public void setUseSystemClassLoader( boolean useSystemClassLoader )
- {
- this.useSystemClassLoader = useSystemClassLoader;
- }
-
- public boolean isUseSystemClassLoader()
- {
- return useSystemClassLoader;
- }
-
public void setSystemProperties( Properties systemProperties )
{
this.systemProperties = (Properties) systemProperties.clone();
@@ -174,15 +155,16 @@ public class ForkConfiguration
}
/**
- * @param classPath cla the classpath arguments
+ * @param classPath cla the classpath arguments
+ * @param classpathConfiguration the classpath configuration
* @return A commandline
* @throws org.apache.maven.surefire.booter.SurefireBooterForkException
* when unable to perform the fork
*/
- public Commandline createCommandLine( List classPath )
+ public Commandline createCommandLine( List classPath, ClassLoaderConfiguration classpathConfiguration )
throws SurefireBooterForkException
{
- return createCommandLine( classPath, isManifestOnlyJarRequestedAndUsable() );
+ return createCommandLine( classPath, classpathConfiguration.isManifestOnlyJarRequestedAndUsable() );
}
public Commandline createCommandLine( List classPath, boolean useJar )
@@ -300,21 +282,6 @@ public class ForkConfiguration
return debug;
}
- public void setUseManifestOnlyJar( boolean useManifestOnlyJar )
- {
- this.useManifestOnlyJar = useManifestOnlyJar;
- }
-
- public boolean isUseManifestOnlyJar()
- {
- return useManifestOnlyJar;
- }
-
- public boolean isManifestOnlyJarRequestedAndUsable()
- {
- return isUseSystemClassLoader() && isUseManifestOnlyJar();
- }
-
public String stripNewLines( String argline )
{
return argline.replace( "\n", " " ).replace( "\r", " " );
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=1043721&r1=1043720&r2=1043721&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 Wed Dec 8 22:11:32 2010
@@ -172,8 +172,7 @@ public class ForkStarter
if ( forkConfiguration.getSystemProperties() != null )
{
- SystemPropertyManager systemPropertyManager = new SystemPropertyManager();
- systemProperties = systemPropertyManager.writePropertiesFile( forkConfiguration.getSystemProperties(),
+ systemProperties = SystemPropertyManager.writePropertiesFile( forkConfiguration.getSystemProperties(),
forkConfiguration.getTempDirectory(),
"surefire", forkConfiguration.isDebug() );
}
@@ -190,7 +189,8 @@ public class ForkStarter
Classpath bootClasspath = bootClasspathConfiguration.append( additionlClassPathUrls );
- Commandline cli = forkConfiguration.createCommandLine( bootClasspath.getClassPath() );
+ Commandline cli = forkConfiguration.createCommandLine( bootClasspath.getClassPath(),
+ startupConfiguration.getClassLoaderConfiguration() );
cli.createArg().setFile( surefireProperties );
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=1043721&r1=1043720&r2=1043721&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 Wed Dec 8 22:11:32 2010
@@ -92,29 +92,33 @@ public class BooterDeserializerTest
DirectoryScannerParameters directoryScannerParameters = getDirectoryScannerParameters();
ClassLoaderConfiguration forkConfiguration = getForkConfiguration();
List reports = new ArrayList();
- reports.add( "abc" );
- reports.add( "cde" );
- reports.add( "efg" );
+ final String first = "abc";
+ final String second = "cde";
+ final String third = "efg";
+ reports.add( first );
+ reports.add( second );
+ reports.add( third );
ProviderConfiguration booterConfiguration =
getTestBooterConfiguration( forkConfiguration, directoryScannerParameters, reports );
- booterConfiguration.getReports().add( "abc" );
- booterConfiguration.getReports().add( "cde" );
- booterConfiguration.getReports().add( "efg" );
+ final ReporterConfiguration reporterConfiguration = booterConfiguration.getReporterConfiguration();
+ reporterConfiguration.getReports().add( first );
+ reporterConfiguration.getReports().add( second );
+ reporterConfiguration.getReports().add( third );
final StartupConfiguration testProviderConfiguration = getTestProviderConfiguration( forkConfiguration );
ProviderConfiguration reloaded = saveAndReload( booterConfiguration, testProviderConfiguration );
- Assert.assertEquals( "abc", reloaded.getReports().get( 0 ) );
- Assert.assertEquals( "cde", reloaded.getReports().get( 1 ) );
- Assert.assertEquals( "efg", reloaded.getReports().get( 2 ) );
+ Assert.assertEquals( first, reloaded.getReporterConfiguration().getReports().get( 0 ) );
+ Assert.assertEquals( second, reloaded.getReporterConfiguration().getReports().get( 1 ) );
+ Assert.assertEquals( third, reloaded.getReporterConfiguration().getReports().get( 2 ) );
}
- public void testTestNgArtifact()
+ public void testTestArtifact()
throws IOException
{
- ProviderConfiguration reloaded = getReloladedConfig();
+ ProviderConfiguration reloaded = getReloadedProviderConfiguration();
Assert.assertEquals( "5.0", reloaded.getTestArtifact().getVersion() );
Assert.assertEquals( "ABC", reloaded.getTestArtifact().getClassifier() );
@@ -123,7 +127,7 @@ public class BooterDeserializerTest
public void testTestSuiteDefinition()
throws IOException
{
- ProviderConfiguration reloaded = getReloladedConfig();
+ ProviderConfiguration reloaded = getReloadedProviderConfiguration();
TestRequest testSuiteDefinition = reloaded.getTestSuiteDefinition();
File[] suiteXmlFiles = testSuiteDefinition.getSuiteXmlFiles();
@@ -140,19 +144,19 @@ public class BooterDeserializerTest
public void testProvider()
throws IOException
{
- assertEquals( "com.provider", getReloadedProviderConfiguration().getProviderClassName() );
+ assertEquals( "com.provider", getReloadedStartupConfiguration().getProviderClassName() );
}
public void testFailIfNoTests()
throws IOException
{
- ProviderConfiguration reloaded = getReloladedConfig();
+ ProviderConfiguration reloaded = getReloadedProviderConfiguration();
assertTrue( reloaded.isFailIfNoTests().booleanValue() );
}
- private ProviderConfiguration getReloladedConfig()
+ private ProviderConfiguration getReloadedProviderConfiguration()
throws IOException
{
DirectoryScannerParameters directoryScannerParameters = getDirectoryScannerParameters();
@@ -163,10 +167,9 @@ public class BooterDeserializerTest
return saveAndReload( booterConfiguration, testProviderConfiguration );
}
- private StartupConfiguration getReloadedProviderConfiguration()
+ private StartupConfiguration getReloadedStartupConfiguration()
throws IOException
{
- DirectoryScannerParameters directoryScannerParameters = getDirectoryScannerParameters();
ClassLoaderConfiguration forkConfiguration = getForkConfiguration();
return getTestProviderConfiguration( forkConfiguration );
}
@@ -211,7 +214,7 @@ public class BooterDeserializerTest
new TestRequest( getSuiteXmlFileStrings(), getTEstSourceDirectory(), aUserRequestedTest );
StartupConfiguration surefireStarterConfiguration = getTestProviderConfiguration( classLoaderConfiguration );
- return new ProviderConfiguration( reports, directoryScannerParameters, true, reporterConfiguration,
+ return new ProviderConfiguration( directoryScannerParameters, true, reporterConfiguration,
new TestArtifactInfo( "5.0", "ABC" ), testSuiteDefinition, new Properties(),
aTest );
}
Modified: maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java?rev=1043721&r1=1043720&r2=1043721&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java (original)
+++ maven/surefire/trunk/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkConfigurationTest.java Wed Dec 8 22:11:32 2010
@@ -39,12 +39,9 @@ public class ForkConfigurationTest
ForkConfiguration config = getForkConfiguration();
File cpElement = getTempClasspathFile();
config.setForkMode( ForkConfiguration.FORK_ONCE );
- config.setUseSystemClassLoader( true );
- config.setUseSystemClassLoader( true );
config.setJvmExecutable( "java" );
- Commandline cli = config.createCommandLine( Collections.singletonList( cpElement.getAbsolutePath() ),
- config.isUseSystemClassLoader() );
+ Commandline cli = config.createCommandLine( Collections.singletonList( cpElement.getAbsolutePath() ), true );
String line = StringUtils.join( cli.getCommandline(), " " );
assertTrue( line.indexOf( "-jar" ) > -1 );
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=1043721&r1=1043720&r2=1043721&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 Wed Dec 8 22:11:32 2010
@@ -29,6 +29,7 @@ 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.ClassLoaderConfiguration;
import org.apache.maven.surefire.booter.SurefireBooterForkException;
import org.apache.maven.surefire.booter.SurefireExecutionException;
import org.apache.maven.toolchain.ToolchainManager;
@@ -577,7 +578,8 @@ public class SurefirePlugin
{
ProviderInfo provider = (ProviderInfo) iter.next();
forkConfiguration = getForkConfiguration();
- ForkStarter forkStarter = createForkStarter( provider, forkConfiguration );
+ ClassLoaderConfiguration classLoaderConfiguration = getClassLoaderConfiguration( forkConfiguration );
+ ForkStarter forkStarter = createForkStarter( provider, forkConfiguration, classLoaderConfiguration );
try
{
Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/suite/AbstractDirectoryTestSuite.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/suite/AbstractDirectoryTestSuite.java?rev=1043721&r1=1043720&r2=1043721&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/suite/AbstractDirectoryTestSuite.java (original)
+++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/suite/AbstractDirectoryTestSuite.java Wed Dec 8 22:11:32 2010
@@ -21,13 +21,13 @@ package org.apache.maven.surefire.suite;
import org.apache.maven.surefire.NonAbstractClassFilter;
import org.apache.maven.surefire.Surefire;
-import org.apache.maven.surefire.report.ReporterManagerFactory;
-import org.apache.maven.surefire.util.DefaultDirectoryScanner;
import org.apache.maven.surefire.report.ReportEntry;
import org.apache.maven.surefire.report.ReporterException;
import org.apache.maven.surefire.report.ReporterManager;
+import org.apache.maven.surefire.report.ReporterManagerFactory;
import org.apache.maven.surefire.testset.SurefireTestSet;
import org.apache.maven.surefire.testset.TestSetFailedException;
+import org.apache.maven.surefire.util.DefaultDirectoryScanner;
import org.apache.maven.surefire.util.DirectoryScanner;
import java.io.File;
@@ -73,7 +73,8 @@ public abstract class AbstractDirectoryT
}
testSets = new TreeMap();
- Class[] locatedClasses = surefireDirectoryScanner.locateTestClasses( classLoader, new NonAbstractClassFilter() );
+ Class[] locatedClasses =
+ surefireDirectoryScanner.locateTestClasses( classLoader, new NonAbstractClassFilter() );
for ( int i = 0; i < locatedClasses.length; i++ )
{
@@ -114,6 +115,7 @@ public abstract class AbstractDirectoryT
executeTestSet( testSet, reporterManagerFactory, classLoader );
}
+
}
private void executeTestSet( SurefireTestSet testSet, ReporterManagerFactory reporterManagerFactory,
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=1043721&r1=1043720&r2=1043721&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 Wed Dec 8 22:11:32 2010
@@ -55,7 +55,9 @@ public class BooterDeserializer
final PropertiesWrapper properties;
- public BooterDeserializer(InputStream inputStream ) throws IOException {
+ public BooterDeserializer( InputStream inputStream )
+ throws IOException
+ {
properties = SystemPropertyManager.loadProperties( inputStream );
}
@@ -155,9 +157,8 @@ public class BooterDeserializer
ReporterConfiguration reporterConfiguration =
new ReporterConfiguration( reports, reportsDirectory, valueOf( isTrimStackTrace ) );
- return new ProviderConfiguration(reports, dirScannerParams, failIfNotests,
- reporterConfiguration, testNg, testSuiteDefinition, properties.getProperties(),
- testForFork );
+ return new ProviderConfiguration( dirScannerParams, failIfNotests, reporterConfiguration, testNg,
+ testSuiteDefinition, properties.getProperties(), testForFork );
}
public StartupConfiguration getProviderConfiguration()
@@ -210,7 +211,6 @@ public class BooterDeserializer
}
}
-
ClassLoaderConfiguration classLoaderConfiguration =
new ClassLoaderConfiguration( useSystemClassLoader, useManifestOnlyJar );
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=1043721&r1=1043720&r2=1043721&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 Wed Dec 8 22:11:32 2010
@@ -53,8 +53,6 @@ public class ProviderConfiguration
private final ReporterConfiguration reporterConfiguration;
- private final List reports;
-
private final TestArtifactInfo testArtifact;
private final TestRequest testSuiteDefinition;
@@ -65,10 +63,9 @@ public class ProviderConfiguration
private final Object forkTestSet;
- public ProviderConfiguration( List reports, DirectoryScannerParameters directoryScannerParameters,
- boolean failIfNoTests, ReporterConfiguration reporterConfiguration,
- TestArtifactInfo testArtifact, TestRequest testSuiteDefinition,
- Properties providerProperties, Object forkTestSet )
+ public ProviderConfiguration( DirectoryScannerParameters directoryScannerParameters, boolean failIfNoTests,
+ ReporterConfiguration reporterConfiguration, TestArtifactInfo testArtifact,
+ TestRequest testSuiteDefinition, Properties providerProperties, Object forkTestSet )
{
this.providerProperties = providerProperties;
this.reporterConfiguration = reporterConfiguration;
@@ -76,7 +73,6 @@ public class ProviderConfiguration
this.testSuiteDefinition = testSuiteDefinition;
this.dirScannerParams = directoryScannerParameters;
this.failIfNoTests = failIfNoTests;
- this.reports = reports;
this.forkTestSet = forkTestSet;
}
@@ -87,11 +83,6 @@ public class ProviderConfiguration
}
- public List getReports()
- {
- return reports;
- }
-
public Boolean isFailIfNoTests()
{
return ( failIfNoTests ) ? Boolean.TRUE : Boolean.FALSE;
Modified: maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/StartupConfiguration.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/StartupConfiguration.java?rev=1043721&r1=1043720&r2=1043721&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/StartupConfiguration.java (original)
+++ maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/StartupConfiguration.java Wed Dec 8 22:11:32 2010
@@ -51,9 +51,12 @@ public class StartupConfiguration
this.redirectTestOutputToFile = redirectTestOutputToFile;
}
- public static StartupConfiguration inForkedVm(String providerClassName, ClasspathConfiguration classpathConfiguration,
- ClassLoaderConfiguration classLoaderConfiguration){
- return new StartupConfiguration( providerClassName, classpathConfiguration, classLoaderConfiguration, false, true, false );
+ public static StartupConfiguration inForkedVm( String providerClassName,
+ ClasspathConfiguration classpathConfiguration,
+ ClassLoaderConfiguration classLoaderConfiguration )
+ {
+ return new StartupConfiguration( providerClassName, classpathConfiguration, classLoaderConfiguration, false,
+ true, false );
}
public ClasspathConfiguration getClasspathConfiguration()
@@ -82,4 +85,8 @@ public class StartupConfiguration
return providerClassName;
}
+ public ClassLoaderConfiguration getClassLoaderConfiguration()
+ {
+ return classLoaderConfiguration;
+ }
}