Improve test output
Project: http://git-wip-us.apache.org/repos/asf/karaf/repo Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/cb061048 Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/cb061048 Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/cb061048 Branch: refs/heads/master Commit: cb0610482fd979ea6536ae0fc4e608789790b710 Parents: fd9ceb7 Author: Christian Schneider <[email protected]> Authored: Fri May 19 16:41:46 2017 +0200 Committer: Christian Schneider <[email protected]> Committed: Fri May 19 16:41:46 2017 +0200 ---------------------------------------------------------------------- .../src/test/java/org/apache/karaf/itests/KarafTestSupport.java | 5 ++--- .../src/test/java/org/apache/karaf/itests/KarafTestWatcher.java | 5 ++++- itests/src/test/resources/log4j.properties | 3 +-- 3 files changed, 7 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/karaf/blob/cb061048/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java ---------------------------------------------------------------------- diff --git a/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java b/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java index 009431e..f73d4a5 100644 --- a/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java +++ b/itests/src/test/java/org/apache/karaf/itests/KarafTestSupport.java @@ -16,6 +16,7 @@ package org.apache.karaf.itests; import static org.junit.Assert.assertTrue; import static org.ops4j.pax.exam.CoreOptions.maven; import static org.ops4j.pax.exam.CoreOptions.mavenBundle; +import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureSecurity; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut; import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration; @@ -67,7 +68,6 @@ import org.junit.runner.Description; import org.junit.runners.model.Statement; import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.CoreOptions; import org.ops4j.pax.exam.Option; import org.ops4j.pax.exam.ProbeBuilder; import org.ops4j.pax.exam.RerunTestException; @@ -142,8 +142,6 @@ public class KarafTestSupport { return new Statement() { @Override public void evaluate() throws Throwable { - Throwable caughtThrowable = null; - // implement retry logic here // retry once to honor the FeatureService refresh try { @@ -195,6 +193,7 @@ public class KarafTestSupport { karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")), // enable JMX RBAC security, thanks to the KarafMBeanServerBuilder configureSecurity().disableKarafMBeanServerBuilder(), + configureConsole().ignoreLocalConsole(), keepRuntimeFolder(), logLevel(LogLevel.INFO), mavenBundle().groupId("org.awaitility").artifactId("awaitility").versionAsInProject(), http://git-wip-us.apache.org/repos/asf/karaf/blob/cb061048/itests/src/test/java/org/apache/karaf/itests/KarafTestWatcher.java ---------------------------------------------------------------------- diff --git a/itests/src/test/java/org/apache/karaf/itests/KarafTestWatcher.java b/itests/src/test/java/org/apache/karaf/itests/KarafTestWatcher.java index 953dbb3..2e6ea47 100644 --- a/itests/src/test/java/org/apache/karaf/itests/KarafTestWatcher.java +++ b/itests/src/test/java/org/apache/karaf/itests/KarafTestWatcher.java @@ -19,12 +19,15 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class KarafTestWatcher extends TestWatcher { + public static final String ANSI_RESET = "\u001B[0m"; + public static final String ANSI_GREEN = "\u001B[32m"; private static final Logger LOG = LoggerFactory.getLogger(KarafTestWatcher.class); @Override protected void starting(Description description) { - LOG.info(">>>>>> {} <<<<<" , description.getDisplayName()); + System.out.println(); + System.out.println(ANSI_GREEN + description.getTestClass().getSimpleName() + ": " + description.getMethodName() + ANSI_RESET); } @Override http://git-wip-us.apache.org/repos/asf/karaf/blob/cb061048/itests/src/test/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/itests/src/test/resources/log4j.properties b/itests/src/test/resources/log4j.properties index a75bae2..51d6f31 100644 --- a/itests/src/test/resources/log4j.properties +++ b/itests/src/test/resources/log4j.properties @@ -23,8 +23,7 @@ log4j.rootLogger=INFO, console, file # Console will only display warnings log4j.appender.console=org.apache.log4j.ConsoleAppender log4j.appender.console.layout=org.apache.log4j.PatternLayout -log4j.appender.console.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %-32.32C %4L | %m%n -log4j.appender.console.threshold=WARN +log4j.appender.console.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-32.32C %4L | %m%n # File appender will contain all info messages log4j.appender.file=org.apache.log4j.FileAppender
