maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krosenv...@apache.org
Subject git commit: o Moved everything to system classloader in forked vm
Date Sat, 13 Apr 2013 16:34:28 GMT
Updated Branches:
  refs/heads/master 8315562ed -> ff9db665a


o Moved everything to system classloader in forked vm


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/ff9db665
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/ff9db665
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/ff9db665

Branch: refs/heads/master
Commit: ff9db665a24256307b5e1fb312352ff78e5e892f
Parents: 8315562
Author: Kristian Rosenvold <krosenvold@apache.org>
Authored: Sat Apr 13 17:44:49 2013 +0200
Committer: Kristian Rosenvold <krosenvold@apache.org>
Committed: Sat Apr 13 18:33:52 2013 +0200

----------------------------------------------------------------------
 .../plugin/surefire/booterclient/ForkStarter.java  |   13 +-
 .../maven/surefire/booter/SurefireReflector.java   |    5 +
 .../apache/maven/surefire/util/LazyTestsToRun.java |  183 ---------------
 .../surefire/booter/ClasspathConfiguration.java    |   18 +-
 .../apache/maven/surefire/booter/ForkedBooter.java |   89 ++++++--
 .../maven/surefire/booter/LazyTestsToRun.java      |  181 ++++++++++++++
 .../maven/surefire/booter/ProviderFactory.java     |    1 +
 7 files changed, 266 insertions(+), 224 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ff9db665/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
index a21ce3c..5eda3f6 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkStarter.java
@@ -66,6 +66,8 @@ import org.apache.maven.surefire.report.StackTraceWriter;
 import org.apache.maven.surefire.suite.RunResult;
 import org.apache.maven.surefire.util.DefaultScanResult;
 
