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/21 20:58:02 UTC

svn commit: r1051626 - in /maven/surefire/trunk: maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ surefire-booter/src/main/java/org/apache/maven/surefire/booter/ surefire-integration-tests/src/test/java/org/apache/mave...

Author: krosenvold
Date: Tue Dec 21 19:58:02 2010
New Revision: 1051626

URL: http://svn.apache.org/viewvc?rev=1051626&view=rev
Log:
o Various small cleanups in ITs

Modified:
    maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.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-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire674BuildFailingWhenErrorsIT.java
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-613-testCount-in-parallel/pom.xml
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-621-testCounting-junit3-in-parallel/pom.xml
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-628-consoleoutputbeforeandafterclass/pom.xml
    maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-639-redirectTestOutputToFileWhenForking/pom.xml

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=1051626&r1=1051625&r2=1051626&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 Tue Dec 21 19:58:02 2010
@@ -140,8 +140,8 @@ public class ForkStarter
 
         boolean showHeading = true;
         final ProviderFactory providerFactory =
-            new ProviderFactory( startupConfiguration, providerConfiguration, surefireClassLoader );
-        SurefireProvider surefireProvider = providerFactory.createProvider( testsClassLoader );
+            new ProviderFactory( startupConfiguration, providerConfiguration, surefireClassLoader, testsClassLoader );
+        SurefireProvider surefireProvider = providerFactory.createProvider();
 
         Properties properties = new Properties();
 

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=1051626&r1=1051625&r2=1051626&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 Tue Dec 21 19:58:02 2010
@@ -40,30 +40,32 @@ public class ProviderFactory
 
     private final ClassLoader surefireClassLoader;
 
+    private final ClassLoader testsClassLoader;
+
     private final SurefireReflector surefireReflector;
 
 
     public ProviderFactory( StartupConfiguration startupConfiguration, ProviderConfiguration providerConfiguration,
-                            ClassLoader surefireClassLoader )
+                            ClassLoader surefireClassLoader, ClassLoader testsClassLoader )
     {
         this.providerConfiguration = providerConfiguration;
         this.surefireClassLoader = surefireClassLoader;
         this.startupConfiguration = startupConfiguration;
         this.surefireReflector = new SurefireReflector( surefireClassLoader );
+        this.testsClassLoader = testsClassLoader;
     }
 
