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

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


The following commit(s) were added to refs/heads/main by this push:
     new 541d26fca2 Disable JFR recording when not supported by the JDK
541d26fca2 is described below

commit 541d26fca2c302b1ae5918167fc5a8dd69da2c66
Author: James Netherton <[email protected]>
AuthorDate: Mon Feb 9 11:31:43 2026 +0000

    Disable JFR recording when not supported by the JDK
---
 .../apache/camel/quarkus/component/jfr/it/JfrTest.java  | 17 ++++-------------
 .../camel/quarkus/component/jfr/it/JfrTestResource.java | 13 ++++++++++++-
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git 
a/integration-tests/jfr/src/test/java/org/apache/camel/quarkus/component/jfr/it/JfrTest.java
 
b/integration-tests/jfr/src/test/java/org/apache/camel/quarkus/component/jfr/it/JfrTest.java
index 154d2d7ec2..83106fee8e 100644
--- 
a/integration-tests/jfr/src/test/java/org/apache/camel/quarkus/component/jfr/it/JfrTest.java
+++ 
b/integration-tests/jfr/src/test/java/org/apache/camel/quarkus/component/jfr/it/JfrTest.java
@@ -17,13 +17,11 @@
 package org.apache.camel.quarkus.component.jfr.it;
 
 import java.io.File;
-import java.io.IOException;
-import java.text.ParseException;
 
 import io.quarkus.test.common.QuarkusTestResource;
 import io.quarkus.test.junit.QuarkusTest;
 import io.restassured.RestAssured;
-import jdk.jfr.Configuration;
+import org.eclipse.microprofile.config.ConfigProvider;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
@@ -38,7 +36,9 @@ class JfrTest {
 
     @BeforeEach
     public void beforeEach() {
-        assumeTrue(isFlightRecorderAvailable(), "Flight recorder is not 
available");
+        assumeTrue(ConfigProvider.getConfig()
+                .getValue("quarkus.camel.jfr.startup-recorder-recording", 
boolean.class),
+                "Flight recorder is not available");
     }
 
     @Test
@@ -54,13 +54,4 @@ class JfrTest {
         String fileName = recordings[0];
         assertTrue(fileName.matches("camel-recording[0-9]+\\.jfr"));
     }
-
-    static boolean isFlightRecorderAvailable() {
-        try {
-            Configuration.getConfiguration("default");
-            return true;
-        } catch (IOException | ParseException e) {
-            return false;
-        }
-    }
 }
diff --git 
a/integration-tests/jfr/src/test/java/org/apache/camel/quarkus/component/jfr/it/JfrTestResource.java
 
b/integration-tests/jfr/src/test/java/org/apache/camel/quarkus/component/jfr/it/JfrTestResource.java
index 0a7eeaf892..0d432bc210 100644
--- 
a/integration-tests/jfr/src/test/java/org/apache/camel/quarkus/component/jfr/it/JfrTestResource.java
+++ 
b/integration-tests/jfr/src/test/java/org/apache/camel/quarkus/component/jfr/it/JfrTestResource.java
@@ -19,9 +19,11 @@ package org.apache.camel.quarkus.component.jfr.it;
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.text.ParseException;
 import java.util.Map;
 
 import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
+import jdk.jfr.Configuration;
 import org.apache.camel.util.CollectionHelper;
 import org.apache.commons.io.FileUtils;
 
@@ -41,7 +43,7 @@ public class JfrTestResource implements 
QuarkusTestResourceLifecycleManager {
     public Map<String, String> start() {
         return CollectionHelper.mapOf(
                 "quarkus.camel.jfr.startup-recorder-dir", 
JFR_RECORDINGS_DIR.toString(),
-                "quarkus.camel.jfr.startup-recorder-recording", "true");
+                "quarkus.camel.jfr.startup-recorder-recording", 
String.valueOf(isFlightRecorderAvailable()));
     }
 
     @Override
@@ -52,4 +54,13 @@ public class JfrTestResource implements 
QuarkusTestResourceLifecycleManager {
             throw new RuntimeException(e);
         }
     }
+
+    static boolean isFlightRecorderAvailable() {
+        try {
+            Configuration.getConfiguration("default");
+            return true;
+        } catch (IOException | ParseException e) {
+            return false;
+        }
+    }
 }

Reply via email to