You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@artemis.apache.org by jb...@apache.org on 2026/09/03 16:31:24 UTC

(artemis) 13/14: ARTEMIS-6116 Catch missing permissions error when creating symlinks on Windows

This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/artemis.git

commit 62b870b59e4e9aabf8d75c3aa5755177bafb7250
Author: gchuf <ga...@gmail.com>
AuthorDate: Sat Jul 11 11:41:58 2026 +0200

    ARTEMIS-6116 Catch missing permissions error when creating symlinks on Windows
---
 .../activemq/cli/test/WebServerComponentTest.java  | 42 +++++++++++++++++-----
 1 file changed, 34 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 144994f26f..5cf42b5d86 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
@@ -33,6 +33,7 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.http.HttpClient;
+import java.nio.file.FileSystemException;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -104,6 +105,7 @@ import org.eclipse.jetty.ee9.webapp.WebAppContext;
 import org.eclipse.jetty.ee9.webapp.WebInfConfiguration;
 import org.eclipse.jetty.util.thread.ThreadPool;
 import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assumptions;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.io.TempDir;
@@ -569,8 +571,16 @@ public class WebServerComponentTest extends ArtemisTestCase {
 
       String keyStorePath;
       if (useSymbolicLinks) {
-         keyStorePath = Files.createSymbolicLink(storeFolder.toPath().resolve(
-             "store-keystore.p12"), keyStoreFile.toPath()).toString();
+         try {
+            keyStorePath = Files.createSymbolicLink(storeFolder.toPath().resolve(
+                "store-keystore.p12"), keyStoreFile.toPath()).toString();
+         } catch (FileSystemException e) {
+            // Check if privileges are missing on Windows
+            if (e.getMessage() != null && e.getMessage().contains("A required privilege is not held by the client")) {
+               Assumptions.assumeTrue(false, "Skipping test: Windows account lacks the privilege to create symbolic links.");
+            }
+            throw e;
+         }
       } else {
          keyStorePath = keyStoreFile.getAbsolutePath();
       }
@@ -643,10 +653,18 @@ public class WebServerComponentTest extends ArtemisTestCase {
       String sourceKey;
       String sourceCert;
       if (useSymbolicLinks) {
-         sourceKey = Files.createSymbolicLink(storeFolder.toPath().resolve(
-             "store-key.pem"), serverKeyFile.toPath()).toString();
-         sourceCert = Files.createSymbolicLink(storeFolder.toPath().resolve(
-             "store-cert.pem"), serverCertFile.toPath()).toString();
+         try {
+            sourceKey = Files.createSymbolicLink(storeFolder.toPath().resolve(
+               "store-key.pem"), serverKeyFile.toPath()).toString();
+            sourceCert = Files.createSymbolicLink(storeFolder.toPath().resolve(
+               "store-cert.pem"), serverCertFile.toPath()).toString();
+         } catch (FileSystemException e) {
+            // Check if privileges are missing on Windows
+            if (e.getMessage() != null && e.getMessage().contains("A required privilege is not held by the client")) {
+               Assumptions.assumeTrue(false, "Skipping test: Windows account lacks the privilege to create symbolic links.");
+            }
+            throw e;
+         }
       } else {
          sourceKey = serverKeyFile.getAbsolutePath();
          sourceCert = serverCertFile.getAbsolutePath();
@@ -659,8 +677,16 @@ public class WebServerComponentTest extends ArtemisTestCase {
 
       String keyStorePath;
       if (useSymbolicLinks) {
-         keyStorePath = Files.createSymbolicLink(storeFolder.toPath().resolve(
-             "store-pem-config.properties"), serverPemConfigFile.toPath()).toString();
+         try {
+            keyStorePath = Files.createSymbolicLink(storeFolder.toPath().resolve(
+               "store-pem-config.properties"), serverPemConfigFile.toPath()).toString();
+         } catch (FileSystemException e) {
+            // Check if privileges are missing on Windows
+            if (e.getMessage() != null && e.getMessage().contains("A required privilege is not held by the client")) {
+               Assumptions.assumeTrue(false, "Skipping test: Windows account lacks the privilege to create symbolic links.");
+            }
+            throw e;
+         }
       } else {
          keyStorePath = serverPemConfigFile.getAbsolutePath();
       }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@artemis.apache.org
For additional commands, e-mail: commits-help@artemis.apache.org