This is an automated email from the ASF dual-hosted git repository. christophd pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 1acdf20546aa6b666cb0270fa044e375e4cbf56e Author: Christoph Deppisch <[email protected]> AuthorDate: Thu Oct 8 17:40:35 2026 +0200 CAMEL-25333: Address review feedback on camel-openfeature component Co-Authored-By: Claude Opus 4.6 <[email protected]> --- .../camel/component/openfeature/OpenFeatureEndpoint.java | 4 ++++ .../camel/component/openfeature/OpenFeatureProducerTest.java | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/components/camel-openfeature/src/main/java/org/apache/camel/component/openfeature/OpenFeatureEndpoint.java b/components/camel-openfeature/src/main/java/org/apache/camel/component/openfeature/OpenFeatureEndpoint.java index 574e12693e77..e1d9f6157ff6 100644 --- a/components/camel-openfeature/src/main/java/org/apache/camel/component/openfeature/OpenFeatureEndpoint.java +++ b/components/camel-openfeature/src/main/java/org/apache/camel/component/openfeature/OpenFeatureEndpoint.java @@ -300,6 +300,10 @@ public class OpenFeatureEndpoint extends DefaultEndpoint { if ("variant".equalsIgnoreCase(evalType)) { return false; } + if (evalType != null && !evalType.isEmpty()) { + throw new IllegalArgumentException( + "Unknown evaluationType '" + evalType + "'. Supported values: boolean, variant, isEnabled"); + } String dv = configuration.getDefaultValue(); return "true".equalsIgnoreCase(dv) || "false".equalsIgnoreCase(dv); } diff --git a/components/camel-openfeature/src/test/java/org/apache/camel/component/openfeature/OpenFeatureProducerTest.java b/components/camel-openfeature/src/test/java/org/apache/camel/component/openfeature/OpenFeatureProducerTest.java index 5ca26e5ede0a..cb6af6e22d3b 100644 --- a/components/camel-openfeature/src/test/java/org/apache/camel/component/openfeature/OpenFeatureProducerTest.java +++ b/components/camel-openfeature/src/test/java/org/apache/camel/component/openfeature/OpenFeatureProducerTest.java @@ -27,6 +27,7 @@ import org.apache.camel.test.junit6.CamelTestSupport; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; class OpenFeatureProducerTest extends CamelTestSupport { @@ -206,6 +207,16 @@ class OpenFeatureProducerTest extends CamelTestSupport { assertThat(result).isEqualTo(false); } + @Test + void testUnknownEvaluationTypeHeaderThrows() { + assertThatThrownBy(() -> template.requestBodyAndHeader( + "direct:boolean-flag", "ignored", + OpenFeatureConstants.EVALUATION_TYPE, "booleen")) + .rootCause() + .isInstanceOf(IllegalArgumentException.class) + .hasMessageContaining("Unknown evaluationType 'booleen'"); + } + @Test void testInlineFlags() throws Exception { String inlineFlags = """
