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

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 2bb0af5da4d CAMEL-22157: Skip test on windows
2bb0af5da4d is described below

commit 2bb0af5da4d0348b3d67885025a4027b54d322f4
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Wed Jun 11 07:53:42 2025 +0200

    CAMEL-22157: Skip test on windows
---
 .../main/MainPropertyPlaceholderWithEnvTest.java   | 35 ++--------------------
 1 file changed, 3 insertions(+), 32 deletions(-)

diff --git 
a/core/camel-main/src/test/java/org/apache/camel/main/MainPropertyPlaceholderWithEnvTest.java
 
b/core/camel-main/src/test/java/org/apache/camel/main/MainPropertyPlaceholderWithEnvTest.java
index 11110460828..9d69387d8ba 100644
--- 
a/core/camel-main/src/test/java/org/apache/camel/main/MainPropertyPlaceholderWithEnvTest.java
+++ 
b/core/camel-main/src/test/java/org/apache/camel/main/MainPropertyPlaceholderWithEnvTest.java
@@ -23,6 +23,8 @@ import java.util.Properties;
 
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.DisabledOnOs;
+import org.junit.jupiter.api.condition.OS;
 import org.junit.jupiter.api.parallel.Isolated;
 import org.junit.jupiter.api.parallel.ResourceLock;
 import org.junit.jupiter.api.parallel.Resources;
@@ -31,6 +33,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
 
 @Isolated
 @ResourceLock(Resources.SYSTEM_PROPERTIES)
+@DisabledOnOs(OS.WINDOWS)
 public class MainPropertyPlaceholderWithEnvTest {
 
     public static final String ENV_PROPERTY_PLACEHOLDER_LOCATION
@@ -39,8 +42,6 @@ public class MainPropertyPlaceholderWithEnvTest {
     public static final String ENV_OVERRIDE_PROPERTIES_LOCATION
             = MainHelper.toEnvVar(MainConstants.OVERRIDE_PROPERTIES_LOCATION);
 
-    private static final Map<String, String> THE_CASE_INSENSITIVE_ENVIRONMENT 
= new HashMap<>();
-
     protected final Map<String, String> env = new HashMap<>();
     protected final Map<String, String> sys = new HashMap<>();
 
@@ -203,10 +204,8 @@ public class MainPropertyPlaceholderWithEnvTest {
     private void doEnvVariable(String name, String value) {
         if (value != null) {
             getEditableMapOfVariables().put(name, value);
-            getTheCaseInsensitiveEnvironment().put(name, value);
         } else {
             getEditableMapOfVariables().remove(name);
-            getTheCaseInsensitiveEnvironment().remove(name);
         }
     }
 
@@ -235,34 +234,6 @@ public class MainPropertyPlaceholderWithEnvTest {
         }
     }
 
-    /*
-     * The names of environment variables are case-insensitive in Windows.
-     * Therefore it stores the variables in a TreeMap named
-     * theCaseInsensitiveEnvironment.
-     */
-    private static Map<String, String> getTheCaseInsensitiveEnvironment() {
-        try {
-            Class<?> processEnvironment = 
Class.forName("java.lang.ProcessEnvironment");
-            return getFieldValue(
-                    processEnvironment, null, "theCaseInsensitiveEnvironment");
-        } catch (ClassNotFoundException e) {
-            throw new RuntimeException(
-                    "System Rules expects the existence of"
-                                       + " the class 
java.lang.ProcessEnvironment but it does not"
-                                       + " exist.",
-                    e);
-        } catch (IllegalAccessException e) {
-            throw new RuntimeException(
-                    "System Rules cannot access the static"
-                                       + " field 
'theCaseInsensitiveEnvironment' of the class"
-                                       + " java.lang.ProcessEnvironment.",
-                    e);
-        } catch (NoSuchFieldException e) {
-            //this field is only available for Windows so return a unused map
-            return THE_CASE_INSENSITIVE_ENVIRONMENT;
-        }
-    }
-
     private static Map<String, String> getFieldValue(
             Class<?> klass,
             Object object,

Reply via email to