-    public SurefireProvider createProvider( ClassLoader testClassLoader )
+    public SurefireProvider createProvider()
     {
         ClassLoader context = java.lang.Thread.currentThread().getContextClassLoader();
         Thread.currentThread().setContextClassLoader( surefireClassLoader );
 
         StartupConfiguration starterConfiguration = startupConfiguration;
-        final Object o =
-            surefireReflector.createBooterConfiguration();
+        final Object o = surefireReflector.createBooterConfiguration();
         surefireReflector.setTestSuiteDefinitionAware( o, providerConfiguration.getTestSuiteDefinition() );
         surefireReflector.setProviderPropertiesAware( o, providerConfiguration.getProviderProperties() );
         surefireReflector.setReporterConfigurationAware( o, providerConfiguration.getReporterConfiguration() );
-        surefireReflector.setTestClassLoaderAware( o, surefireClassLoader, testClassLoader );
+        surefireReflector.setTestClassLoaderAware( o, surefireClassLoader, testsClassLoader );
         surefireReflector.setTestArtifactInfoAware( o, providerConfiguration.getTestArtifact() );
         surefireReflector.setIfDirScannerAware( o, providerConfiguration.getDirScannerParams() );
 
@@ -94,7 +96,7 @@ public class ProviderFactory
             throws Throwable
         {
             ClassLoader original = java.lang.Thread.currentThread().getContextClassLoader();
-            Thread.currentThread().setContextClassLoader( surefireClassLoader );
+            Thread.currentThread().setContextClassLoader( testsClassLoader );
             try
             {
                 Method delegateMethod = target.getClass().getMethod( method.getName(), method.getParameterTypes() );

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=1051626&r1=1051625&r2=1051626&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 Tue Dec 21 19:58:02 2010
@@ -131,8 +131,8 @@ public class SurefireStarter
         // Note that System.out/System.err are also read in the "ReporterConfiguration" instatiation
         // in createProvider below. These are the same values as here.
         ProviderFactory providerFactory =
-            new ProviderFactory( startupConfiguration, providerConfiguration, surefireClassLoader );
-        final SurefireProvider provider = providerFactory.createProvider( testsClassLoader );
+            new ProviderFactory( startupConfiguration, providerConfiguration, surefireClassLoader, testsClassLoader );
+        final SurefireProvider provider = providerFactory.createProvider( );
 
         try
         {

Modified: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire674BuildFailingWhenErrorsIT.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire674BuildFailingWhenErrorsIT.java?rev=1051626&r1=1051625&r2=1051626&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire674BuildFailingWhenErrorsIT.java (original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire674BuildFailingWhenErrorsIT.java Tue Dec 21 19:58:02 2010
@@ -23,6 +23,8 @@ import org.apache.maven.it.Verifier;
 import org.apache.maven.it.util.ResourceExtractor;
 
 import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
 
 /**
  * SUREFIRE-674 Asserts that the build fails when tests have errors
@@ -37,6 +39,8 @@ public class Surefire674BuildFailingWhen
     {
         File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/surefire-674-buildFailingWhenErrors" );
         Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+        String[] opts = { "-fn" };
+        verifier.setCliOptions( new ArrayList( Arrays.asList( opts ) ) );
         this.executeGoal( verifier, "test" );
         verifier.resetStreams();
         verifier.verifyTextInLog(  "BUILD FAILURE");

Modified: maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-613-testCount-in-parallel/pom.xml
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-613-testCount-in-parallel/pom.xml?rev=1051626&r1=1051625&r2=1051626&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-613-testCount-in-parallel/pom.xml (original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-613-testCount-in-parallel/pom.xml Tue Dec 21 19:58:02 2010
@@ -1,7 +1,7 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
-  <groupId>mag</groupId>
+  <groupId>org.apache.maven.plugins.surefire</groupId>
   <artifactId>junit4-test</artifactId>
   <packaging>jar</packaging>
   <version>1.0-SNAPSHOT</version>

Modified: maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-621-testCounting-junit3-in-parallel/pom.xml
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-621-testCounting-junit3-in-parallel/pom.xml?rev=1051626&r1=1051625&r2=1051626&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-621-testCounting-junit3-in-parallel/pom.xml (original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-621-testCounting-junit3-in-parallel/pom.xml Tue Dec 21 19:58:02 2010
@@ -1,7 +1,7 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
-    <groupId>mho</groupId>
+    <groupId>org.apache.maven.plugins.surefire</groupId>
     <artifactId>surefire-test</artifactId>
     <packaging>jar</packaging>
     <version>1.0-SNAPSHOT</version>

Modified: maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-628-consoleoutputbeforeandafterclass/pom.xml
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-628-consoleoutputbeforeandafterclass/pom.xml?rev=1051626&r1=1051625&r2=1051626&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-628-consoleoutputbeforeandafterclass/pom.xml (original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-628-consoleoutputbeforeandafterclass/pom.xml Tue Dec 21 19:58:02 2010
@@ -1,7 +1,7 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
-  <groupId>mag</groupId>
+  <groupId>org.apache.maven.plugins.surefire</groupId>
   <artifactId>junit4-test</artifactId>
   <packaging>jar</packaging>
   <version>1.0-SNAPSHOT</version>

Modified: maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-639-redirectTestOutputToFileWhenForking/pom.xml
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-639-redirectTestOutputToFileWhenForking/pom.xml?rev=1051626&r1=1051625&r2=1051626&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-639-redirectTestOutputToFileWhenForking/pom.xml (original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/resources/surefire-639-redirectTestOutputToFileWhenForking/pom.xml Tue Dec 21 19:58:02 2010
@@ -1,7 +1,7 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
-  <groupId>mag</groupId>
+  <groupId>org.apache.maven.plugins.surefire</groupId>
   <artifactId>junit4-test</artifactId>
   <packaging>jar</packaging>
   <version>1.0-SNAPSHOT</version>