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 ba0f005577 Add integration test coverage for ErrorRegistry SPI 
configuration. Fixes #8702.
ba0f005577 is described below

commit ba0f005577cd39248a52ad60d0d9db92f153d6f5
Author: Matt Van Horn <[email protected]>
AuthorDate: Thu Jun 18 06:15:37 2026 -0700

    Add integration test coverage for ErrorRegistry SPI configuration. Fixes 
#8702.
    
    * Add integration test coverage for ErrorRegistry SPI configuration #8702
    
    * Fixes #8702. Move error registry disabled test classes to their own files
    
    Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
    
    ---------
    
    Co-authored-by: Matt Van Horn <[email protected]>
    Co-authored-by: James Netherton <[email protected]>
    Co-authored-by: Claude Sonnet 4.6 <[email protected]>
---
 .../camel/quarkus/main/CoreMainResource.java       | 23 ++++++++++
 .../main/src/main/resources/application.properties |  3 ++
 .../main/CoreMainErrorRegistryDisabledIT.java      | 23 ++++++++++
 .../main/CoreMainErrorRegistryDisabledTest.java    | 49 ++++++++++++++++++++++
 .../apache/camel/quarkus/main/CoreMainTest.java    | 15 +++++++
 5 files changed, 113 insertions(+)

diff --git 
a/integration-tests/main/src/main/java/org/apache/camel/quarkus/main/CoreMainResource.java
 
b/integration-tests/main/src/main/java/org/apache/camel/quarkus/main/CoreMainResource.java
index bef64d7055..dd8fd6be74 100644
--- 
a/integration-tests/main/src/main/java/org/apache/camel/quarkus/main/CoreMainResource.java
+++ 
b/integration-tests/main/src/main/java/org/apache/camel/quarkus/main/CoreMainResource.java
@@ -51,6 +51,7 @@ import org.apache.camel.reactive.vertx.VertXThreadPoolFactory;
 import org.apache.camel.spi.BeanRepository;
 import org.apache.camel.spi.ContextReloadStrategy;
 import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.ErrorRegistry;
 import org.apache.camel.spi.FactoryFinderResolver;
 import org.apache.camel.spi.Language;
 import org.apache.camel.spi.ReactiveExecutor;
@@ -204,6 +205,28 @@ public class CoreMainResource {
         return builder.build();
     }
 
+    @Path("/context/error-registry")
+    @GET
+    @Produces(MediaType.APPLICATION_JSON)
+    public JsonObject errorRegistry() {
+        ErrorRegistry errorRegistry = 
main.getCamelContext().getErrorRegistry();
+
+        JsonObjectBuilder builder = Json.createObjectBuilder()
+                .add("present", errorRegistry != null);
+
+        if (errorRegistry == null) {
+            return builder.add("enabled", false).build();
+        }
+
+        return builder
+                .add("enabled", errorRegistry.isEnabled())
+                .add("maximumEntries", errorRegistry.getMaximumEntries())
+                .add("timeToLiveSeconds", 
errorRegistry.getTimeToLive().toSeconds())
+                .add("stackTraceEnabled", errorRegistry.isStackTraceEnabled())
+                .add("size", errorRegistry.size())
+                .build();
+    }
+
     @Path("/converter/my-pair")
     @POST
     @Produces(MediaType.APPLICATION_JSON)
diff --git a/integration-tests/main/src/main/resources/application.properties 
b/integration-tests/main/src/main/resources/application.properties
index d74ee3a4ac..bb51afbc2a 100644
--- a/integration-tests/main/src/main/resources/application.properties
+++ b/integration-tests/main/src/main/resources/application.properties
@@ -31,6 +31,9 @@ camel.resilience4j.sliding-window-size = 1234
 # Main
 #
 camel.main.auto-configuration-log-summary = false
+camel.main.error-registry-enabled = true
+camel.main.error-registry-maximum-entries = 37
+camel.main.error-registry-time-to-live-seconds = 19
 
 # To verify DebuggerJmxConnectorService substitutions take effect due to lack 
of camel-quarkus-management on the classpath
 camel.debug.enabled = true
diff --git 
a/integration-tests/main/src/test/java/org/apache/camel/quarkus/main/CoreMainErrorRegistryDisabledIT.java
 
b/integration-tests/main/src/test/java/org/apache/camel/quarkus/main/CoreMainErrorRegistryDisabledIT.java
new file mode 100644
index 0000000000..68a84e01ba
--- /dev/null
+++ 
b/integration-tests/main/src/test/java/org/apache/camel/quarkus/main/CoreMainErrorRegistryDisabledIT.java
@@ -0,0 +1,23 @@
+/*
+ * 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.camel.quarkus.main;
+
+import io.quarkus.test.junit.QuarkusIntegrationTest;
+
+@QuarkusIntegrationTest
+class CoreMainErrorRegistryDisabledIT extends 
CoreMainErrorRegistryDisabledTest {
+}
diff --git 
a/integration-tests/main/src/test/java/org/apache/camel/quarkus/main/CoreMainErrorRegistryDisabledTest.java
 
b/integration-tests/main/src/test/java/org/apache/camel/quarkus/main/CoreMainErrorRegistryDisabledTest.java
new file mode 100644
index 0000000000..4596625b12
--- /dev/null
+++ 
b/integration-tests/main/src/test/java/org/apache/camel/quarkus/main/CoreMainErrorRegistryDisabledTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.camel.quarkus.main;
+
+import java.util.Map;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.TestProfile;
+import io.restassured.RestAssured;
+import jakarta.ws.rs.core.MediaType;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.Matchers.is;
+
+@QuarkusTest
+@TestProfile(CoreMainErrorRegistryDisabledTest.CoreMainErrorRegistryDisabledTestProfile.class)
+class CoreMainErrorRegistryDisabledTest {
+    @Test
+    void testErrorRegistryDisabled() {
+        RestAssured.given()
+                .accept(MediaType.APPLICATION_JSON)
+                .get("/test/context/error-registry")
+                .then()
+                .statusCode(200)
+                .body("enabled", is(false));
+    }
+
+    public static final class CoreMainErrorRegistryDisabledTestProfile 
implements QuarkusTestProfile {
+        @Override
+        public Map<String, String> getConfigOverrides() {
+            return Map.of("camel.main.error-registry-enabled", "false");
+        }
+    }
+}
diff --git 
a/integration-tests/main/src/test/java/org/apache/camel/quarkus/main/CoreMainTest.java
 
b/integration-tests/main/src/test/java/org/apache/camel/quarkus/main/CoreMainTest.java
index 40b023ea50..ff1106b094 100644
--- 
a/integration-tests/main/src/test/java/org/apache/camel/quarkus/main/CoreMainTest.java
+++ 
b/integration-tests/main/src/test/java/org/apache/camel/quarkus/main/CoreMainTest.java
@@ -173,6 +173,21 @@ public class CoreMainTest {
         assertThat(executor.getBoolean("configured")).isTrue();
     }
 
+    @Test
+    public void testErrorRegistry() {
+        RestAssured.given()
+                .accept(MediaType.APPLICATION_JSON)
+                .get("/test/context/error-registry")
+                .then()
+                .statusCode(200)
+                .body(
+                        "present", is(true),
+                        "enabled", is(true),
+                        "maximumEntries", is(37),
+                        "timeToLiveSeconds", is(19),
+                        "size", is(0));
+    }
+
     @Test
     public void testCustomTypeConverter() {
         RestAssured.given()

Reply via email to