Author: krosenvold Date: Mon Dec 13 18:56:57 2010 New Revision: 1045300 URL: http://svn.apache.org/viewvc?rev=1045300&view=rev Log: [SUREFIRE-662] Fixed for junit4
A couple of minor other adjustments too Added: maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnit3TestChecker.java (with props) Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/BooterSerializer.java maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultDirectoryScanner.java maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/util/TestsToRun.java maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/PropertiesWrapper.java maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4DirectoryTestSuite.java maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSet.java maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSetReporter.java maven/surefire/trunk/surefire-providers/surefire-junit47/pom.xml maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreParameters.java maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java 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=1045300&r1=1045299&r2=1045300&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 13 18:56:57 2010 @@ -108,8 +108,7 @@ public class BooterSerializer Boolean rep = reporterConfiguration.isTrimStackTrace(); properties.setProperty( BooterConstants.ISTRIMSTACKTRACE, rep ); - properties.setProperty( BooterConstants.REPORTSDIRECTORY, - reporterConfiguration.getReportsDirectory()); + properties.setProperty( BooterConstants.REPORTSDIRECTORY, reporterConfiguration.getReportsDirectory() ); ClassLoaderConfiguration classLoaderConfiguration = providerConfiguration.getClassLoaderConfiguration(); properties.setProperty( BooterConstants.USESYSTEMCLASSLOADER, String.valueOf( classLoaderConfiguration.isUseSystemClassLoader() ) ); @@ -131,7 +130,16 @@ public class BooterSerializer { return null; } - return value.getClass().getName() + "|" + value.toString(); + String valueToUse; + if ( value instanceof Class ) + { + valueToUse = ( (Class) value ).getName(); + } + else + { + valueToUse = value.toString(); + } + return value.getClass().getName() + "|" + valueToUse; } private void addPropertiesForTypeHolder( List typeHolderList, Properties properties, String propertyPrefix ) Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultDirectoryScanner.java URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultDirectoryScanner.java?rev=1045300&r1=1045299&r2=1045300&view=diff ============================================================================== --- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultDirectoryScanner.java (original) +++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/util/DefaultDirectoryScanner.java Mon Dec 13 18:56:57 2010 @@ -47,6 +47,8 @@ public class DefaultDirectoryScanner private final List excludes; + private final List classesSkippedByValidation = new ArrayList(); + public DefaultDirectoryScanner( File basedir, List includes, List excludes ) { @@ -70,6 +72,10 @@ public class DefaultDirectoryScanner { result.add( testClass ); } + else + { + classesSkippedByValidation.add( testClass ); + } } return new TestsToRun( result ); } @@ -150,4 +156,9 @@ public class DefaultDirectoryScanner { return excludes; } + + public List getClassesSkippedByValidation() + { + return classesSkippedByValidation; + } } Modified: maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/util/TestsToRun.java URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/util/TestsToRun.java?rev=1045300&r1=1045299&r2=1045300&view=diff ============================================================================== --- maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/util/TestsToRun.java (original) +++ maven/surefire/trunk/surefire-api/src/main/java/org/apache/maven/surefire/util/TestsToRun.java Mon Dec 13 18:56:57 2010 @@ -45,7 +45,7 @@ public class TestsToRun */ public TestsToRun( List locatedClasses ) { - this.locatedClasses = Collections.unmodifiableList( locatedClasses); + this.locatedClasses = Collections.unmodifiableList( locatedClasses ); Set testSets = new HashSet(); for ( Iterator iterator = locatedClasses.iterator(); iterator.hasNext(); ) @@ -72,6 +72,12 @@ public class TestsToRun } } + public static TestsToRun fromClass( Class clazz ) + throws TestSetFailedException + { + return new TestsToRun( Arrays.asList( new Class[]{ clazz } ) ); + } + public int size() { return locatedClasses.size(); @@ -84,6 +90,7 @@ public class TestsToRun /** * Returns an iterator over the located java.lang.Class objects + * * @return an unmodifiable iterator */ public Iterator iterator() Modified: maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/PropertiesWrapper.java URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/PropertiesWrapper.java?rev=1045300&r1=1045299&r2=1045300&view=diff ============================================================================== --- maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/PropertiesWrapper.java (original) +++ maven/surefire/trunk/surefire-booter/src/main/java/org/apache/maven/surefire/booter/PropertiesWrapper.java Mon Dec 13 18:56:57 2010 @@ -19,6 +19,8 @@ package org.apache.maven.surefire.booter * under the License. */ +import org.apache.maven.surefire.util.ReflectionUtils; + import java.io.ByteArrayInputStream; import java.io.File; import java.util.*; @@ -129,6 +131,10 @@ public class PropertiesWrapper { return param; } + else if ( typeName.equals( Class.class.getName() ) ) + { + return ReflectionUtils.loadClass( Thread.currentThread().getContextClassLoader(), param ); + } else if ( typeName.equals( File.class.getName() ) ) { return new File( param ); @@ -203,6 +209,7 @@ public class PropertiesWrapper setProperty( key, file.toString() ); } } + public void setProperty( String key, Boolean aBoolean ) { if ( aBoolean != null ) Added: maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnit3TestChecker.java URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnit3TestChecker.java?rev=1045300&view=auto ============================================================================== --- maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnit3TestChecker.java (added) +++ maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnit3TestChecker.java Mon Dec 13 18:56:57 2010 @@ -0,0 +1,61 @@ +package org.apache.maven.surefire.junit; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.surefire.util.ReflectionUtils; +import org.apache.maven.surefire.util.ScannerFilter; + +/** + * @author Kristian Rosenvold + */ +public class JUnit3TestChecker + implements ScannerFilter +{ + private final Class junitClass; + + + public JUnit3TestChecker( ClassLoader testClassLoader ) + { + junitClass = ReflectionUtils.tryLoadClass( testClassLoader, "junit.framework.Test" ); + } + + public boolean accept( Class testClass ) + { + return isValidJUnit3Test( testClass ); + } + + public boolean isValidJUnit3Test( Class testClass ) + { + return junitClass != null && junitClass.isAssignableFrom( testClass ) || + classHasPublicNoArgConstructor( testClass ); + } + + private boolean classHasPublicNoArgConstructor( Class testClass ) + { + try + { + testClass.getConstructor( new Class[0] ); + return true; + } + catch ( Exception e ) + { + return false; + } + } +} Propchange: maven/surefire/trunk/surefire-providers/surefire-junit/src/main/java/org/apache/maven/surefire/junit/JUnit3TestChecker.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4DirectoryTestSuite.java URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4DirectoryTestSuite.java?rev=1045300&r1=1045299&r2=1045300&view=diff ============================================================================== --- maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4DirectoryTestSuite.java (original) +++ maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4DirectoryTestSuite.java Mon Dec 13 18:56:57 2010 @@ -45,6 +45,7 @@ public class JUnit4DirectoryTestSuite public JUnit4DirectoryTestSuite( File basedir, ArrayList includes, ArrayList excludes ) { super( basedir, includes, excludes ); + this.customRunListeners = new ArrayList<RunListener>(); } Modified: maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java?rev=1045300&r1=1045299&r2=1045300&view=diff ============================================================================== --- maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java (original) +++ maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java Mon Dec 13 18:56:57 2010 @@ -19,20 +19,28 @@ package org.apache.maven.surefire.junit4 * under the License. */ +import org.apache.maven.surefire.Surefire; import org.apache.maven.surefire.providerapi.ProviderParameters; import org.apache.maven.surefire.providerapi.SurefireProvider; +import org.apache.maven.surefire.report.DefaultReportEntry; +import org.apache.maven.surefire.report.ReportEntry; import org.apache.maven.surefire.report.ReporterException; import org.apache.maven.surefire.report.ReporterFactory; -import org.apache.maven.surefire.report.ReporterManagerFactory; +import org.apache.maven.surefire.report.ReporterManager; import org.apache.maven.surefire.suite.RunResult; import org.apache.maven.surefire.testset.TestSetFailedException; +import org.apache.maven.surefire.util.DefaultDirectoryScanner; import org.apache.maven.surefire.util.DirectoryScanner; import org.apache.maven.surefire.util.ReflectionUtils; +import org.apache.maven.surefire.util.TestsToRun; import org.junit.runner.notification.RunListener; +import org.junit.runner.notification.RunNotifier; +import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; import java.util.List; +import java.util.ResourceBundle; /** @@ -43,6 +51,8 @@ public class JUnit4Provider implements SurefireProvider { + private static ResourceBundle bundle = ResourceBundle.getBundle( Surefire.SUREFIRE_BUNDLE_NAME ); + private final ReporterFactory reporterFactory; private final ClassLoader testClassLoader; @@ -51,6 +61,10 @@ public class JUnit4Provider private final List<RunListener> customRunListeners; + private final JUnit4TestChecker jUnit4TestChecker; + + private TestsToRun testsToRun; + public JUnit4Provider( ProviderParameters booterParameters ) { this.reporterFactory = booterParameters.getReporterFactory(); @@ -58,6 +72,7 @@ public class JUnit4Provider this.directoryScanner = booterParameters.getDirectoryScanner(); customRunListeners = createCustomListeners( booterParameters.getProviderProperties().getProperty( "listener" ) ); + jUnit4TestChecker = new JUnit4TestChecker( testClassLoader ); } @@ -65,47 +80,100 @@ public class JUnit4Provider public RunResult invoke( Object forkTestSet ) throws TestSetFailedException, ReporterException { - JUnit4DirectoryTestSuite suite = getSuite(); - suite.locateTestSets( testClassLoader ); - if ( forkTestSet != null ) + if ( testsToRun == null ) { - suite.execute( (String) forkTestSet, (ReporterManagerFactory) reporterFactory, testClassLoader ); + testsToRun = forkTestSet == null ? scanClassPath() : TestsToRun.fromClass( (Class) forkTestSet ); } - else + + upgradeCheck(); + + JUnit4TestSetReporter jUnit4TestSetReporter = new JUnit4TestSetReporter( null, null ); + + RunNotifier runNotifer = getRunNotifer( jUnit4TestSetReporter, customRunListeners ); + for ( Class clazz : testsToRun.getLocatedClasses() ) { - suite.execute( (ReporterManagerFactory) reporterFactory, testClassLoader ); + ReporterManager reporter = (ReporterManager) reporterFactory.createReporter(); + jUnit4TestSetReporter.setTestSet( clazz ); + jUnit4TestSetReporter.setReportMgr( reporter ); + executeTestSet( clazz, reporter, testClassLoader, runNotifer ); } + + closeRunNotifer( jUnit4TestSetReporter, customRunListeners ); + return reporterFactory.close(); - } - private JUnit4DirectoryTestSuite getSuite() - { - return new JUnit4DirectoryTestSuite( directoryScanner, customRunListeners ); } - public Iterator getSuites() + private RunNotifier getRunNotifer( RunListener main, List<RunListener> others ) { - try + RunNotifier fNotifier = new RunNotifier(); + fNotifier.addListener( main ); + for ( RunListener listener : others ) { - return getSuite().locateTestSets( testClassLoader ).keySet().iterator(); + fNotifier.addListener( listener ); } - catch ( TestSetFailedException e ) + return fNotifier; + } + + // I am not entierly sure as to why we do this explicit freeing, it's one of those + // pieces of code that just seem to linger on in here ;) + + private void closeRunNotifer( RunListener main, List<RunListener> others ) + { + RunNotifier fNotifier = new RunNotifier(); + fNotifier.removeListener( main ); + for ( RunListener listener : others ) { - throw new RuntimeException( e ); + fNotifier.removeListener( listener ); } } - private void upgradeCheck( JUnit4DirectoryTestSuite suite ) + public Iterator getSuites() + { + testsToRun = scanClassPath(); + return testsToRun.iterator(); + } + + private void executeTestSet( Class clazz, ReporterManager reporter, ClassLoader classLoader, RunNotifier listeners ) + throws ReporterException, TestSetFailedException + { + + String rawString = bundle.getString( "testSetStarting" ); + + ReportEntry report = new DefaultReportEntry( this.getClass().getName(), clazz.getName(), rawString ); + + reporter.testSetStarting( report ); + + JUnit4TestSet.execute( clazz, listeners ); + + rawString = bundle.getString( "testSetCompletedNormally" ); + + report = new DefaultReportEntry( this.getClass().getName(), clazz.getName(), rawString ); + + reporter.testSetCompleted( report ); + + reporter.reset(); + + } + + + private TestsToRun scanClassPath() + { + return directoryScanner.locateTestClasses( testClassLoader, jUnit4TestChecker ); + } + + private void upgradeCheck() throws TestSetFailedException { - if ( isJunit4UpgradeCheck() && suite.getClassesSkippedByValidation().size() > 0 ) + if ( isJunit4UpgradeCheck() && + ( (DefaultDirectoryScanner) directoryScanner ).getClassesSkippedByValidation().size() > 0 ) { StringBuilder reason = new StringBuilder(); reason.append( "Updated check failed\n" ); reason.append( "There are tests that would be run with junit4 / surefire 2.6 but not with [2.7,):\n" ); - for ( Object o : suite.getClassesSkippedByValidation() ) + //noinspection unchecked + for ( Class testClass : (List<Class>) ( (DefaultDirectoryScanner) directoryScanner ).getClassesSkippedByValidation() ) { - Class testClass = (Class) o; reason.append( " " ); reason.append( testClass.getCanonicalName() ); reason.append( "\n" ); Modified: maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSet.java URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSet.java?rev=1045300&r1=1045299&r2=1045300&view=diff ============================================================================== --- maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSet.java (original) +++ maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSet.java Mon Dec 13 18:56:57 2010 @@ -27,6 +27,7 @@ import org.junit.runner.Runner; import org.junit.runner.notification.RunListener; import org.junit.runner.notification.RunNotifier; +import java.util.ArrayList; import java.util.List; public class JUnit4TestSet @@ -37,7 +38,8 @@ public class JUnit4TestSet /** * Constructor. * - * @param testClass the class to be run as a test + * @param testClass the class to be run as a test + * @param customRunListeners the custom run listeners to add */ protected JUnit4TestSet( Class testClass, List<RunListener> customRunListeners ) { @@ -45,6 +47,13 @@ public class JUnit4TestSet this.customRunListeners = customRunListeners; } + // Bogus constructor so we can build with 2.5. Remove for 2.7.1 + protected JUnit4TestSet( Class testClass ) + { + super( testClass ); + this.customRunListeners = new ArrayList(); + } + /** * Actually runs the test and adds the tests results to the <code>reportManager</code>. * @@ -53,36 +62,46 @@ public class JUnit4TestSet public void execute( ReporterManager reportManager, ClassLoader loader ) throws TestSetFailedException { - Runner junitTestRunner = Request.aClass( getTestClass() ).getRunner(); + List<RunListener> listeners = new ArrayList<RunListener>(); + listeners.add( new JUnit4TestSetReporter( getTestClass(), reportManager ) ); + listeners.addAll( customRunListeners ); + execute( getTestClass(), listeners ); + } + /** + * Actually runs the test and adds the tests results to the <code>reportManager</code>. + * + * @param testClass The test class to run + * @param runListeners The run listeners to attach + * @see org.apache.maven.surefire.testset.SurefireTestSet#execute(org.apache.maven.surefire.report.ReporterManager, java.lang.ClassLoader) + */ + public static void execute( Class testClass, List<RunListener> runListeners ) + throws TestSetFailedException + { RunNotifier fNotifier = new RunNotifier(); - RunListener listener = new JUnit4TestSetReporter( this, reportManager ); - fNotifier.addListener( listener ); - - if ( customRunListeners != null ) + for ( RunListener listener : runListeners ) { - for ( RunListener customRunListener : customRunListeners ) - { - fNotifier.addListener( customRunListener ); - } + fNotifier.addListener( listener ); } - try { - junitTestRunner.run( fNotifier ); + execute( testClass, fNotifier ); } finally { - fNotifier.removeListener( listener ); - - if ( customRunListeners != null ) + for ( RunListener listener : runListeners ) { - for ( RunListener customRunListener : customRunListeners ) - { - fNotifier.removeListener( customRunListener ); - } + fNotifier.removeListener( listener ); } } } + public static void execute( Class testClass, RunNotifier fNotifier ) + throws TestSetFailedException + { + Runner junitTestRunner = Request.aClass( testClass ).getRunner(); + + junitTestRunner.run( fNotifier ); + } } + Modified: maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSetReporter.java URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSetReporter.java?rev=1045300&r1=1045299&r2=1045300&view=diff ============================================================================== --- maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSetReporter.java (original) +++ maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSetReporter.java Mon Dec 13 18:56:57 2010 @@ -39,7 +39,7 @@ public class JUnit4TestSetReporter private static ResourceBundle bundle = ResourceBundle.getBundle( Surefire.SUREFIRE_BUNDLE_NAME ); // Member Variables - private JUnit4TestSet testSet; + private Class testSet; private ReporterManager reportMgr; @@ -51,13 +51,13 @@ public class JUnit4TestSetReporter /** * Constructor. * - * @param testSet the specific test set that this will report on as it is + * @param testClass the specific test set that this will report on as it is * executed * @param reportManager the report manager to log testing events to */ - JUnit4TestSetReporter( JUnit4TestSet testSet, ReporterManager reportManager ) + JUnit4TestSetReporter( Class testClass, ReporterManager reportManager ) { - this.testSet = testSet; + this.testSet = testClass; this.reportMgr = reportManager; } @@ -180,4 +180,14 @@ public class JUnit4TestSetReporter } return m.group( 1 ); } + + public void setTestSet( Class testSet ) + { + this.testSet = testSet; + } + + public void setReportMgr( ReporterManager reportMgr ) + { + this.reportMgr = reportMgr; + } } Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/pom.xml URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/pom.xml?rev=1045300&r1=1045299&r2=1045300&view=diff ============================================================================== --- maven/surefire/trunk/surefire-providers/surefire-junit47/pom.xml (original) +++ maven/surefire/trunk/surefire-providers/surefire-junit47/pom.xml Mon Dec 13 18:56:57 2010 @@ -70,6 +70,7 @@ <artifactId>maven-surefire-plugin</artifactId> <configuration> <jvm>${java.home}/bin/java</jvm> + <redirectTestOutputToFile>true</redirectTestOutputToFile> </configuration> </plugin> <plugin> Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreParameters.java URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreParameters.java?rev=1045300&r1=1045299&r2=1045300&view=diff ============================================================================== --- maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreParameters.java (original) +++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreParameters.java Mon Dec 13 18:56:57 2010 @@ -1,3 +1,5 @@ +package org.apache.maven.surefire.junitcore; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,7 +18,6 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.surefire.junitcore; import java.util.Properties; @@ -46,7 +47,7 @@ class JUnitCoreParameters { this.parallel = properties.getProperty( PARALLEL_KEY, "none" ).toLowerCase(); this.perCoreThreadCount = Boolean.valueOf( properties.getProperty( PERCORETHREADCOUNT_KEY, "true" ) ); - this.threadCount = Integer.valueOf( properties.getProperty( THREADCOUNT_KEY, "8" ) ); + this.threadCount = Integer.valueOf( properties.getProperty( THREADCOUNT_KEY, "2" ) ); this.useUnlimitedThreads = Boolean.valueOf( properties.getProperty( USEUNLIMITEDTHREADS_KEY, "false" ).toLowerCase() ); } @@ -94,7 +95,7 @@ class JUnitCoreParameters @Override public String toString() { - return "parallel='" + parallel + '\'' + ", perCoreThreadCount=" + perCoreThreadCount + - ", threadCount=" + threadCount + ", useUnlimitedThreads=" + useUnlimitedThreads; + return "parallel='" + parallel + '\'' + ", perCoreThreadCount=" + perCoreThreadCount + ", threadCount=" + + threadCount + ", useUnlimitedThreads=" + useUnlimitedThreads; } } Modified: maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java?rev=1045300&r1=1045299&r2=1045300&view=diff ============================================================================== --- maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java (original) +++ maven/surefire/trunk/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreProvider.java Mon Dec 13 18:56:57 2010 @@ -92,9 +92,7 @@ public class JUnitCoreProvider if ( testsToRun == null ) { - testsToRun = forkTestSet == null - ? scanClassPath() - : TestsToRun.fromClassName( (String) forkTestSet, testClassLoader ); + testsToRun = forkTestSet == null ? scanClassPath() : TestsToRun.fromClass( (Class) forkTestSet ); } ConcurrentReportingRunListener listener = ConcurrentReportingRunListener.createInstance( this.reporterFactory, this.reporterConfiguration,