From dd3262896fb10d57679979b8354bb8648ade140d Mon Sep 17 00:00:00 2001 From: gchuf Date: Thu, 7 May 2026 14:43:24 +0200 Subject: [PATCH 01/10] ARTEMIS-6116 Remove basedir from activemq-surefire-argline Ensures that the "basedir" system property is only configured once --- pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/pom.xml b/pom.xml index c9850b5e4c7..569f89bad12 100644 --- a/pom.xml +++ b/pom.xml @@ -269,7 +269,6 @@ -Djava.library.path="${activemq.basedir}/target/bin/lib/linux-x86_64:${activemq.basedir}/target/bin/lib/linux-i686" -Djgroups.bind_addr=localhost -Djava.net.preferIPv4Stack=true - -Dbasedir=${basedir} -Djdk.attach.allowAttachSelf=true -Dartemis.distribution.output="${artemis.distribution.output}" -Dlog4j2.configurationFile="file:${activemq.basedir}/tests/config/${logging.config}" From 2e8ba03514bddb12071525688d8a5d059e168104 Mon Sep 17 00:00:00 2001 From: gchuf Date: Thu, 7 May 2026 14:44:00 +0200 Subject: [PATCH 02/10] ARTEMIS-6116 Remove file prefix from activemq-surefire-argline --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 569f89bad12..9b59341939e 100644 --- a/pom.xml +++ b/pom.xml @@ -271,7 +271,7 @@ -Djava.net.preferIPv4Stack=true -Djdk.attach.allowAttachSelf=true -Dartemis.distribution.output="${artemis.distribution.output}" - -Dlog4j2.configurationFile="file:${activemq.basedir}/tests/config/${logging.config}" + -Dlog4j2.configurationFile="${activemq.basedir}/tests/config/${logging.config}" ${project.basedir} false From e414bce83ec58b3322bd2bbc243ac06d6e933f6c Mon Sep 17 00:00:00 2001 From: gchuf Date: Thu, 7 May 2026 14:49:46 +0200 Subject: [PATCH 03/10] ARTEMIS-6116 Fix NetworkHealthTest for Windows Reduce network timeout checked because windows reports lower timeouts --- .../activemq/artemis/utils/NetworkHealthTest.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/NetworkHealthTest.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/NetworkHealthTest.java index f3508008ef2..0d84690864e 100644 --- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/NetworkHealthTest.java +++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/NetworkHealthTest.java @@ -327,12 +327,18 @@ public boolean purePing(InetAddress address) throws IOException, InterruptedExce @Test @Timeout(30) public void testPurePingTimeout() throws Exception { - NetworkHealthCheck check = new NetworkHealthCheck(null, 100, 2000); + int timeout = 2000; + + // Add a "tolerance" for Windows, since it reports less time spent in timeout than the networkTimeout parameter (around 200ms) + int tolerance = 500; + + NetworkHealthCheck check = new NetworkHealthCheck(null, 100, timeout); long time = System.currentTimeMillis(); //[RFC1166] reserves the address block 192.0.2.0/24 for test. assertFalse(check.purePing(InetAddress.getByName("192.0.2.0"))); - assertTrue(System.currentTimeMillis() - time >= 2000); + + assertTrue(System.currentTimeMillis() - time >= (timeout - tolerance)); } } From 2c8bf9310fb8bbbd6aad59d8c66b38b85abc4560 Mon Sep 17 00:00:00 2001 From: gchuf Date: Thu, 7 May 2026 22:07:11 +0200 Subject: [PATCH 04/10] ARTEMIS-6116 Fix "cannot delete resources" error --- .../artemis/core/config/impl/ConfigurationImplTest.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java index 6d43db8f4b7..b878681dba7 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImplTest.java @@ -2969,12 +2969,15 @@ public void testRegxPropertiesFilesInDir() throws Exception { File tmpFile = File.createTempFile("a_stuff", ".properties", temporaryFolder); Properties properties = new Properties(); properties.put("name", "a"); - properties.store(new FileOutputStream(tmpFile), null); - + try (FileOutputStream out = new FileOutputStream(tmpFile)) { + properties.store(out, null); + } tmpFile = File.createTempFile("b_stuff", ".0-properties", temporaryFolder); properties = new Properties(); properties.put("name", "0"); - properties.store(new FileOutputStream(tmpFile), null); + try (FileOutputStream out = new FileOutputStream(tmpFile)) { + properties.store(out, null); + } ConfigurationImpl configuration = new ConfigurationImpl(); configuration.parseProperties(temporaryFolder + "/"); From 59f063bfb6f183e7457920de5fd827630b5595df Mon Sep 17 00:00:00 2001 From: gchuf Date: Thu, 7 May 2026 22:16:32 +0200 Subject: [PATCH 05/10] ARTEMIS-6116 Use USERPROFILE on windows --- .../org/apache/activemq/artemis/dto/XmlUtilTest.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/artemis-dto/src/test/java/org/apache/activemq/artemis/dto/XmlUtilTest.java b/artemis-dto/src/test/java/org/apache/activemq/artemis/dto/XmlUtilTest.java index c2dac261303..aa5d800493c 100644 --- a/artemis-dto/src/test/java/org/apache/activemq/artemis/dto/XmlUtilTest.java +++ b/artemis-dto/src/test/java/org/apache/activemq/artemis/dto/XmlUtilTest.java @@ -30,13 +30,18 @@ public class XmlUtilTest extends ArtemisTestCase { @Test - public void testPropertySubstituion(@TempDir Path tempDir) throws Exception { + public void testPropertySubstitution(@TempDir Path tempDir) throws Exception { final String SYSTEM_PROP_NAME = getTestMethodName() + "SysPropName"; final String SYSTEM_PROP_VALUE = getTestMethodName() + "SysPropValue"; System.setProperty(SYSTEM_PROP_NAME, SYSTEM_PROP_VALUE); // since System.getenv() returns an immutable Map we rely here on an environment variable that is likely to exist - final String ENV_VAR_NAME = "HOME"; + String ENV_VAR_NAME = "HOME"; + + // override to USERPROFILE if OS is windows + if (System.getProperty("os.name").toLowerCase().contains("win")) { + ENV_VAR_NAME = "USERPROFILE"; + } BrokerDTO brokerDTO = getBrokerDTO(tempDir, SYSTEM_PROP_NAME, ENV_VAR_NAME); assertEquals(SYSTEM_PROP_VALUE, ((JaasSecurityDTO)brokerDTO.security).domain); @@ -44,7 +49,7 @@ public void testPropertySubstituion(@TempDir Path tempDir) throws Exception { } @Test - public void testPropertySubstituionPrecedence(@TempDir Path tempDir) throws Exception { + public void testPropertySubstitutionPrecedence(@TempDir Path tempDir) throws Exception { final String SYSTEM_PROP_NAME = "HOME"; final String SYSTEM_PROP_VALUE = getTestMethodName() + "SysPropValue"; System.setProperty(SYSTEM_PROP_NAME, SYSTEM_PROP_VALUE); From 5fca20fe7b09f6688c033c749760d606bd21a8c3 Mon Sep 17 00:00:00 2001 From: gchuf Date: Thu, 7 May 2026 22:23:54 +0200 Subject: [PATCH 06/10] ARTEMIS-6116 Replace line endings for stderr --- .../artemis/cli/commands/messages/ProducerThreadTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/artemis-cli/src/test/java/org/apache/activemq/artemis/cli/commands/messages/ProducerThreadTest.java b/artemis-cli/src/test/java/org/apache/activemq/artemis/cli/commands/messages/ProducerThreadTest.java index 813dbf46446..2d2d1b83340 100644 --- a/artemis-cli/src/test/java/org/apache/activemq/artemis/cli/commands/messages/ProducerThreadTest.java +++ b/artemis-cli/src/test/java/org/apache/activemq/artemis/cli/commands/messages/ProducerThreadTest.java @@ -225,7 +225,7 @@ public void testBadMessagePropertyType() throws Exception { producer.setProperties(createJsonProperty("myType", "myKey", "myValue")); producer.applyProperties(mockMessage); - assertEquals("Unable to set property: myKey. Did not recognize type: myType. Supported types are: boolean, int, long, byte, short, float, double, string.\n", context.getStderr()); + assertEquals("Unable to set property: myKey. Did not recognize type: myType. Supported types are: boolean, int, long, byte, short, float, double, string." + System.lineSeparator(), context.getStderr()); } private static String createJsonProperty(String type, String key, String value) { From 9d8eb3195c8d995b3dc173bb38b5b8195119d97c Mon Sep 17 00:00:00 2001 From: gchuf Date: Sat, 20 Jun 2026 11:07:00 +0200 Subject: [PATCH 07/10] ARTEMIS-6116 Add non-Posix file permissions check for Windows --- .../artemis/cli/commands/ShellTest.java | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/artemis-cli/src/test/java/org/apache/activemq/artemis/cli/commands/ShellTest.java b/artemis-cli/src/test/java/org/apache/activemq/artemis/cli/commands/ShellTest.java index 6060c4d9147..1dc2a5efaac 100644 --- a/artemis-cli/src/test/java/org/apache/activemq/artemis/cli/commands/ShellTest.java +++ b/artemis-cli/src/test/java/org/apache/activemq/artemis/cli/commands/ShellTest.java @@ -98,17 +98,23 @@ private static void executeShell(String input, File outputHistory) throws Interr assertTrue(outputHistory.exists()); - // Validate file permissions are 600 (owner read/write only) - Set permissions = Files.getPosixFilePermissions(outputHistory.toPath()); - assertTrue(permissions.contains(PosixFilePermission.OWNER_READ), "File should be readable by owner"); - assertTrue(permissions.contains(PosixFilePermission.OWNER_WRITE), "File should be writable by owner"); - // Explicitly verify group and others cannot read - assertFalse(permissions.contains(PosixFilePermission.GROUP_READ), "File should not be readable by group"); - assertFalse(permissions.contains(PosixFilePermission.GROUP_WRITE), "File should not be writable by group"); - assertFalse(permissions.contains(PosixFilePermission.GROUP_EXECUTE), "File should not be executable by group"); - assertFalse(permissions.contains(PosixFilePermission.OTHERS_READ), "File should not be readable by others"); - assertFalse(permissions.contains(PosixFilePermission.OTHERS_WRITE), "File should not be writable by others"); - assertFalse(permissions.contains(PosixFilePermission.OTHERS_EXECUTE), "File should not be executable by others"); + // Validate file permissions are 600 on unix-type systems (owner read/write only) + if (Files.getFileStore(outputHistory.toPath()).supportsFileAttributeView("posix")) { + Set permissions = Files.getPosixFilePermissions(outputHistory.toPath()); + assertTrue(permissions.contains(PosixFilePermission.OWNER_READ), "File should be readable by owner"); + assertTrue(permissions.contains(PosixFilePermission.OWNER_WRITE), "File should be writable by owner"); + // Explicitly verify group and others cannot read + assertFalse(permissions.contains(PosixFilePermission.GROUP_READ), "File should not be readable by group"); + assertFalse(permissions.contains(PosixFilePermission.GROUP_WRITE), "File should not be writable by group"); + assertFalse(permissions.contains(PosixFilePermission.GROUP_EXECUTE), "File should not be executable by group"); + assertFalse(permissions.contains(PosixFilePermission.OTHERS_READ), "File should not be readable by others"); + assertFalse(permissions.contains(PosixFilePermission.OTHERS_WRITE), "File should not be writable by others"); + assertFalse(permissions.contains(PosixFilePermission.OTHERS_EXECUTE), "File should not be executable by others"); + } else { + // Fallback for Windows: Verify owner can read/write + assertTrue(outputHistory.canRead(), "File should be readable"); + assertTrue(outputHistory.canWrite(), "File should be writable"); + } } finally { System.clearProperty("artemis.instance"); From 0c75dc8c6497af672f0fe189ccd19f1058dd9214 Mon Sep 17 00:00:00 2001 From: gchuf Date: Sat, 20 Jun 2026 12:16:42 +0200 Subject: [PATCH 08/10] ARTEMIS-6116 WebServerComponentTest fixes for windows Fixes issues related to backslashes --- .../cli/test/WebServerComponentTest.java | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/artemis-web/src/test/java/org/apache/activemq/cli/test/WebServerComponentTest.java b/artemis-web/src/test/java/org/apache/activemq/cli/test/WebServerComponentTest.java index 3f7b83fe64b..de7331d6370 100644 --- a/artemis-web/src/test/java/org/apache/activemq/cli/test/WebServerComponentTest.java +++ b/artemis-web/src/test/java/org/apache/activemq/cli/test/WebServerComponentTest.java @@ -34,6 +34,7 @@ import java.net.URL; import java.net.http.HttpClient; import java.nio.file.Files; +import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardCopyOption; import java.util.ArrayList; @@ -51,7 +52,6 @@ import java.util.jar.JarEntry; import java.util.jar.JarOutputStream; import java.util.jar.Manifest; -import java.util.regex.Pattern; import io.netty.bootstrap.Bootstrap; import io.netty.channel.Channel; @@ -102,7 +102,6 @@ import org.apache.http.ssl.SSLContextBuilder; import org.eclipse.jetty.ee9.webapp.WebAppContext; import org.eclipse.jetty.ee9.webapp.WebInfConfiguration; -import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.util.thread.ThreadPool; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -126,9 +125,18 @@ public class WebServerComponentTest extends ArtemisTestCase { static final String URL = System.getProperty("url", "http://localhost:8161/WebServerComponentTest.txt"); static final String SECURE_URL = System.getProperty("url", "https://localhost:8448/WebServerComponentTest.txt"); - static final String KEY_STORE_PATH = WebServerComponentTest.class.getClassLoader().getResource("server-keystore.p12").getFile(); + private static String getResourcePath(String resourceName) { + try { + URI uri = WebServerComponentTest.class.getClassLoader().getResource(resourceName).toURI(); + return Path.of(uri).toString(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + static final String KEY_STORE_PATH = getResourcePath("server-keystore.p12"); - static final String PEM_KEY_STORE_PATH = WebServerComponentTest.class.getClassLoader().getResource("server-keystore.pemcfg").getFile(); + static final String PEM_KEY_STORE_PATH = getResourcePath("server-keystore.pemcfg"); static final String KEY_STORE_PASSWORD = "securepass"; @@ -658,9 +666,13 @@ private void testSSLAutoReloadPemConfigSources(boolean useSymbolicLinks) throws sourceCert = serverCertFile.getAbsolutePath(); } + // Normalize paths to forward slashes + String sourceKeyPath = sourceKey.replace("\\", "/"); + String sourceCertPath = sourceCert.replace("\\", "/"); + Files.write(serverPemConfigFile.toPath(), Arrays.asList(new String[]{ - "source.key=" + sourceKey, - "source.cert=" + sourceCert + "source.key=" + sourceKeyPath, + "source.cert=" + sourceCertPath })); String keyStorePath; @@ -762,10 +774,11 @@ public HttpRoute determineRoute(HttpHost host, public void simpleSecureServerWithClientAuth() throws Exception { BindingDTO bindingDTO = new BindingDTO(); bindingDTO.uri = "https://localhost:0"; - bindingDTO.setKeyStorePath(KEY_STORE_PATH); + String keyStorePath = KEY_STORE_PATH.replace("\\", "/"); + bindingDTO.setKeyStorePath(keyStorePath); bindingDTO.setKeyStorePassword(KEY_STORE_PASSWORD); bindingDTO.setClientAuth(true); - bindingDTO.setTrustStorePath(KEY_STORE_PATH); + bindingDTO.setTrustStorePath(keyStorePath); bindingDTO.setTrustStorePassword(KEY_STORE_PASSWORD); if (System.getProperty("java.vendor").contains("IBM")) { //By default on IBM Java 8 JVM, org.eclipse.jetty.util.ssl.SslContextFactory doesn't include TLSv1.2 From bf5d341de5d596917107f9c0cab6a9155c9949a8 Mon Sep 17 00:00:00 2001 From: gchuf Date: Sat, 20 Jun 2026 12:20:49 +0200 Subject: [PATCH 09/10] ARTEMIS-6116 Remove JDK8 IBM related checks --- .../cli/test/WebServerComponentTest.java | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/artemis-web/src/test/java/org/apache/activemq/cli/test/WebServerComponentTest.java b/artemis-web/src/test/java/org/apache/activemq/cli/test/WebServerComponentTest.java index de7331d6370..af06e9b36d5 100644 --- a/artemis-web/src/test/java/org/apache/activemq/cli/test/WebServerComponentTest.java +++ b/artemis-web/src/test/java/org/apache/activemq/cli/test/WebServerComponentTest.java @@ -360,15 +360,6 @@ private WebServerComponent startSimpleSecureServer(Boolean sniHostCheck, Boolean private WebServerComponent startSimpleSecureServer(BindingDTO bindingDTO) throws Exception { bindingDTO.setUri("https://localhost:0"); - if (System.getProperty("java.vendor").contains("IBM")) { - //By default on IBM Java 8 JVM, org.eclipse.jetty.util.ssl.SslContextFactory doesn't include TLSv1.2 - // while it excludes all TLSv1 and TLSv1.1 cipher suites. - bindingDTO.setIncludedTLSProtocols("TLSv1.2"); - // Remove excluded cipher suites matching the prefix `SSL` because the names of the IBM Java 8 JVM cipher suites - // have the prefix `SSL` while the `DEFAULT_EXCLUDED_CIPHER_SUITES` of org.eclipse.jetty.util.ssl.SslContextFactory - // includes "^SSL_.*$". So all IBM JVM cipher suites are excluded by SslContextFactory using the `DEFAULT_EXCLUDED_CIPHER_SUITES`. - bindingDTO.setExcludedCipherSuites(Arrays.stream(new SslContextFactory.Server().getExcludeCipherSuites()).filter(s -> !Pattern.matches(s, "SSL_")).toArray(String[]::new)); - } WebServerDTO webServerDTO = new WebServerDTO(); webServerDTO.setBindings(Collections.singletonList(bindingDTO)); webServerDTO.path = "webapps"; @@ -400,11 +391,6 @@ public void simpleSecureServer() throws Exception { SSLEngine engine = context.createSSLEngine(); engine.setUseClientMode(true); engine.setWantClientAuth(true); - if (System.getProperty("java.vendor").contains("IBM")) { - //By default on IBM Java 8 JVM, SSLEngine doesn't enable TLSv1.2 while - // org.eclipse.jetty.util.ssl.SslContextFactory excludes all TLSv1 and TLSv1.1 cipher suites. - engine.setEnabledProtocols(new String[] {"TLSv1.2"}); - } final SslHandler sslHandler = new SslHandler(engine); CountDownLatch latch = new CountDownLatch(1); @@ -780,15 +766,6 @@ public void simpleSecureServerWithClientAuth() throws Exception { bindingDTO.setClientAuth(true); bindingDTO.setTrustStorePath(keyStorePath); bindingDTO.setTrustStorePassword(KEY_STORE_PASSWORD); - if (System.getProperty("java.vendor").contains("IBM")) { - //By default on IBM Java 8 JVM, org.eclipse.jetty.util.ssl.SslContextFactory doesn't include TLSv1.2 - // while it excludes all TLSv1 and TLSv1.1 cipher suites. - bindingDTO.setIncludedTLSProtocols("TLSv1.2"); - // Remove excluded cipher suites matching the prefix `SSL` because the names of the IBM Java 8 JVM cipher suites - // have the prefix `SSL` while the `DEFAULT_EXCLUDED_CIPHER_SUITES` of org.eclipse.jetty.util.ssl.SslContextFactory - // includes "^SSL_.*$". So all IBM JVM cipher suites are excluded by SslContextFactory using the `DEFAULT_EXCLUDED_CIPHER_SUITES`. - bindingDTO.setExcludedCipherSuites(Arrays.stream(new SslContextFactory.Server().getExcludeCipherSuites()).filter(s -> !Pattern.matches(s, "SSL_")).toArray(String[]::new)); - } WebServerDTO webServerDTO = new WebServerDTO(); webServerDTO.setBindings(Collections.singletonList(bindingDTO)); webServerDTO.path = "webapps"; @@ -812,11 +789,6 @@ public void simpleSecureServerWithClientAuth() throws Exception { SSLEngine engine = context.createSSLEngine(); engine.setUseClientMode(true); engine.setWantClientAuth(true); - if (System.getProperty("java.vendor").contains("IBM")) { - //By default on IBM Java 8 JVM, SSLEngine doesn't enable TLSv1.2 while - // org.eclipse.jetty.util.ssl.SslContextFactory excludes all TLSv1 and TLSv1.1 cipher suites. - engine.setEnabledProtocols(new String[] {"TLSv1.2"}); - } final SslHandler sslHandler = new SslHandler(engine); CountDownLatch latch = new CountDownLatch(1); From 127cf711454beb71955ff4ac76147c73f3747986 Mon Sep 17 00:00:00 2001 From: gchuf Date: Sat, 20 Jun 2026 12:49:03 +0200 Subject: [PATCH 10/10] ARTEMIS-6116 Remove JavaVersionUtil.java --- .../artemis/tests/util/JavaVersionUtil.java | 33 ------------------- 1 file changed, 33 deletions(-) delete mode 100644 tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JavaVersionUtil.java diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JavaVersionUtil.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JavaVersionUtil.java deleted file mode 100644 index 4e3016ebaa3..00000000000 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JavaVersionUtil.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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. - */ -package org.apache.activemq.artemis.tests.util; - -public class JavaVersionUtil { - - private static boolean isJdk8; - - static { - String version = System.getProperty("java.version"); - if (version != null && version.startsWith("1.8.")) { - isJdk8 = true; - } - } - - public static boolean isJava8() { - return isJdk8; - } -}