maven-surefire git commit: [SUREFIRE-1254] add color messages
Repository: maven-surefire Updated Branches: refs/heads/master 7617fc089 -> b6d221295 [SUREFIRE-1254] add color messages Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/b6d22129 Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/b6d22129 Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/b6d22129 Branch: refs/heads/master Commit: b6d221295e3f0691413844cf023a56d514c035f5 Parents: 7617fc0 Author: Tibor17 Authored: Sat Sep 17 11:56:57 2016 +0200 Committer: Tibor17 Committed: Sat Sep 17 11:56:57 2016 +0200 -- .../java/org/apache/maven/plugin/surefire/report/TestSetStats.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/b6d22129/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java -- diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java index 90c6626..691c4b6 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java @@ -250,7 +250,7 @@ public class TestSetStats builder.a( COMMA ); if ( isSkipped ) { -builder.failure( SKIPPED ).warning( skipped ); +builder.warning( SKIPPED ).warning( skipped ); } else {
maven-surefire git commit: [SUREFIRE-1254] add color messages
Repository: maven-surefire Updated Branches: refs/heads/master ed27af4d2 -> 7617fc089 [SUREFIRE-1254] add color messages Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/7617fc08 Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/7617fc08 Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/7617fc08 Branch: refs/heads/master Commit: 7617fc089ffacda47ca3b66656ff30ba3bbf1d25 Parents: ed27af4 Author: Tibor17 Authored: Sat Sep 17 11:54:20 2016 +0200 Committer: Tibor17 Committed: Sat Sep 17 11:54:20 2016 +0200 -- .../java/org/apache/maven/plugin/surefire/report/TestSetStats.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/7617fc08/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java -- diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java index b96d961..90c6626 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java @@ -250,7 +250,7 @@ public class TestSetStats builder.a( COMMA ); if ( isSkipped ) { -builder.failure( SKIPPED ).failure( skipped ); +builder.failure( SKIPPED ).warning( skipped ); } else {
maven-surefire git commit: [SUREFIRE-1254] add color messages
Repository: maven-surefire Updated Branches: refs/heads/master c03f6ed5e -> ed27af4d2 [SUREFIRE-1254] add color messages Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/ed27af4d Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/ed27af4d Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/ed27af4d Branch: refs/heads/master Commit: ed27af4d260a9e5dc429a3a7ddafd11188bfe5d2 Parents: c03f6ed Author: Tibor17 Authored: Sat Sep 17 10:27:10 2016 +0200 Committer: Tibor17 Committed: Sat Sep 17 10:27:10 2016 +0200 -- .../apache/maven/plugin/surefire/report/TestSetStats.java | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/ed27af4d/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java -- diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java index 9fcfafe..b96d961 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java @@ -260,14 +260,7 @@ public class TestSetStats .a( reportEntry.getElapsedTimeVerbose() ); if ( isFailureOrError ) { -if ( isFailure ) -{ -builder.failure( FAILURE_MARKER ); -} -else -{ -builder.warning( FAILURE_MARKER ); -} +builder.failure( FAILURE_MARKER ); } builder.a( IN_MARKER ); return concatenateWithTestGroup( builder, reportEntry );
maven-surefire git commit: [SUREFIRE-1254] add color messages
Repository: maven-surefire Updated Branches: refs/heads/master 9b8d53861 -> c03f6ed5e [SUREFIRE-1254] add color messages Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/c03f6ed5 Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/c03f6ed5 Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/c03f6ed5 Branch: refs/heads/master Commit: c03f6ed5e31b16e503b56b650b98a8c333b084c7 Parents: 9b8d538 Author: Tibor17 Authored: Sat Sep 17 10:20:06 2016 +0200 Committer: Tibor17 Committed: Sat Sep 17 10:20:06 2016 +0200 -- .../maven/plugin/surefire/report/DefaultReporterFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/c03f6ed5/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java -- diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java index 0669763..b182f71 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java @@ -431,7 +431,7 @@ public class DefaultReporterFactory consoleLogger.warning( builder.warning( s ).toString() ); break; case SUCCESS: -consoleLogger.info( builder.info( s ).toString() ); +consoleLogger.info( builder.success( s ).toString() ); break; default: consoleLogger.info( builder.a( s ).toString() );
[5/5] maven-surefire git commit: [SUREFIRE-1254] add color messages
[SUREFIRE-1254] add color messages Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/6a79127a Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/6a79127a Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/6a79127a Branch: refs/heads/master Commit: 6a79127ab63273f0f1f5268c65e4806761871a46 Parents: 2c9edf0 Author: Tibor17 Authored: Fri Sep 16 22:56:10 2016 +0200 Committer: Tibor17 Committed: Sat Sep 17 00:53:49 2016 +0200 -- README.md | 4 +- maven-failsafe-plugin/pom.xml | 1 - .../plugin/failsafe/IntegrationTestMojo.java| 12 +- .../maven/plugin/failsafe/VerifyMojo.java | 64 +-- maven-surefire-common/pom.xml | 46 + .../plugin/surefire/AbstractSurefireMojo.java | 149 +-- .../maven/plugin/surefire/CommonReflector.java | 34 ++-- .../surefire/InPluginVMSurefireStarter.java | 41 +++-- .../surefire/StartupReportConfiguration.java| 18 +- .../surefire/SurefireDependencyResolver.java| 7 +- .../maven/plugin/surefire/SurefireHelper.java | 9 +- .../surefire/booterclient/ForkStarter.java | 39 ++-- .../surefire/booterclient/ProviderDetector.java | 101 +- .../booterclient/output/ForkClient.java | 77 +--- .../output/NativeStdErrStreamConsumer.java | 38 .../surefire/log/PluginConsoleLogger.java | 126 + .../plugin/surefire/report/ConsoleReporter.java | 79 .../surefire/report/DefaultReporterFactory.java | 141 ++ .../surefire/report/DirectConsoleOutput.java| 9 +- .../plugin/surefire/report/FileReporter.java| 37 +--- .../surefire/report/TestSetRunListener.java | 80 ++-- .../plugin/surefire/report/TestSetStats.java| 125 - .../maven/surefire/report/RunStatistics.java| 4 - .../maven/surefire/spi/ServiceLoader.java | 171 + .../plugin/surefire/SurefireReflectorTest.java | 1 + .../booterclient/ForkingRunListenerTest.java| 15 +- .../surefire/booterclient/MockReporter.java | 28 ++- .../TestSetMockReporterFactory.java | 6 +- .../report/DefaultReporterFactoryTest.java | 90 + .../apache/maven/surefire/JUnit4SuiteTest.java | 6 +- .../maven/surefire/spi/CustomizedImpl.java | 33 .../apache/maven/surefire/spi/DefaultImpl.java | 33 .../surefire/spi/EmptyServiceInterface.java | 30 +++ .../surefire/spi/ExistingServiceInterface.java | 30 +++ .../org/apache/maven/surefire/spi/IDefault.java | 33 .../maven/surefire/spi/NoServiceInterface.java | 30 +++ .../org/apache/maven/surefire/spi/SPITest.java | 89 + .../org/apache/maven/surefire/spi/SPImpl1.java | 44 + .../org/apache/maven/surefire/spi/SPImpl2.java | 44 + ...che.maven.surefire.spi.EmptyServiceInterface | 21 +++ maven.surefire.spi.ExistingServiceInterface | 24 +++ .../org.apache.maven.surefire.spi.IDefault | 22 +++ maven-surefire-plugin/pom.xml | 26 +++ .../maven/plugin/surefire/SurefirePlugin.java | 4 +- maven-surefire-plugin/src/site/apt/index.apt.vm | 4 + maven-surefire-report-plugin/pom.xml| 55 ++ .../report/AbstractSurefireReportMojo.java | 84 + .../surefire/report/FailsafeReportMojo.java | 2 +- .../surefire/report/PluginConsoleLogger.java| 140 ++ .../report/SurefireReportGenerator.java | 23 +-- .../surefire/report/Surefire597Test.java| 5 +- pom.xml | 6 + surefire-api/pom.xml| 4 + .../surefire/booter/BaseProviderFactory.java| 8 +- .../maven/surefire/booter/CommandReader.java| 24 ++- .../surefire/booter/ForkingRunListener.java | 96 -- .../surefire/booter/SurefireReflector.java | 23 ++- .../providerapi/ProviderParameters.java | 6 +- .../maven/surefire/report/ConsoleLogger.java| 33 .../surefire/report/ConsoleOutputCapture.java | 13 +- .../maven/surefire/report/ConsoleStream.java| 1 + .../surefire/report/DefaultConsoleReporter.java | 41 - .../report/DefaultDirectConsoleReporter.java| 11 +- .../maven/surefire/report/MockReporter.java | 183 --- .../maven/surefire/booter/ForkedBooter.java | 54 +++--- surefire-integration-tests/pom.xml | 47 + .../surefire/its/Junit47concurrencyIT.java | 4 +- .../maven/surefire/its/Not2xCompatible.java | 27 --- .../surefire/its/fixture/HelperAssertions.java | 8 +- .../Surefire1122ParallelAndFlakyTestsIT.java| 2 - ...urefire1136CwdPropagationInForkedModeIT.java | 3 - .../jiras/Surefire1158RemoveInfoLinesIT.java| 3 - ...e735Fork
[1/5] maven-surefire git commit: [SUREFIRE-1254] add color messages
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 @@ + org.apache.maven.surefire + surefire-logger-api + + org.apache.maven.shared maven-shared-utils http://git-w
[3/5] maven-surefire git commit: [SUREFIRE-1254] add color messages
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/6a79127a/maven-surefire-common/src/test/resources/META-INF/services/org.apache.maven.surefire.spi.IDefault -- diff --git a/maven-surefire-common/src/test/resources/META-INF/services/org.apache.maven.surefire.spi.IDefault b/maven-surefire-common/src/test/resources/META-INF/services/org.apache.maven.surefire.spi.IDefault new file mode 100644 index 000..09fbc28 --- /dev/null +++ b/maven-surefire-common/src/test/resources/META-INF/services/org.apache.maven.surefire.spi.IDefault @@ -0,0 +1,22 @@ +# +# 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. +# + + +org.apache.maven.surefire.spi.DefaultImpl +org.apache.maven.surefire.spi.CustomizedImpl http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/6a79127a/maven-surefire-plugin/pom.xml -- diff --git a/maven-surefire-plugin/pom.xml b/maven-surefire-plugin/pom.xml index 978ad1a..848922f 100644 --- a/maven-surefire-plugin/pom.xml +++ b/maven-surefire-plugin/pom.xml @@ -120,6 +120,32 @@ + +org.apache.maven.plugins +maven-shade-plugin + + +package + + shade + + + true + + + org.apache.maven.shared:maven-shared-utils + + + + + org.apache.maven.shared + org.apache.maven.surefire.shade.org.apache.maven.shared + + + + + + http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/6a79127a/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java -- diff --git a/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java b/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java index 291bf25..bfb68e0 100644 --- a/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java +++ b/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java @@ -31,6 +31,8 @@ import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.surefire.suite.RunResult; +import static org.apache.maven.plugin.surefire.SurefireHelper.reportExecution; + /** * Run tests using Surefire. * @@ -318,7 +320,7 @@ public class SurefirePlugin { assertNoException( firstForkException ); -SurefireHelper.reportExecution( this, summary, getLog() ); +reportExecution( this, summary, getConsoleLogger() ); } private void assertNoException( Exception firstForkException ) http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/6a79127a/maven-surefire-plugin/src/site/apt/index.apt.vm -- diff --git a/maven-surefire-plugin/src/site/apt/index.apt.vm b/maven-surefire-plugin/src/site/apt/index.apt.vm index 6774491..85c4d66 100644 --- a/maven-surefire-plugin/src/site/apt/index.apt.vm +++ b/maven-surefire-plugin/src/site/apt/index.apt.vm @@ -30,6 +30,10 @@ Maven ${thisPlugin} Plugin + + Requirements: Maven 2.2.1 or 3.x, and JDK 1.5 or higher. Due to wrong formatting of console text messages + in Maven Version prior to 3.1.0 it is highly recommended to use Maven 3.1.0 or higher. + #{if}(${project.artifactId}=="maven-surefire-plugin") The Surefire Plugin is used during the <<>> phase of the build lifecycle to execute the unit tests of an application. It generates reports http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/6a79127a/maven-surefire-report-plugin/pom.xml -- diff --git a/maven-surefire-report-plugin/pom.xml b/maven-surefire-report-plugin/pom.xml index 9fc60d7..e911c6e 100644 --- a/maven-surefire-report-plugin/pom.
[4/5] maven-surefire git commit: [SUREFIRE-1254] add color messages
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/6a79127a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/log/PluginConsoleLogger.java -- diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/log/PluginConsoleLogger.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/log/PluginConsoleLogger.java new file mode 100644 index 000..7884270 --- /dev/null +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/log/PluginConsoleLogger.java @@ -0,0 +1,126 @@ +package org.apache.maven.plugin.surefire.log; + +/* + * 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.plugin.logging.Log; +import org.apache.maven.plugin.surefire.log.api.ConsoleLogger; + +/** + * Wrapper logger of miscellaneous (Maven 2.2.1 or 3.1) implementations of {@link Log}. + * Calling {@link Log#isInfoEnabled()} before {@link Log#info(CharSequence)} due to Maven 2.2.1. + * + * @author mailto:tibordig...@apache.org";>Tibor Digana (tibor17) + * @since 2.19.2 + * @see ConsoleLogger + */ +public final class PluginConsoleLogger +implements ConsoleLogger +{ +private final Log mojoLogger; + +public PluginConsoleLogger( Log mojoLogger ) +{ +this.mojoLogger = mojoLogger; +} + +public boolean isDebugEnabled() +{ +return mojoLogger.isDebugEnabled(); +} + +public void debug( String message ) +{ +if ( mojoLogger.isDebugEnabled() ) +{ +mojoLogger.debug( message ); +} +} + +public void debug( CharSequence content, Throwable error ) +{ +if ( mojoLogger.isDebugEnabled() ) +{ +mojoLogger.debug( content, error ); +} +} + +public boolean isInfoEnabled() +{ +return mojoLogger.isInfoEnabled(); +} + +public void info( String message ) +{ +if ( mojoLogger.isInfoEnabled() ) +{ +mojoLogger.info( message ); +} +} + +public boolean isWarnEnabled() +{ +return mojoLogger.isWarnEnabled(); +} + +public void warning( String message ) +{ +if ( mojoLogger.isWarnEnabled() ) +{ +mojoLogger.warn( message ); +} +} + +public void warning( CharSequence content, Throwable error ) +{ +if ( mojoLogger.isWarnEnabled() ) +{ +mojoLogger.warn( content, error ); +} +} + +public boolean isErrorEnabled() +{ +return mojoLogger.isErrorEnabled(); +} + +public void error( String message ) +{ +if ( mojoLogger.isErrorEnabled() ) +{ +mojoLogger.error( message ); +} +} + +public void error( String message, Throwable t ) +{ +if ( mojoLogger.isErrorEnabled() ) +{ +mojoLogger.error( message, t ); +} +} + +public void error( Throwable t ) +{ +if ( mojoLogger.isErrorEnabled() ) +{ +mojoLogger.error( t ); +} +} +} http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/6a79127a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleReporter.java -- diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleReporter.java index 1fcf4b0..36f311b 100644 --- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleReporter.java +++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/ConsoleReporter.java @@ -19,12 +19,16 @@ package org.apache.maven.plugin.surefire.report; * under the License. */ -import java.io.BufferedOutputStream; -import java.io.OutputStreamWriter; -import java.io.PrintStream; -import java.io.PrintWriter; import java.util.List; + +import org.apache.maven.plugin.surefire.log.api.ConsoleLogger; +import org.apache.maven.shared.utils.logging.MessageBuilder; import
[2/5] maven-surefire git commit: [SUREFIRE-1254] add color messages
http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/6a79127a/surefire-integration-tests/src/test/resources/surefire-1122-parallel-and-flakyTests/pom.xml -- diff --git a/surefire-integration-tests/src/test/resources/surefire-1122-parallel-and-flakyTests/pom.xml b/surefire-integration-tests/src/test/resources/surefire-1122-parallel-and-flakyTests/pom.xml index 5fa0110..62ef251 100644 --- a/surefire-integration-tests/src/test/resources/surefire-1122-parallel-and-flakyTests/pom.xml +++ b/surefire-integration-tests/src/test/resources/surefire-1122-parallel-and-flakyTests/pom.xml @@ -20,15 +20,11 @@ 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";> 4.0.0 - -org.apache.maven.surefire -it-parent -1.0 -../pom.xml - + org.apache.maven.plugins.surefire jiras-surefire-1122 1.0 + junit @@ -37,10 +33,12 @@ test + maven-compiler-plugin +2.3.2 1.5 1.5 @@ -48,6 +46,7 @@ maven-surefire-plugin +${surefire.version} org.apache.maven.surefire http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/6a79127a/surefire-logger-api/pom.xml -- diff --git a/surefire-logger-api/pom.xml b/surefire-logger-api/pom.xml new file mode 100644 index 000..1e64159 --- /dev/null +++ b/surefire-logger-api/pom.xml @@ -0,0 +1,54 @@ + + +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/xsd/maven-4.0.0.xsd";> +4.0.0 + + +org.apache.maven.surefire +surefire +2.19.2-SNAPSHOT + + +surefire-logger-api + +SureFire Logger API + +Interfaces and Utilities related only to internal SureFire Logger API. Free of dependencies. + + + + UTF-8 + + + + +tibordigana +Tibor DigaÅa (tibor17) +tibordig...@apache.org + +PMC + +Europe/Bratislava + + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/6a79127a/surefire-logger-api/src/main/java/org/apache/maven/plugin/surefire/log/api/ConsoleLogger.java -- diff --git a/surefire-logger-api/src/main/java/org/apache/maven/plugin/surefire/log/api/ConsoleLogger.java b/surefire-logger-api/src/main/java/org/apache/maven/plugin/surefire/log/api/ConsoleLogger.java new file mode 100644 index 000..6baa7e3 --- /dev/null +++ b/surefire-logger-api/src/main/java/org/apache/maven/plugin/surefire/log/api/ConsoleLogger.java @@ -0,0 +1,64 @@ +package org.apache.maven.plugin.surefire.log.api; + +/* + * 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. + */ + +/** + * Allows providers to write console messages on the running maven process. + * + * This output is associated with the entire test run and not a specific + * test, which means it just goes "straight" to the console "immediately". + * + * s* + * + * This interface is used in org.apache.maven.plugin.surefire.CommonReflector and reflected + * via IsolatedClassLoader which can see classes from JRE only. This interface MUST use + * JRE types in method signatures, e.g. {@link String} or {@link Throwable}, etc. + * + */ +public interface ConsoleLogger +{ +void debug( String message ); + +void info( String message ); + +void warning( String message ); + +/** + * @param message message to log + */ +void error( String message ); + +/** + * Simply delegates to {@link #error(String) error( toString( t, message ) )}. + * + * @param message message to log + * @param texception, message and trace to log + */ +void error( St