diff --git a/examples/karaf-itest-example/pom.xml b/examples/karaf-itest-example/pom.xml index e9b93bf5c5..0d7ebf27f5 100644 --- a/examples/karaf-itest-example/pom.xml +++ b/examples/karaf-itest-example/pom.xml @@ -88,6 +88,12 @@ 1.3_1 runtime + + org.ops4j.pax.logging + pax-logging-log4j2-extra + 1.11.2 + test + @@ -104,6 +110,31 @@ + + org.apache.maven.plugins + maven-dependency-plugin + 3.1.1 + + + copy + validate + + copy + + + + + org.ops4j.pax.logging + pax-logging-log4j2-extra + jar + false + ${project.build.directory}/test-classes/dependencies + + + + + + diff --git a/examples/karaf-itest-example/src/test/java/org/apache/karaf/examples/itests/ExampleITest.java b/examples/karaf-itest-example/src/test/java/org/apache/karaf/examples/itests/ExampleITest.java index 13f70fd954..eefec6edbb 100644 --- a/examples/karaf-itest-example/src/test/java/org/apache/karaf/examples/itests/ExampleITest.java +++ b/examples/karaf-itest-example/src/test/java/org/apache/karaf/examples/itests/ExampleITest.java @@ -28,6 +28,7 @@ import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; import org.ops4j.pax.exam.spi.reactors.PerClass; import java.io.File; +import java.net.URISyntaxException; import static org.ops4j.pax.exam.CoreOptions.maven; import static org.ops4j.pax.exam.CoreOptions.mavenBundle; @@ -54,6 +55,14 @@ public class ExampleITest extends KarafTestSupport { localRepository = ""; } + final File startupCfg; + final File log4j2extra; + try { + startupCfg = new File(getClass().getResource("/etc/startup.properties").toURI()); + log4j2extra = new File(getClass().getResource("/dependencies/pax-logging-log4j2-extra-1.11.2.jar").toURI()); + } catch (URISyntaxException e) { + throw new RuntimeException(e); + } if (JavaVersionUtil.getMajorVersion() >= 9) { return new Option[]{ //KarafDistributionOption.debugConfiguration("8889", true), @@ -99,6 +108,8 @@ public class ExampleITest extends KarafTestSupport { new VMOption("lib/jdk9plus/*" + File.pathSeparator + "lib/boot/*") }; } else { + + return new Option[]{ //KarafDistributionOption.debugConfiguration("8889", true), karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")), @@ -106,7 +117,7 @@ public class ExampleITest extends KarafTestSupport { configureSecurity().disableKarafMBeanServerBuilder(), // configureConsole().ignoreLocalConsole(), keepRuntimeFolder(), - logLevel(LogLevelOption.LogLevel.INFO), + logLevel(LogLevelOption.LogLevel.DEBUG), mavenBundle().groupId("org.awaitility").artifactId("awaitility").versionAsInProject(), mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.hamcrest").versionAsInProject(), mavenBundle().groupId("org.apache.karaf.itests").artifactId("common").versionAsInProject(), @@ -114,6 +125,8 @@ public class ExampleITest extends KarafTestSupport { editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiRegistryPort", rmiRegistryPort), editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiServerPort", rmiServerPort), editConfigurationFilePut("etc/org.apache.karaf.shell.cfg", "sshPort", sshPort), + replaceConfigurationFile("etc/startup.properties", startupCfg), + replaceConfigurationFile("system/org/ops4j/pax/logging/pax-logging-log4j2-extra/1.11.2/pax-logging-log4j2-extra-1.11.2.jar", log4j2extra), editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.localRepository", localRepository) }; }