Repository: maven-surefire
Updated Branches:
  refs/heads/master 2c9edf062 -> 6a79127ab


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/6a79127a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/pc/SchedulingStrategiesTest.java
----------------------------------------------------------------------
diff --git 
a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/pc/SchedulingStrategiesTest.java
 
b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/pc/SchedulingStrategiesTest.java
index a47030c..98c3721 100644
--- 
a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/pc/SchedulingStrategiesTest.java
+++ 
b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/pc/SchedulingStrategiesTest.java
@@ -19,14 +19,15 @@ package org.apache.maven.surefire.junitcore.pc;
  * under the License.
  */
 
-import org.apache.maven.surefire.junitcore.Logger;
-import org.apache.maven.surefire.util.internal.DaemonThreadFactory;
+import org.apache.maven.surefire.report.ConsoleStream;
+import org.apache.maven.surefire.report.DefaultDirectConsoleReporter;
 import org.junit.Test;
 
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ThreadFactory;
 
+import static 
org.apache.maven.surefire.util.internal.DaemonThreadFactory.newDaemonThreadFactory;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
@@ -46,13 +47,14 @@ import static org.junit.Assert.assertTrue;
  */
 public class SchedulingStrategiesTest
 {
-    private static final ThreadFactory DAEMON_THREAD_FACTORY = 
DaemonThreadFactory.newDaemonThreadFactory();
+    private static final ThreadFactory DAEMON_THREAD_FACTORY = 
newDaemonThreadFactory();
+    private final ConsoleStream logger = new DefaultDirectConsoleReporter( 
System.out );
 
     @Test
     public void invokerStrategy()
         throws InterruptedException
     {
-        SchedulingStrategy strategy = 
SchedulingStrategies.createInvokerStrategy( new Logger() );
+        SchedulingStrategy strategy = 
SchedulingStrategies.createInvokerStrategy( logger );
         assertFalse( strategy.hasSharedThreadPool() );
         assertTrue( strategy.canSchedule() );
 
@@ -72,7 +74,7 @@ public class SchedulingStrategiesTest
     public void nonSharedPoolStrategy()
         throws InterruptedException
     {
-        SchedulingStrategy strategy = 
SchedulingStrategies.createParallelStrategy( new Logger(),  2 );
+        SchedulingStrategy strategy = 
SchedulingStrategies.createParallelStrategy( logger,  2 );
         assertFalse( strategy.hasSharedThreadPool() );
         assertTrue( strategy.canSchedule() );
 
@@ -94,7 +96,7 @@ public class SchedulingStrategiesTest
     @Test(expected = NullPointerException.class)
     public void sharedPoolStrategyNullPool()
     {
-        SchedulingStrategies.createParallelSharedStrategy( new Logger(), null 
);
+        SchedulingStrategies.createParallelSharedStrategy( logger, null );
     }
 
     @Test
@@ -103,11 +105,11 @@ public class SchedulingStrategiesTest
     {
         ExecutorService sharedPool = Executors.newCachedThreadPool( 
DAEMON_THREAD_FACTORY );
 
-        SchedulingStrategy strategy1 = 
SchedulingStrategies.createParallelSharedStrategy( new Logger(), sharedPool );
+        SchedulingStrategy strategy1 = 
SchedulingStrategies.createParallelSharedStrategy( logger, sharedPool );
         assertTrue( strategy1.hasSharedThreadPool() );
         assertTrue( strategy1.canSchedule() );
 
-        SchedulingStrategy strategy2 = 
SchedulingStrategies.createParallelSharedStrategy( new Logger(), sharedPool );
+        SchedulingStrategy strategy2 = 
SchedulingStrategies.createParallelSharedStrategy( logger, sharedPool );
         assertTrue( strategy2.hasSharedThreadPool() );
         assertTrue( strategy2.canSchedule() );
 
@@ -140,7 +142,7 @@ public class SchedulingStrategiesTest
     public void infinitePoolStrategy()
         throws InterruptedException
     {
-        SchedulingStrategy strategy = 
SchedulingStrategies.createParallelStrategyUnbounded( new Logger() );
+        SchedulingStrategy strategy = 
SchedulingStrategies.createParallelStrategyUnbounded( logger );
         assertFalse( strategy.hasSharedThreadPool() );
         assertTrue( strategy.canSchedule() );
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/6a79127a/surefire-report-parser/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-report-parser/pom.xml b/surefire-report-parser/pom.xml
index 9f418f5..33c535f 100644
--- a/surefire-report-parser/pom.xml
+++ b/surefire-report-parser/pom.xml
@@ -38,6 +38,10 @@
 
   <dependencies>
     <dependency>
+      <groupId>org.apache.maven.surefire</groupId>
+      <artifactId>surefire-logger-api</artifactId>
+    </dependency>
+    <dependency>
       <groupId>org.apache.maven.shared</groupId>
       <artifactId>maven-shared-utils</artifactId>
     </dependency>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/6a79127a/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportParser.java
----------------------------------------------------------------------
diff --git 
a/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportParser.java
 
b/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportParser.java
index 0c9bdbd..62240e5 100644
--- 
a/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportParser.java
+++ 
b/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportParser.java
@@ -24,7 +24,6 @@ import java.io.IOException;
 import java.text.NumberFormat;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
@@ -32,11 +31,14 @@ import java.util.Map;
 
 import javax.xml.parsers.ParserConfigurationException;
 
+import org.apache.maven.plugin.surefire.log.api.ConsoleLogger;
 import org.apache.maven.reporting.MavenReportException;
 import org.apache.maven.shared.utils.StringUtils;
 import org.apache.maven.shared.utils.io.DirectoryScanner;
 import org.xml.sax.SAXException;
 
+import static java.util.Collections.singletonList;
+
 /**
  *
  */
@@ -53,12 +55,15 @@ public final class SurefireReportParser
 
     private final NumberFormat numberFormat;
 
+    private final ConsoleLogger consoleLogger;
+
     private List<File> reportsDirectories;
 
-    public SurefireReportParser( List<File> reportsDirectoriesFiles, Locale 
locale )
+    public SurefireReportParser( List<File> reportsDirectories, Locale locale, 
ConsoleLogger consoleLogger )
     {
-        reportsDirectories = reportsDirectoriesFiles;
+        this.reportsDirectories = reportsDirectories;
         numberFormat = NumberFormat.getInstance( locale );
+        this.consoleLogger = consoleLogger;
     }
 
     public List<ReportTestSuite> parseXMLReportFiles()
@@ -75,7 +80,7 @@ public final class SurefireReportParser
                 }
             }
         }
-        final TestSuiteXmlParser parser = new TestSuiteXmlParser();
+        final TestSuiteXmlParser parser = new TestSuiteXmlParser( 
consoleLogger );
         for ( File aXmlReportFileList : xmlReportFiles )
         {
             try
@@ -161,7 +166,7 @@ public final class SurefireReportParser
 
     public void setReportsDirectory( File reportsDirectory )
     {
-        reportsDirectories = Collections.singletonList( reportsDirectory );
+        reportsDirectories = singletonList( reportsDirectory );
     }
 
     public NumberFormat getNumberFormat()

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/6a79127a/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java
----------------------------------------------------------------------
diff --git 
a/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java
 
b/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java
index f027b29..c28b4b1 100644
--- 
a/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java
+++ 
b/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParser.java
@@ -28,26 +28,30 @@ import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
-import java.util.Locale;
 import java.util.Map;
 
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 
+import org.apache.maven.plugin.surefire.log.api.ConsoleLogger;
 import org.apache.maven.shared.utils.StringUtils;
 import org.xml.sax.Attributes;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.DefaultHandler;
 
+import static java.util.Locale.ENGLISH;
+
 /**
  *
  */
 public final class TestSuiteXmlParser
     extends DefaultHandler
 {
-    private final NumberFormat numberFormat = NumberFormat.getInstance( 
Locale.ENGLISH );
+    private final NumberFormat numberFormat = NumberFormat.getInstance( 
ENGLISH );
+
+    private final ConsoleLogger consoleLogger;
 
     private ReportTestSuite defaultSuite;
 
@@ -63,6 +67,11 @@ public final class TestSuiteXmlParser
 
     private boolean valid;
 
+    public TestSuiteXmlParser( ConsoleLogger consoleLogger )
+    {
+        this.consoleLogger = consoleLogger;
+    }
+
     public List<ReportTestSuite> parse( String xmlPath )
         throws ParserConfigurationException, SAXException, IOException
     {
@@ -129,7 +138,7 @@ public final class TestSuiteXmlParser
                     }
                     catch ( NullPointerException e )
                     {
-                        System.err.println( "WARNING: no time attribute found 
on testsuite element" );
+                        consoleLogger.error( "WARNING: no time attribute found 
on testsuite element" );
                     }
 
                     final String name = attributes.getValue( "name" );

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/6a79127a/surefire-report-parser/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportParserTest.java
----------------------------------------------------------------------
diff --git 
a/surefire-report-parser/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportParserTest.java
 
b/surefire-report-parser/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportParserTest.java
index de25c4d..0fad166 100644
--- 
a/surefire-report-parser/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportParserTest.java
+++ 
b/surefire-report-parser/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportParserTest.java
@@ -26,12 +26,15 @@ import java.net.URLDecoder;
 import java.text.NumberFormat;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Locale;
 import java.util.Map;
+
+import org.apache.maven.plugin.surefire.log.api.NullConsoleLogger;
 import org.apache.maven.reporting.MavenReportException;
 
 import junit.framework.TestCase;
 
+import static java.util.Locale.ENGLISH;
+
 /**
  *
  */
@@ -47,7 +50,7 @@ public class SurefireReportParserTest
         throws Exception
     {
         super.setUp();
-        report = new SurefireReportParser( null, Locale.ENGLISH );
+        report = new SurefireReportParser( null, ENGLISH, new 
NullConsoleLogger() );
     }
 
     public void testParseXMLReportFiles()

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/6a79127a/surefire-report-parser/src/test/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParserTest.java
----------------------------------------------------------------------
diff --git 
a/surefire-report-parser/src/test/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParserTest.java
 
b/surefire-report-parser/src/test/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParserTest.java
index da06451..6e0a325 100644
--- 
a/surefire-report-parser/src/test/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParserTest.java
+++ 
b/surefire-report-parser/src/test/java/org/apache/maven/plugins/surefire/report/TestSuiteXmlParserTest.java
@@ -23,14 +23,18 @@ import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
+import org.apache.maven.plugin.surefire.log.api.ConsoleLogger;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
 import static org.junit.Assume.assumeTrue;
-import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.Matchers.*;
 import static org.hamcrest.MatcherAssert.assertThat;
 
 /**
@@ -40,11 +44,56 @@ public class TestSuiteXmlParserTest
 {
     private static final String[] linePatterns = { "at org.apache.Test.", "at 
org.apache.Test$" };
 
+    private final Collection<String> loggedErrors = new ArrayList<String>();
+
+    private ConsoleLogger consoleLogger;
+
+    @Before
+    public void instantiateLogger()
+    {
+        consoleLogger = new ConsoleLogger()
+        {
+            public void debug( String message )
+            {
+            }
+
+            public void info( String message )
+            {
+            }
+
+            public void warning( String message )
+            {
+                loggedErrors.add( message );
+            }
+
+            public void error( String message )
+            {
+                loggedErrors.add( message );
+            }
+
+            public void error( String message, Throwable t )
+            {
+                loggedErrors.add( message );
+            }
+
+            public void error( Throwable t )
+            {
+                loggedErrors.add( t.getLocalizedMessage() );
+            }
+        };
+    }
+
+    @After
+    public void verifyErrorFreeLogger()
+    {
+        assertThat( loggedErrors, is( empty() ) );
+    }
+
     @Test
     public void testParse()
         throws Exception
     {
-        TestSuiteXmlParser testSuiteXmlParser = new TestSuiteXmlParser();
+        TestSuiteXmlParser testSuiteXmlParser = new TestSuiteXmlParser( 
consoleLogger );
         String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" +
             "<testsuite failures=\"4\" time=\"0.005\" errors=\"0\" 
skipped=\"0\" tests=\"4\" name=\"wellFormedXmlFailures.TestSurefire3\">\n"
             +
@@ -154,7 +203,7 @@ public class TestSuiteXmlParserTest
     public void testParser()
         throws Exception
     {
-        TestSuiteXmlParser parser = new TestSuiteXmlParser();
+        TestSuiteXmlParser parser = new TestSuiteXmlParser( consoleLogger );
 
         Collection<ReportTestSuite> oldResult = parser.parse(
             
"src/test/resources/fixture/testsuitexmlparser/TEST-org.apache.maven.surefire.test.FailingTest.xml"
 );
@@ -170,7 +219,7 @@ public class TestSuiteXmlParserTest
     public void successfulSurefireTestReport()
         throws Exception
     {
-        TestSuiteXmlParser parser = new TestSuiteXmlParser();
+        TestSuiteXmlParser parser = new TestSuiteXmlParser( consoleLogger );
         File surefireReport = new File( 
"src/test/resources/junit-pathWithÜmlaut/TEST-umlautTest.BasicTest.xml" );
         assumeTrue( surefireReport.isFile() );
         Collection<ReportTestSuite> suites = parser.parse( 
surefireReport.getCanonicalPath() );
@@ -203,7 +252,7 @@ public class TestSuiteXmlParserTest
     public void testParserHitsFailsafeSummary()
         throws Exception
     {
-        TestSuiteXmlParser parser = new TestSuiteXmlParser();
+        TestSuiteXmlParser parser = new TestSuiteXmlParser( consoleLogger );
 
         parser.parse( 
"src/test/resources/fixture/testsuitexmlparser/failsafe-summary.xml" );
 
@@ -283,7 +332,7 @@ public class TestSuiteXmlParserTest
     public void shouldParserEverythingInOrdinalTest()
         throws Exception
     {
-        TestSuiteXmlParser parser = new TestSuiteXmlParser();
+        TestSuiteXmlParser parser = new TestSuiteXmlParser( consoleLogger );
         List<ReportTestSuite> tests =
             parser.parse( 
"src/test/resources/fixture/testsuitexmlparser/TEST-surefire.MyTest.xml" );
         assertTrue( parser.isValid() );
@@ -347,7 +396,7 @@ public class TestSuiteXmlParserTest
     public void shouldParserEverythingInEnclosedTest()
         throws Exception
     {
-        TestSuiteXmlParser parser = new TestSuiteXmlParser();
+        TestSuiteXmlParser parser = new TestSuiteXmlParser( consoleLogger );
         List<ReportTestSuite> tests =
             parser.parse( 
"src/test/resources/fixture/testsuitexmlparser/TEST-surefire.MyTest-enclosed.xml"
 );
         assertTrue( parser.isValid() );
@@ -423,7 +472,7 @@ public class TestSuiteXmlParserTest
     public void shouldParserEverythingInEnclosedTrimStackTraceTest()
         throws Exception
     {
-        TestSuiteXmlParser parser = new TestSuiteXmlParser();
+        TestSuiteXmlParser parser = new TestSuiteXmlParser( consoleLogger );
         List<ReportTestSuite> tests = parser.parse( 
"src/test/resources/fixture/testsuitexmlparser/"
                                                         + 
"TEST-surefire.MyTest-enclosed-trimStackTrace.xml" );
         assertTrue( parser.isValid() );
@@ -465,7 +514,7 @@ public class TestSuiteXmlParserTest
     public void shouldParserEverythingInNestedClassTest()
         throws Exception
     {
-        TestSuiteXmlParser parser = new TestSuiteXmlParser();
+        TestSuiteXmlParser parser = new TestSuiteXmlParser( consoleLogger );
         List<ReportTestSuite> tests = parser.parse( 
"src/test/resources/fixture/testsuitexmlparser/"
                                                         + 
"TEST-surefire.MyTest-nestedClass.xml" );
         assertTrue( parser.isValid() );
@@ -532,7 +581,7 @@ public class TestSuiteXmlParserTest
     public void shouldParserEverythingInNestedClassTrimStackTraceTest()
         throws Exception
     {
-        TestSuiteXmlParser parser = new TestSuiteXmlParser();
+        TestSuiteXmlParser parser = new TestSuiteXmlParser( consoleLogger );
         List<ReportTestSuite> tests = parser.parse( 
"src/test/resources/fixture/testsuitexmlparser/"
                                                         + 
"TEST-surefire.MyTest-nestedClass-trimStackTrace.xml" );
         assertTrue( parser.isValid() );

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/6a79127a/surefire-setup-integration-tests/src/test/java/org/apache/maven/surefire/its/StagedLocalRepoHelper.java
----------------------------------------------------------------------
diff --git 
a/surefire-setup-integration-tests/src/test/java/org/apache/maven/surefire/its/StagedLocalRepoHelper.java
 
b/surefire-setup-integration-tests/src/test/java/org/apache/maven/surefire/its/StagedLocalRepoHelper.java
index 1252553..202d665 100644
--- 
a/surefire-setup-integration-tests/src/test/java/org/apache/maven/surefire/its/StagedLocalRepoHelper.java
+++ 
b/surefire-setup-integration-tests/src/test/java/org/apache/maven/surefire/its/StagedLocalRepoHelper.java
@@ -67,6 +67,8 @@ public final class StagedLocalRepoHelper
         Random entropy = new Random();
         try
         {
+            System.out.println( Settings.class.getClassLoader()
+                                        .getResource( 
"org/apache/maven/settings/Server.class" ) );
             Settings settings = new SettingsXpp3Reader().read( 
ReaderFactory.newXmlReader( originalSettingsXml ) );
 
             String localRepo = System.getProperty( "maven.repo.local" );

Reply via email to