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 422bac5c204a [CAMEL-22768] camel-http: useSystemProperties property
defined at component level is ignored (#20338)
422bac5c204a is described below
commit 422bac5c204aae6c9ac2ec1b4561f4085860164e
Author: Luigi De Masi <[email protected]>
AuthorDate: Wed Dec 10 21:10:32 2025 +0100
[CAMEL-22768] camel-http: useSystemProperties property defined at component
level is ignored (#20338)
Signed-off-by: Luigi De Masi <[email protected]>
---
components/camel-http/pom.xml | 28 +++++++++++
.../apache/camel/component/http/HttpComponent.java | 1 +
.../HttpUseSystemPropertiesPropagationTest.java | 57 ++++++++++++++++++++++
.../HttpsProducerWithSystemPropertiesTest.java | 2 +
4 files changed, 88 insertions(+)
diff --git a/components/camel-http/pom.xml b/components/camel-http/pom.xml
index 5084edefde0b..2650e650a93c 100644
--- a/components/camel-http/pom.xml
+++ b/components/camel-http/pom.xml
@@ -161,4 +161,32 @@
</dependency>
</dependencies>
+ <build>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludedGroups>require-isolated-jvm</excludedGroups>
+ </configuration>
+ <executions>
+ <execution>
+ <id>isolated-test</id>
+ <phase>test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <excludedGroups combine.self="override"/>
+ <groups>require-isolated-jvm</groups>
+ <reuseForks>false</reuseForks>
+ <forkCount>1</forkCount>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
diff --git
a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
index 3824d4cd7c73..1b4abff25408 100644
---
a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
+++
b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
@@ -473,6 +473,7 @@ public class HttpComponent extends HttpCommonComponent
implements RestProducerFa
endpoint.setHttpActivityListener(httpActivityListener);
endpoint.setLogHttpActivity(logHttpActivity);
endpoint.setContentTypeCharsetEnabled(contentTypeCharsetEnabled);
+ endpoint.setUseSystemProperties(this.useSystemProperties);
// configure the endpoint with the common configuration from the
component
if (getHttpConfiguration() != null) {
diff --git
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpUseSystemPropertiesPropagationTest.java
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpUseSystemPropertiesPropagationTest.java
new file mode 100644
index 000000000000..4ef817ade717
--- /dev/null
+++
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpUseSystemPropertiesPropagationTest.java
@@ -0,0 +1,57 @@
+/*
+ * 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.component.http;
+
+import java.util.stream.Stream;
+
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+@Tag("require-isolated-jvm")
+public class HttpUseSystemPropertiesPropagationTest extends CamelTestSupport {
+
+ private static final String uri = "https://camel.apache.org/";
+
+ private static Stream<Arguments> testCases() {
+ return Stream.of(
+ Arguments.of("No query parameter - component value false",
uri, false, false),
+ Arguments.of("No query parameter - component value true", uri,
true, true),
+ Arguments.of("?useSystemProperties=true - component value
false", uri + "?useSystemProperties=true", false,
+ true),
+ Arguments.of("?useSystemProperties=false - component value
true", uri + "?useSystemProperties=false", true,
+ false),
+ Arguments.of("?useSystemProperties=true - component value
true", uri + "?useSystemProperties=true", true, true),
+ Arguments.of("?useSystemProperties=false - component value
false", uri + "?useSystemProperties=false", false,
+ false));
+ }
+
+ @ParameterizedTest(name = "{index}: {0}")
+ @MethodSource("testCases")
+ public void testHttpUseSystemPropertiesPropagation(
+ String testName, String camelURI, boolean componentValue, boolean
expected)
+ throws Exception {
+ HttpComponent component = new HttpComponent();
+ component.setCamelContext(context);
+ component.setUseSystemProperties(componentValue);
+ HttpEndpoint endpoint = (HttpEndpoint)
component.createEndpoint(camelURI);
+ Assertions.assertEquals(expected, endpoint.isUseSystemProperties());
+ }
+}
diff --git
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpsProducerWithSystemPropertiesTest.java
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpsProducerWithSystemPropertiesTest.java
index ef9f04bb2202..56b759b45240 100644
---
a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpsProducerWithSystemPropertiesTest.java
+++
b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpsProducerWithSystemPropertiesTest.java
@@ -33,6 +33,7 @@ import
org.apache.hc.core5.http.impl.bootstrap.ServerBootstrap;
import org.apache.hc.core5.ssl.SSLContexts;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import static org.apache.camel.component.http.HttpMethods.GET;
@@ -43,6 +44,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
* system properties) contains values from the first creation. Therefore, it
is not possible to create different test,
* which uses systemProperties without forked JVM.
*/
+@Tag("require-isolated-jvm")
public class HttpsProducerWithSystemPropertiesTest extends BaseHttpTest {
private static Object defaultSystemHttpAgent;