Skip to content

Commit

Permalink
Merge pull request #3850 from jamezp/WFCORE-4553
Browse files Browse the repository at this point in the history
[WFCORE-4553] The IBM JVM requires the log manager to be set on the a…
  • Loading branch information
jmesnil committed Jul 16, 2019
2 parents e4f3afb + 1bc4782 commit 6080197
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 26 deletions.
3 changes: 1 addition & 2 deletions testsuite/client-old-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,13 @@
<redirectTestOutputToFile>${testLogToFile}</redirectTestOutputToFile>

<!-- System properties to forked surefire JVM which runs clients. -->
<argLine>${jvm.args.ip.client} ${jvm.args.timeouts} ${surefire.jacoco.args}</argLine>
<argLine>${jvm.args.ip.client} ${jvm.args.timeouts} ${surefire.jacoco.args} -Djava.util.logging.manager=org.jboss.logmanager.LogManager</argLine>

<environmentVariables>
<JBOSS_HOME>${wildfly.home}</JBOSS_HOME>
</environmentVariables>

<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<jboss.home>${wildfly.home}</jboss.home>
<jvm.args>-Dmaven.repo.local=${settings.localRepository} ${surefire.system.args} ${jvm.args.ip.server} ${jvm.args.security} ${jvm.args.other} ${jvm.args.timeouts} -Djbossas.ts.dir=${jbossas.ts.dir}</jvm.args>
</systemPropertyVariables>
Expand Down
6 changes: 2 additions & 4 deletions testsuite/domain/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,11 @@
<failIfNoTests>false</failIfNoTests>

<!-- System properties to forked surefire JVM which runs clients. -->
<argLine>${jvm.args.ip.client} ${jvm.args.timeouts} ${surefire.system.args}</argLine>
<argLine>${jvm.args.ip.client} ${jvm.args.timeouts} ${surefire.system.args} -Djava.util.logging.manager=org.jboss.logmanager.LogManager</argLine>

<systemPropertyVariables>
<jboss.options>-ea</jboss.options>
<cli.jvm.args>${modular.jdk.args}</cli.jvm.args>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<jboss.home>${project.basedir}/target/wildfly-core</jboss.home>
<module.path>${jboss.dist}/modules</module.path>
<jboss.test.host.master.address>${management.address}</jboss.test.host.master.address>
Expand Down Expand Up @@ -230,12 +229,11 @@
<redirectTestOutputToFile>${testLogToFile}</redirectTestOutputToFile>

<!-- System properties to forked surefire JVM which runs clients. -->
<argLine>${jvm.args.ip.client} ${jvm.args.timeouts} ${surefire.system.args}</argLine>
<argLine>${jvm.args.ip.client} ${jvm.args.timeouts} ${surefire.system.args} -Djava.util.logging.manager=org.jboss.logmanager.LogManager</argLine>

<systemPropertyVariables>
<jboss.options>-ea</jboss.options>
<cli.jvm.args>${modular.jdk.args}</cli.jvm.args>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<jboss.home>${project.basedir}/target/wildfly-core</jboss.home>
<module.path>${jboss.dist}/modules</module.path>
<jboss.test.host.master.address>${management.address}</jboss.test.host.master.address>
Expand Down
4 changes: 2 additions & 2 deletions testsuite/embedded/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>

<argLine>-Djava.util.logging.manager=org.jboss.logmanager.LogManager</argLine>

<environmentVariables>
<JBOSS_HOME>${wildfly.home}</JBOSS_HOME>
</environmentVariables>

<systemPropertyVariables>
<jboss.home>${wildfly.home}</jboss.home>
<!-- Default the log manager and jboss-logging to use JUL -->
<java.util.logging.manager>java.util.logging.LogManager</java.util.logging.manager>
<org.jboss.logging.provider>jdk</org.jboss.logging.provider>
<jboss.test.start.timeout>${jboss.test.start.timeout}</jboss.test.start.timeout>
<jboss.test.log.dir>${project.build.directory}${file.separator}test-logs</jboss.test.log.dir>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.util.concurrent.TimeoutException;
import java.util.function.Function;