+import static org.apache.maven.surefire.booter.Classpath.join;
+
 /**
  * Starts the fork or runs in-process.
  * <p/>
@@ -387,17 +389,14 @@ public class ForkStarter
             throw new SurefireBooterForkException( "Error creating properties files for forking",
e );
         }
 
+        // this could probably be simplified further
         final Classpath bootClasspathConfiguration = startupConfiguration.isProviderMainClass()
             ? startupConfiguration.getClasspathConfiguration().getProviderClasspath()
             : forkConfiguration.getBootClasspath();
 
-        final Classpath additionlClassPathUrls = startupConfiguration.useSystemClassLoader()
-            ? startupConfiguration.getClasspathConfiguration().getTestClasspath()
-            : null;
-
-        // Surefire-booter + all test classes if "useSystemClassloader"
-        // Surefire-booter if !useSystemClassLoader
-        Classpath bootClasspath = Classpath.join( bootClasspathConfiguration, additionlClassPathUrls
);
+        Classpath bootClasspath = join(
+            join( bootClasspathConfiguration, startupConfiguration.getClasspathConfiguration().getTestClasspath()
),
+            startupConfiguration.getClasspathConfiguration().getProviderClasspath() );
 
         if ( log.isDebugEnabled() )
         {

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ff9db665/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java
b/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java
index 0c3055b..0304737 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/booter/SurefireReflector.java
@@ -225,6 +225,11 @@ public class SurefireReflector
                                                   surefireClassLoader );
     }
 
+    public static ReporterFactory createForkingReporterFactoryInCurrentClassLoader( Boolean
trimStackTrace, PrintStream originalSystemOut )
+    {
+        return new ForkingReporterFactory( trimStackTrace, originalSystemOut );
+    }
+
     public Object createBooterConfiguration( ClassLoader surefireClassLoader, Object factoryInstance,
                                              boolean insideFork )
     {

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ff9db665/surefire-api/src/main/java/org/apache/maven/surefire/util/LazyTestsToRun.java
----------------------------------------------------------------------
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/util/LazyTestsToRun.java
b/surefire-api/src/main/java/org/apache/maven/surefire/util/LazyTestsToRun.java
deleted file mode 100644
index 71cd1bd..0000000
--- a/surefire-api/src/main/java/org/apache/maven/surefire/util/LazyTestsToRun.java
+++ /dev/null
@@ -1,183 +0,0 @@
-package org.apache.maven.surefire.util;
-
-/*
- * 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 java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import org.apache.maven.surefire.booter.ForkingRunListener;
-
-/**
- * A variant of TestsToRun that is provided with test class names
- * from an {@link InputStream} (e.g. {@code System.in}). The method
- * {@link #iterator()} returns an Iterator that blocks on calls to
- * {@link Iterator#hasNext()} until new classes are available, or no more
- * classes will be available.
- *
- * @author Andreas Gudian
- */
-public class LazyTestsToRun
-    extends TestsToRun
-{
-    private final List<Class> workQueue = new ArrayList<Class>();
-
-    private BufferedReader inputReader;
-
-    private boolean streamClosed = false;
-
-    private ClassLoader testClassLoader;
-
-    private PrintStream originalOutStream;
-
-    /**
-     * C'tor
-     *
-     * @param testSource        source to read the tests from
-     * @param testClassLoader   class loader to load the test classes
-     * @param originalOutStream the output stream to use when requesting new new tests
-     */
-    public LazyTestsToRun( InputStream testSource, ClassLoader testClassLoader, PrintStream
originalOutStream )
-    {
-        super( Collections.<Class>emptyList() );
-
-        this.testClassLoader = testClassLoader;
-        this.originalOutStream = originalOutStream;
-
-        inputReader = new BufferedReader( new InputStreamReader( testSource ) );
-    }
-
-    protected void addWorkItem( String className )
-    {
-        synchronized ( workQueue )
-        {
-            workQueue.add( ReflectionUtils.loadClass( testClassLoader, className ) );
-        }
-    }
-
-    protected void requestNextTest()
-    {
-        StringBuilder sb = new StringBuilder();
-        sb.append( (char) ForkingRunListener.BOOTERCODE_NEXT_TEST ).append( ",0,want more!\n"
);
-        originalOutStream.print( sb.toString() );
-    }
-
-    private class BlockingIterator
-        implements Iterator<Class>
-    {
-        private int lastPos = -1;
-
-        public boolean hasNext()
-        {
-            int nextPos = lastPos + 1;
-            synchronized ( workQueue )
-            {
-                if ( workQueue.size() > nextPos )
-                {
-                    return true;
-                }
-                else
-                {
-                    if ( needsToWaitForInput( nextPos ) )
-                    {
-                        requestNextTest();
-
-                        String nextClassName;
-                        try
-                        {
-                            nextClassName = inputReader.readLine();
-                        }
-                        catch ( IOException e )
-                        {
-                            streamClosed = true;
-                            return false;
-                        }
-
-                        if ( null == nextClassName )
-                        {
-                            streamClosed = true;
-                        }
-                        else
-                        {
-                            addWorkItem( nextClassName );
-                        }
-                    }
-
-                    return ( workQueue.size() > nextPos );
-                }
-            }
-        }
-
-        private boolean needsToWaitForInput( int nextPos )
-        {
-            return workQueue.size() == nextPos && !streamClosed;
-        }
-
-        public Class next()
-        {
-            synchronized ( workQueue )
-            {
-                return workQueue.get( ++lastPos );
-            }
-        }
-
-        public void remove()
-        {
-            throw new UnsupportedOperationException();
-        }
-
-    }
-
-    /* (non-Javadoc)
-      * @see org.apache.maven.surefire.util.TestsToRun#iterator()
-      */
-    public Iterator<Class> iterator()
-    {
-        return new BlockingIterator();
-    }
-
-    /* (non-Javadoc)
-      * @see org.apache.maven.surefire.util.TestsToRun#toString()
-      */
-    public String toString()
-    {
-        StringBuilder sb = new StringBuilder( "LazyTestsToRun " );
-        synchronized ( workQueue )
-        {
-            sb.append( "(more items expected: " ).append( !streamClosed ).append( "): " );
-            sb.append( workQueue );
-        }
-
-        return sb.toString();
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.maven.surefire.util.TestsToRun#allowEagerReading()
-     */
-    public boolean allowEagerReading() {
-        return false;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ff9db665/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ClasspathConfiguration.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ClasspathConfiguration.java
b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ClasspathConfiguration.java
index 8ae4ec7..de936a9 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ClasspathConfiguration.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ClasspathConfiguration.java
@@ -118,21 +118,15 @@ public class ClasspathConfiguration
         return classpathUrls;
     }
 
-    public ClassLoader createForkingTestClassLoader( boolean manifestOnlyJarRequestedAndUsable
)
+    public void trickClassPathWhenManifestOnlyClasspath()
         throws SurefireExecutionException
     {
-        if ( manifestOnlyJarRequestedAndUsable )
-        {
             System.setProperty( "surefire.real.class.path", System.getProperty( "java.class.path"
) );
             getTestClasspath().writeToSystemProperty( "java.class.path" );
-            // this.getClass.getClassLoader() is always loaded in system classloader if forking
-            // this.getClass().getClassLoader() is plugin classloder if in-process
-            // "this" must refer to a class within the booter module
-            return this.getClass().getClassLoader();   // SUREFIRE-459, trick the app under
test into thinking its classpath was conventional;
-        }
-        else
-        {
-            return createTestClassLoader();
-        }
+    }
+
+    public boolean isEnableAssertions()
+    {
+        return enableAssertions;
     }
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ff9db665/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
index c06297a..ea0ddb1 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
@@ -24,11 +24,15 @@ import java.io.FileInputStream;
 import java.io.InputStream;
 import java.io.PrintStream;
 import java.lang.reflect.InvocationTargetException;
+
+import org.apache.maven.surefire.providerapi.ProviderParameters;
+import org.apache.maven.surefire.providerapi.SurefireProvider;
 import org.apache.maven.surefire.report.LegacyPojoStackTraceWriter;
+import org.apache.maven.surefire.report.ReporterFactory;
 import org.apache.maven.surefire.report.StackTraceWriter;
 import org.apache.maven.surefire.suite.RunResult;
 import org.apache.maven.surefire.testset.TestSetFailedException;
-import org.apache.maven.surefire.util.LazyTestsToRun;
+import org.apache.maven.surefire.util.ReflectionUtils;
 
 /**
  * The part of the booter that is unique to a forked vm.
@@ -71,19 +75,23 @@ public class ForkedBooter
             boolean readTestsFromInputStream = providerConfiguration.isReadTestsFromInStream();
 
             final ClasspathConfiguration classpathConfiguration = startupConfiguration.getClasspathConfiguration();
-            final ClassLoader testClassLoader = classpathConfiguration.createForkingTestClassLoader(
-                startupConfiguration.isManifestOnlyJarRequestedAndUsable() );
+            if ( startupConfiguration.isManifestOnlyJarRequestedAndUsable() )
+            {
+                classpathConfiguration.trickClassPathWhenManifestOnlyClasspath();
+            }
 
+            Thread.currentThread().getContextClassLoader().setDefaultAssertionStatus(
+                classpathConfiguration.isEnableAssertions() );
             startupConfiguration.writeSurefireTestClasspathProperty();
 
             Object testSet;
             if ( forkedTestSet != null )
             {
-                testSet = forkedTestSet.getDecodedValue( testClassLoader );
+                testSet = forkedTestSet.getDecodedValue( Thread.currentThread().getContextClassLoader()
);
             }
             else if ( readTestsFromInputStream )
             {
-                testSet = new LazyTestsToRun( System.in, testClassLoader, originalOut );
+                testSet = new LazyTestsToRun( System.in, originalOut );
             }
             else
             {
@@ -92,8 +100,7 @@ public class ForkedBooter
 
             try
             {
-                runSuitesInProcess( testSet, testClassLoader, startupConfiguration, providerConfiguration,
-                                    originalOut );
+                runSuitesInProcess( testSet, startupConfiguration, providerConfiguration,
originalOut );
             }
             catch ( InvocationTargetException t )
             {
@@ -136,30 +143,22 @@ public class ForkedBooter
     }
 
 
-    private static RunResult runSuitesInProcess( Object testSet, ClassLoader testsClassLoader,
-                                                 StartupConfiguration startupConfiguration,
+    private static RunResult runSuitesInProcess( Object testSet, StartupConfiguration startupConfiguration,
                                                  ProviderConfiguration providerConfiguration,
                                                  PrintStream originalSystemOut )
         throws SurefireExecutionException, TestSetFailedException, InvocationTargetException
     {
-        final ClasspathConfiguration classpathConfiguration = startupConfiguration.getClasspathConfiguration();
-        ClassLoader surefireClassLoader = classpathConfiguration.createSurefireClassLoader(
testsClassLoader );
-
-        SurefireReflector surefireReflector = new SurefireReflector( surefireClassLoader
);
-
-        final Object factory =
-            createForkingReporterFactory( surefireReflector, providerConfiguration, originalSystemOut
);
+        final ReporterFactory factory = createForkingReporterFactory( providerConfiguration,
originalSystemOut );
 
-        return ProviderFactory.invokeProvider( testSet, testsClassLoader, surefireClassLoader,
factory,
-                                               providerConfiguration, true, startupConfiguration,
false );
+        return invokeProviderInSameClassLoader( testSet, factory, providerConfiguration,
true, startupConfiguration,
+                                                false );
     }
 
-    private static Object createForkingReporterFactory( SurefireReflector surefireReflector,
-                                                        ProviderConfiguration providerConfiguration,
-                                                        PrintStream originalSystemOut )
+    private static ReporterFactory createForkingReporterFactory( ProviderConfiguration providerConfiguration,
+                                                                 PrintStream originalSystemOut
)
     {
         final Boolean trimStackTrace = providerConfiguration.getReporterConfiguration().isTrimStackTrace();
-        return surefireReflector.createForkingReporterFactory( trimStackTrace, originalSystemOut
);
+        return SurefireReflector.createForkingReporterFactoryInCurrentClassLoader( trimStackTrace,
originalSystemOut );
     }
 
     private static void launchLastDitchDaemonShutdownThread( final int returnCode )
@@ -182,4 +181,50 @@ public class ForkedBooter
         lastExit.start();
     }
 
+    public static RunResult invokeProviderInSameClassLoader( Object testSet, Object factory,
+                                                             ProviderConfiguration providerConfiguration,
+                                                             boolean insideFork,
+                                                             StartupConfiguration startupConfiguration1,
+                                                             boolean restoreStreams )
+        throws TestSetFailedException, InvocationTargetException
+    {
+        final PrintStream orgSystemOut = System.out;
+        final PrintStream orgSystemErr = System.err;
+        // Note that System.out/System.err are also read in the "ReporterConfiguration" instatiation
+        // in createProvider below. These are the same values as here.
+
+        final SurefireProvider provider =
+            createProviderInCurrentClassloader( startupConfiguration1, insideFork, providerConfiguration,
factory );
+        try
+        {
+            return provider.invoke( testSet );
+        }
+        finally
+        {
+            if ( restoreStreams && System.getSecurityManager() == null )
+            {
+                System.setOut( orgSystemOut );
+                System.setErr( orgSystemErr );
+            }
+        }
+    }
+
+    public static SurefireProvider createProviderInCurrentClassloader( StartupConfiguration
startupConfiguration1,
+                                                                       boolean isInsideFork,
+                                                                       ProviderConfiguration
providerConfiguration,
+                                                                       Object reporterManagerFactory1
)
+    {
+        BaseProviderFactory bpf = new BaseProviderFactory( (ReporterFactory) reporterManagerFactory1,
isInsideFork );
+        bpf.setTestRequest( providerConfiguration.getTestSuiteDefinition() );
+        bpf.setReporterConfiguration( providerConfiguration.getReporterConfiguration() );
+        ClassLoader clasLoader = Thread.currentThread().getContextClassLoader();
+        bpf.setClassLoaders( clasLoader, clasLoader );
+        bpf.setTestArtifactInfo( providerConfiguration.getTestArtifact() );
+        bpf.setProviderProperties( providerConfiguration.getProviderProperties() );
+        bpf.setRunOrderParameters( providerConfiguration.getRunOrderParameters() );
+        bpf.setDirectoryScannerParameters( providerConfiguration.getDirScannerParams() );
+        return (SurefireProvider) ReflectionUtils.instantiateOneArg( clasLoader,
+                                                                     startupConfiguration1.getActualClassName(),
+                                                                     ProviderParameters.class,
bpf );
+    }
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ff9db665/surefire-booter/src/main/java/org/apache/maven/surefire/booter/LazyTestsToRun.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/LazyTestsToRun.java
b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/LazyTestsToRun.java
new file mode 100644
index 0000000..ff0f184
--- /dev/null
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/LazyTestsToRun.java
@@ -0,0 +1,181 @@
+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.
+ */
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.maven.surefire.util.ReflectionUtils;
+import org.apache.maven.surefire.util.TestsToRun;
+
+/**
+ * A variant of TestsToRun that is provided with test class names
+ * from an {@link InputStream} (e.g. {@code System.in}). The method
+ * {@link #iterator()} returns an Iterator that blocks on calls to
+ * {@link Iterator#hasNext()} until new classes are available, or no more
+ * classes will be available.
+ *
+ * @author Andreas Gudian
+ */
+class LazyTestsToRun
+    extends TestsToRun
+{
+    private final List<Class> workQueue = new ArrayList<Class>();
+
+    private BufferedReader inputReader;
+
+    private boolean streamClosed = false;
+
+    private PrintStream originalOutStream;
+
+    /**
+     * C'tor
+     *
+     * @param testSource        source to read the tests from
+     * @param originalOutStream the output stream to use when requesting new new tests
+     */
+    public LazyTestsToRun( InputStream testSource, PrintStream originalOutStream )
+    {
+        super( Collections.<Class>emptyList() );
+
+        this.originalOutStream = originalOutStream;
+
+        inputReader = new BufferedReader( new InputStreamReader( testSource ) );
+    }
+
+    protected void addWorkItem( String className )
+    {
+        synchronized ( workQueue )
+        {
+            workQueue.add( ReflectionUtils.loadClass( Thread.currentThread().getContextClassLoader(),
className ) );
+        }
+    }
+
+    protected void requestNextTest()
+    {
+        StringBuilder sb = new StringBuilder();
+        sb.append( (char) ForkingRunListener.BOOTERCODE_NEXT_TEST ).append( ",0,want more!\n"
);
+        originalOutStream.print( sb.toString() );
+    }
+
+    private class BlockingIterator
+        implements Iterator<Class>
+    {
+        private int lastPos = -1;
+
+        public boolean hasNext()
+        {
+            int nextPos = lastPos + 1;
+            synchronized ( workQueue )
+            {
+                if ( workQueue.size() > nextPos )
+                {
+                    return true;
+                }
+                else
+                {
+                    if ( needsToWaitForInput( nextPos ) )
+                    {
+                        requestNextTest();
+
+                        String nextClassName;
+                        try
+                        {
+                            nextClassName = inputReader.readLine();
+                        }
+                        catch ( IOException e )
+                        {
+                            streamClosed = true;
+                            return false;
+                        }
+
+                        if ( null == nextClassName )
+                        {
+                            streamClosed = true;
+                        }
+                        else
+                        {
+                            addWorkItem( nextClassName );
+                        }
+                    }
+
+                    return ( workQueue.size() > nextPos );
+                }
+            }
+        }
+
+        private boolean needsToWaitForInput( int nextPos )
+        {
+            return workQueue.size() == nextPos && !streamClosed;
+        }
+
+        public Class next()
+        {
+            synchronized ( workQueue )
+            {
+                return workQueue.get( ++lastPos );
+            }
+        }
+
+        public void remove()
+        {
+            throw new UnsupportedOperationException();
+        }
+
+    }
+
+    /* (non-Javadoc)
+      * @see org.apache.maven.surefire.util.TestsToRun#iterator()
+      */
+    public Iterator<Class> iterator()
+    {
+        return new BlockingIterator();
+    }
+
+    /* (non-Javadoc)
+      * @see org.apache.maven.surefire.util.TestsToRun#toString()
+      */
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder( "LazyTestsToRun " );
+        synchronized ( workQueue )
+        {
+            sb.append( "(more items expected: " ).append( !streamClosed ).append( "): " );
+            sb.append( workQueue );
+        }
+
+        return sb.toString();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.maven.surefire.util.TestsToRun#allowEagerReading()
+     */
+    public boolean allowEagerReading() {
+        return false;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ff9db665/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java
----------------------------------------------------------------------
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java
b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java
index 021d04b..d729066 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java
@@ -96,6 +96,7 @@ public class ProviderFactory
         }
     }
 
+
     public SurefireProvider createProvider( boolean isInsideFork )
     {
         ClassLoader systemClassLoader = java.lang.Thread.currentThread().getContextClassLoader();


Mime
View raw message