import org.jboss.as.test.shared.TestSuiteEnvironment;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
Expand Down Expand Up @@ -160,6 +161,12 @@ private void test(final EmbeddedManagedProcess server, final String filename, fi
}
} finally {
server.stop();
// We want to delete the log file in case another test checks for the same file. However on Windows the
// log manager would still have the file open and the delete will fail. For Windows we need to ignore the
// deleting the file to avoid the file lock failure.
if (!TestSuiteEnvironment.isWindows()) {
Files.deleteIfExists(logFile);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@

package org.wildfly.core.test.embedded.host.controller;

import org.junit.Assume;
import java.io.InputStream;
import java.util.logging.LogManager;

import org.junit.Assert;
import org.junit.Test;
import org.wildfly.core.embedded.Configuration;
import org.wildfly.core.test.embedded.LoggingTestCase;
Expand All @@ -32,12 +35,17 @@ public class JBossLogManagerHostControllerTestCase extends LoggingTestCase {

@Test
public void testLogManager() throws Exception {
// The IBM JDK creates a logger early on doesn't allow the JBoss Log Manager to be used. For now we will ignore
// the test when the IBM JDK is being used.
Assume.assumeFalse(isIbmJdk());
System.setProperty("test.log.file", "test-standalone-jbl.log");
System.setProperty("logging.configuration", getClass().getResource("/logging.properties").toExternalForm());
System.setProperty("test.log.file", "test-hc-jbl.log");
// The IBM JVM creates a logger early on and requires the log manager to be reconfigured
if (isIbmJdk()) {
// We need to reconfigure logging as the log manager is likely already setup
try (InputStream in = getClass().getResourceAsStream("/jbl-logging.properties")) {
Assert.assertNotNull("Failed to find the logging.properties file", in);
LogManager.getLogManager().readConfiguration(in);
}
}
System.setProperty("logging.configuration", getClass().getResource("/jbl-logging.properties").toExternalForm());
System.setProperty("java.util.logging.manager", "org.jboss.logmanager.LogManager");
testHostController(Configuration.LoggerHint.JBOSS_LOG_MANAGER, "test-standalone-jbl.log", "[jboss-logmanager]");
testHostController(Configuration.LoggerHint.JBOSS_LOG_MANAGER, "test-hc-jbl.log", "[jboss-logmanager]");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@

package org.wildfly.core.test.embedded.standalone;

import org.junit.Assume;
import java.io.InputStream;
import java.util.logging.LogManager;

import org.junit.Assert;
import org.junit.Test;
import org.wildfly.core.embedded.Configuration;
import org.wildfly.core.test.embedded.LoggingTestCase;
Expand All @@ -32,11 +35,16 @@ public class JBossLogManagerStandaloneTestCase extends LoggingTestCase {

@Test
public void testLogManager() throws Exception {
// The IBM JDK creates a logger early on doesn't allow the JBoss Log Manager to be used. For now we will ignore
// the test when the IBM JDK is being used.
Assume.assumeFalse(isIbmJdk());
System.setProperty("test.log.file", "test-standalone-jbl.log");
System.setProperty("logging.configuration", getClass().getResource("/logging.properties").toExternalForm());
// The IBM JVM creates a logger early on and requires the log manager to be reconfigured
if (isIbmJdk()) {
// We need to reconfigure logging as the log manager is likely already setup
try (InputStream in = getClass().getResourceAsStream("/jbl-logging.properties")) {
Assert.assertNotNull("Failed to find the logging.properties file", in);
LogManager.getLogManager().readConfiguration(in);
}
}
System.setProperty("logging.configuration", getClass().getResource("/jbl-logging.properties").toExternalForm());
System.setProperty("java.util.logging.manager", "org.jboss.logmanager.LogManager");
testStandalone(Configuration.LoggerHint.JBOSS_LOG_MANAGER, "test-standalone-jbl.log", "[jboss-logmanager]");
}
Expand Down
3 changes: 1 addition & 2 deletions testsuite/manualmode/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@

<!-- Parameters to test cases. -->
<systemPropertyVariables combine.children="append">
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<byteman.server.ipaddress>${node0}</byteman.server.ipaddress>
<byteman.server.port>${byteman.port}</byteman.server.port>
<jboss.home>${wildfly.home}</jboss.home>
Expand All @@ -207,7 +206,7 @@
<environmentVariables>
<JBOSS_HOME>${wildfly.home}</JBOSS_HOME>
</environmentVariables>
<argLine>-Dmaven.repo.local=${settings.localRepository} ${surefire.system.args}</argLine>
<argLine>-Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dmaven.repo.local=${settings.localRepository} ${surefire.system.args}</argLine>
</configuration>
</plugin>
<plugin>
Expand Down
2 changes: 1 addition & 1 deletion testsuite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,8 @@
<configuration>
<failIfNoTests>false</failIfNoTests>
<redirectTestOutputToFile>${testLogToFile}</redirectTestOutputToFile>
<argLine>-Djava.util.logging.manager=org.jboss.logmanager.LogManager</argLine>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<jboss.dist>${jboss.dist}</jboss.dist>
<jboss.home>${basedir}/target/wildfly-core</jboss.home>
<org.wildfly.test.kill-servers-before-test>${org.wildfly.test.kill-servers-before-test}</org.wildfly.test.kill-servers-before-test>
Expand Down
2 changes: 1 addition & 1 deletion testsuite/scripts/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Djava.util.logging.manager=org.jboss.logmanager.LogManager</argLine>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<org.jboss.logging.provider>jboss</org.jboss.logging.provider>
<test.log.level>${test.log.level}</test.log.level>
<test.log.file>${test.log.file}</test.log.file>
Expand Down
3 changes: 1 addition & 2 deletions testsuite/standalone/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,13 @@
<redirectTestOutputToFile>${testLogToFile}</redirectTestOutputToFile>

<!-- System properties to forked surefire JVM which runs clients. -->
<argLine>${jvm.args.ip.client} ${jvm.args.timeouts} ${surefire.system.args}</argLine>
<argLine>${jvm.args.ip.client} ${jvm.args.timeouts} ${surefire.system.args} -Djava.util.logging.manager=org.jboss.logmanager.LogManager</argLine>

<environmentVariables>
<JBOSS_HOME>${wildfly.home}</JBOSS_HOME>
</environmentVariables>

<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<cli.jvm.args>${modular.jdk.args} -Dmaven.repo.local=${settings.localRepository}</cli.jvm.args>
<jboss.home>${wildfly.home}</jboss.home>
<!-- This is required so JBoss Modules knows which repository to use -->
Expand Down

0 comments on commit 6080197

Please sign in to comment.