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 7c387d43337 Merge platform-http-proxy-ssl into platform-http-proxy
7c387d43337 is described below
commit 7c387d433370bfea7ba44c0dea219ec58d9285d6
Author: James Netherton <[email protected]>
AuthorDate: Thu Nov 12 11:31:20 2026 +0000
Merge platform-http-proxy-ssl into platform-http-proxy
The two modules only differed in the scheme used to reach the origin server.
A single proxy route now forwards over HTTPS when the request targets the
origin's HTTPS port and over plain HTTP otherwise, with one WireMock server
exposing both ports.
Co-authored-by: Claude Opus 5.5 <[email protected]>
---
integration-tests/platform-http-proxy-ssl/pom.xml | 141 ---------------------
.../proxy/ssl/it/PlatformHttpProxySslResource.java | 36 ------
.../platform/http/proxy/ssl/it/Routes.java | 76 -----------
.../PlatformHttpSSLTestResource.java | 59 ---------
.../ProxySslTest.java | 63 ---------
.../ProxyTestIT.java | 23 ----
.../test/resources/mappings/originServer_GET.json | 18 ---
.../test/resources/mappings/originServer_POST.json | 18 ---
integration-tests/platform-http-proxy/pom.xml | 7 +-
.../http/proxy/it/PlatformHttpProxyResource.java | 8 ++
.../component/platform/http/proxy/it/Routes.java | 48 +++++++
.../http/proxy/it/PlatformHttpTestResource.java | 15 ++-
.../proxy/it/{ProxyTestIT.java => ProxyIT.java} | 2 +-
.../platform/http/proxy/it/ProxyTest.java | 26 +++-
integration-tests/pom.xml | 1 -
tooling/scripts/test-categories.yaml | 1 -
16 files changed, 98 insertions(+), 444 deletions(-)
diff --git a/integration-tests/platform-http-proxy-ssl/pom.xml
b/integration-tests/platform-http-proxy-ssl/pom.xml
deleted file mode 100644
index ec253ad644f..00000000000
--- a/integration-tests/platform-http-proxy-ssl/pom.xml
+++ /dev/null
@@ -1,141 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-build-parent-it</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- <relativePath>../../poms/build-parent-it/pom.xml</relativePath>
- </parent>
-
-
<artifactId>camel-quarkus-integration-test-platform-http-proxy-ssl</artifactId>
- <name>Camel Quarkus :: Integration Tests :: Platform HTTP Proxy SSL</name>
- <description>Integration tests for Camel Quarkus platform-http extension -
Proxy - SSL</description>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-platform-http</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-http</artifactId>
- </dependency>
- <dependency>
- <groupId>io.quarkus</groupId>
- <artifactId>quarkus-resteasy</artifactId>
- </dependency>
-
-
-
- <!-- test dependencies -->
- <dependency>
- <groupId>io.quarkus</groupId>
- <artifactId>quarkus-junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>io.rest-assured</groupId>
- <artifactId>rest-assured</artifactId>
- <scope>test</scope>
- </dependency>
- <!-- dependencies needed to mock origin server -->
- <dependency>
- <groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-integration-wiremock-support</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel.quarkus</groupId>
-
<artifactId>camel-quarkus-integration-tests-support-certificate-generator</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-
- <profiles>
- <profile>
- <id>native</id>
- <activation>
- <property>
- <name>native</name>
- </property>
- </activation>
- <properties>
- <quarkus.native.enabled>true</quarkus.native.enabled>
- </properties>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-failsafe-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>virtualDependencies</id>
- <activation>
- <property>
- <name>!noVirtualDependencies</name>
- </property>
- </activation>
- <dependencies>
- <!-- The following dependencies guarantee that this module is
built after them. You can update them by running `mvn process-resources
-Pformat -N` from the source tree root directory -->
- <dependency>
- <groupId>org.apache.camel.quarkus</groupId>
- <artifactId>camel-quarkus-http-deployment</artifactId>
- <version>${project.version}</version>
- <type>pom</type>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>*</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.camel.quarkus</groupId>
-
<artifactId>camel-quarkus-platform-http-deployment</artifactId>
- <version>${project.version}</version>
- <type>pom</type>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>*</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
- </profile>
- </profiles>
-
-</project>
diff --git
a/integration-tests/platform-http-proxy-ssl/src/main/java/org/apache/camel/quarkus/component/platform/http/proxy/ssl/it/PlatformHttpProxySslResource.java
b/integration-tests/platform-http-proxy-ssl/src/main/java/org/apache/camel/quarkus/component/platform/http/proxy/ssl/it/PlatformHttpProxySslResource.java
deleted file mode 100644
index 0ef93bbc1fd..00000000000
---
a/integration-tests/platform-http-proxy-ssl/src/main/java/org/apache/camel/quarkus/component/platform/http/proxy/ssl/it/PlatformHttpProxySslResource.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.component.platform.http.proxy.ssl.it;
-
-import jakarta.enterprise.context.ApplicationScoped;
-import jakarta.ws.rs.GET;
-import jakarta.ws.rs.Path;
-import org.eclipse.microprofile.config.inject.ConfigProperty;
-
-@ApplicationScoped
-@Path("/platform-http-proxy-ssl")
-public class PlatformHttpProxySslResource {
-
- @ConfigProperty(name = "platform.origin.url")
- String url;
-
- @GET
- public String getUrl() {
- return url;
- }
-
-}
diff --git
a/integration-tests/platform-http-proxy-ssl/src/main/java/org/apache/camel/quarkus/component/platform/http/proxy/ssl/it/Routes.java
b/integration-tests/platform-http-proxy-ssl/src/main/java/org/apache/camel/quarkus/component/platform/http/proxy/ssl/it/Routes.java
deleted file mode 100644
index 69b0cfd3d4d..00000000000
---
a/integration-tests/platform-http-proxy-ssl/src/main/java/org/apache/camel/quarkus/component/platform/http/proxy/ssl/it/Routes.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.component.platform.http.proxy.ssl.it;
-
-import jakarta.enterprise.context.ApplicationScoped;
-import jakarta.enterprise.inject.Produces;
-import jakarta.inject.Named;
-import jakarta.inject.Singleton;
-import org.apache.camel.Exchange;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.support.jsse.KeyManagersParameters;
-import org.apache.camel.support.jsse.KeyStoreParameters;
-import org.apache.camel.support.jsse.SSLContextParameters;
-import org.apache.camel.support.jsse.TrustManagersParameters;
-import org.apache.hc.client5.http.ssl.NoopHostnameVerifier;
-import org.eclipse.microprofile.config.inject.ConfigProperty;
-
-@ApplicationScoped
-public class Routes extends RouteBuilder {
-
- @ConfigProperty(name = "platform.origin.url", defaultValue = "TODO")
- String url;
-
- @Named
- @Produces
- @Singleton
- public SSLContextParameters sslContextParameters() {
- SSLContextParameters sslContextParameters = new SSLContextParameters();
-
- KeyManagersParameters keyManagersParameters = new
KeyManagersParameters();
- KeyStoreParameters keyStore = new KeyStoreParameters();
- keyStore.setPassword("changeit");
- keyStore.setResource("file://target/certs/proxy-ssl-keystore.p12");
- keyManagersParameters.setKeyPassword("changeit");
- keyManagersParameters.setKeyStore(keyStore);
- sslContextParameters.setKeyManagers(keyManagersParameters);
-
- KeyStoreParameters truststoreParameters = new KeyStoreParameters();
-
truststoreParameters.setResource("file://target/certs/proxy-ssl-keystore.p12");
- truststoreParameters.setPassword("changeit");
-
- TrustManagersParameters trustManagersParameters = new
TrustManagersParameters();
- trustManagersParameters.setKeyStore(truststoreParameters);
- sslContextParameters.setTrustManagers(trustManagersParameters);
-
- return sslContextParameters;
- }
-
- @Named
- public NoopHostnameVerifier x509HostnameVerifier() {
- return NoopHostnameVerifier.INSTANCE;
- }
-
- @Override
- public void configure() throws Exception {
- from("platform-http:proxy")
- .log("header is :: ${headers.CamelHttpHost}")
- .log("Im here with body :: ${body}")
- .toD("https://${headers." + Exchange.HTTP_HOST
- +
"}?bridgeEndpoint=true&sslContextParameters=#sslContextParameters&x509HostnameVerifier=#x509HostnameVerifier");
- }
-}
diff --git
a/integration-tests/platform-http-proxy-ssl/src/test/java/org.apache.camel.quarkus.component.platform.http.proxy.ssl.it/PlatformHttpSSLTestResource.java
b/integration-tests/platform-http-proxy-ssl/src/test/java/org.apache.camel.quarkus.component.platform.http.proxy.ssl.it/PlatformHttpSSLTestResource.java
deleted file mode 100644
index 831244fbea9..00000000000
---
a/integration-tests/platform-http-proxy-ssl/src/test/java/org.apache.camel.quarkus.component.platform.http.proxy.ssl.it/PlatformHttpSSLTestResource.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.component.platform.http.proxy.ssl.it;
-
-import java.util.Map;
-
-import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
-import
org.apache.camel.quarkus.test.wiremock.WireMockTestResourceLifecycleManager;
-
-public class PlatformHttpSSLTestResource extends
WireMockTestResourceLifecycleManager {
- private static final String PLATFORM_ORIGIN_HOST = "PLATFORM_ORIGIN_HOST";
- private static final String PLATFORM_ORIGIN_PORT = "PLATFORM_ORIGIN_PORT";
-
- @Override
- protected String getRecordTargetBaseUrl() {
- return "/";
- }
-
- @Override
- protected boolean isMockingEnabled() {
- return !envVarsPresent(PLATFORM_ORIGIN_HOST, PLATFORM_ORIGIN_PORT);
- }
-
- @Override
- public Map<String, String> start() {
- Map<String, String> options = super.start();
- if (options.containsKey("wiremock.url.ssl")) {
- String wiremockUrl = options.get("wiremock.url.ssl");
- options.put("platform.origin.url", wiremockUrl);
- }
- return options;
- }
-
- @Override
- protected void customizeWiremockConfiguration(WireMockConfiguration
config) {
- // add an SSL port
- config.dynamicHttpsPort();
- // Either a path to a file or a resource on the classpath
- config.keystorePath("target/certs/proxy-ssl-keystore.p12");
- // The password used to access the keystore. Defaults to "password" if
omitted
- config.keystorePassword("changeit");
- // The password used to access individual keys in the keystore.
Defaults to "password" if omitted
- config.keyManagerPassword("changeit");
- }
-}
diff --git
a/integration-tests/platform-http-proxy-ssl/src/test/java/org.apache.camel.quarkus.component.platform.http.proxy.ssl.it/ProxySslTest.java
b/integration-tests/platform-http-proxy-ssl/src/test/java/org.apache.camel.quarkus.component.platform.http.proxy.ssl.it/ProxySslTest.java
deleted file mode 100644
index 8035c277486..00000000000
---
a/integration-tests/platform-http-proxy-ssl/src/test/java/org.apache.camel.quarkus.component.platform.http.proxy.ssl.it/ProxySslTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.component.platform.http.proxy.ssl.it;
-
-import io.quarkus.test.common.QuarkusTestResource;
-import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
-import io.restassured.http.ContentType;
-import io.smallrye.certs.Format;
-import io.smallrye.certs.junit5.Certificate;
-import org.apache.camel.quarkus.test.support.certificate.TestCertificates;
-import org.junit.jupiter.api.Test;
-
-import static io.restassured.RestAssured.given;
-import static org.hamcrest.Matchers.equalTo;
-
-@TestCertificates(certificates = {
- @Certificate(name = "proxy-ssl", formats = {
- Format.PKCS12 }, password = "changeit") })
-@QuarkusTest
-@QuarkusTestResource(PlatformHttpSSLTestResource.class)
-public class ProxySslTest {
- @Test
- void test() {
- final var proxyUrl = "http://localhost:" + RestAssured.port;
- String url = given()
- .get("/platform-http-proxy-ssl")
- .body().asString();
-
- // forcing RestAssured to send a GET instead of CONNECT with proxy
settings
- url = url.replace("https", "http");
- given()
- .proxy(proxyUrl)
- .contentType(ContentType.JSON)
- .when().get(url)
- .then()
- .statusCode(200)
- .body(equalTo("{\"message\": \"Hello World!\"}"));
-
- given()
- .body("hello")
- .proxy(proxyUrl)
- .contentType(ContentType.JSON)
- .when().post(url)
- .then()
- .statusCode(200)
- .body(equalTo("{\"message\": \"Hello World!\"}"));
- }
-}
diff --git
a/integration-tests/platform-http-proxy-ssl/src/test/java/org.apache.camel.quarkus.component.platform.http.proxy.ssl.it/ProxyTestIT.java
b/integration-tests/platform-http-proxy-ssl/src/test/java/org.apache.camel.quarkus.component.platform.http.proxy.ssl.it/ProxyTestIT.java
deleted file mode 100644
index c5cb0e0ba90..00000000000
---
a/integration-tests/platform-http-proxy-ssl/src/test/java/org.apache.camel.quarkus.component.platform.http.proxy.ssl.it/ProxyTestIT.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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.component.platform.http.proxy.ssl.it;
-
-import io.quarkus.test.junit.QuarkusIntegrationTest;
-
-@QuarkusIntegrationTest
-public class ProxyTestIT extends ProxySslTest {
-}
diff --git
a/integration-tests/platform-http-proxy-ssl/src/test/resources/mappings/originServer_GET.json
b/integration-tests/platform-http-proxy-ssl/src/test/resources/mappings/originServer_GET.json
deleted file mode 100644
index 4552e75883e..00000000000
---
a/integration-tests/platform-http-proxy-ssl/src/test/resources/mappings/originServer_GET.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "id": "09aa79df-8a19-41df-8655-e414d390d6ed",
- "name": "platform-http-proxy_api",
- "request": {
- "url": "/",
- "method": "GET"
- },
- "response": {
- "status": 200,
- "body": "{\"message\": \"Hello World!\"}",
- "headers": {
- "Content-Type": "application/json; charset=UTF-8"
- }
- },
- "uuid": "09aa79df-8a19-41df-8655-e414d390d6ed",
- "persistent": true,
- "insertionIndex": 2
-}
\ No newline at end of file
diff --git
a/integration-tests/platform-http-proxy-ssl/src/test/resources/mappings/originServer_POST.json
b/integration-tests/platform-http-proxy-ssl/src/test/resources/mappings/originServer_POST.json
deleted file mode 100644
index 602d055fbeb..00000000000
---
a/integration-tests/platform-http-proxy-ssl/src/test/resources/mappings/originServer_POST.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "id": "8a1bf17a-be22-41d2-8ee6-0a4632fda703",
- "name": "platform-http-proxy_api",
- "request": {
- "url": "/",
- "method": "POST"
- },
- "response": {
- "status": 200,
- "body": "{\"message\": \"Hello World!\"}",
- "headers": {
- "Content-Type": "application/json; charset=UTF-8"
- }
- },
- "uuid": "8a1bf17a-be22-41d2-8ee6-0a4632fda703",
- "persistent": true,
- "insertionIndex": 2
-}
\ No newline at end of file
diff --git a/integration-tests/platform-http-proxy/pom.xml
b/integration-tests/platform-http-proxy/pom.xml
index 13d0f30d296..c6e2e62ca40 100644
--- a/integration-tests/platform-http-proxy/pom.xml
+++ b/integration-tests/platform-http-proxy/pom.xml
@@ -28,7 +28,7 @@
<artifactId>camel-quarkus-integration-test-platform-http-proxy</artifactId>
<name>Camel Quarkus :: Integration Tests :: Platform HTTP Proxy</name>
- <description>Integration tests for Camel Quarkus platform-http extension -
Proxy</description>
+ <description>Integration tests for Camel Quarkus platform-http extension -
Proxy over HTTP and HTTPS</description>
<dependencies>
@@ -64,6 +64,11 @@
<artifactId>camel-quarkus-integration-wiremock-support</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+
<artifactId>camel-quarkus-integration-tests-support-certificate-generator</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
diff --git
a/integration-tests/platform-http-proxy/src/main/java/org/apache/camel/quarkus/component/platform/http/proxy/it/PlatformHttpProxyResource.java
b/integration-tests/platform-http-proxy/src/main/java/org/apache/camel/quarkus/component/platform/http/proxy/it/PlatformHttpProxyResource.java
index 5c32a5480d8..f103a75db80 100644
---
a/integration-tests/platform-http-proxy/src/main/java/org/apache/camel/quarkus/component/platform/http/proxy/it/PlatformHttpProxyResource.java
+++
b/integration-tests/platform-http-proxy/src/main/java/org/apache/camel/quarkus/component/platform/http/proxy/it/PlatformHttpProxyResource.java
@@ -28,9 +28,17 @@ public class PlatformHttpProxyResource {
@ConfigProperty(name = "platform.origin.url")
String url;
+ @ConfigProperty(name = "platform.origin.url.ssl")
+ String sslUrl;
+
@GET
public String getUrl() {
return url;
}
+ @Path("/ssl")
+ @GET
+ public String getSslUrl() {
+ return sslUrl;
+ }
}
diff --git
a/integration-tests/platform-http-proxy/src/main/java/org/apache/camel/quarkus/component/platform/http/proxy/it/Routes.java
b/integration-tests/platform-http-proxy/src/main/java/org/apache/camel/quarkus/component/platform/http/proxy/it/Routes.java
index 53cfbebd7aa..e7d45dd8e4d 100644
---
a/integration-tests/platform-http-proxy/src/main/java/org/apache/camel/quarkus/component/platform/http/proxy/it/Routes.java
+++
b/integration-tests/platform-http-proxy/src/main/java/org/apache/camel/quarkus/component/platform/http/proxy/it/Routes.java
@@ -16,18 +16,66 @@
*/
package org.apache.camel.quarkus.component.platform.http.proxy.it;
+import java.net.URI;
+import java.util.Optional;
+
import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.enterprise.inject.Produces;
+import jakarta.inject.Named;
+import jakarta.inject.Singleton;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.support.jsse.KeyManagersParameters;
+import org.apache.camel.support.jsse.KeyStoreParameters;
+import org.apache.camel.support.jsse.SSLContextParameters;
+import org.apache.camel.support.jsse.TrustManagersParameters;
+import org.apache.hc.client5.http.ssl.NoopHostnameVerifier;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
@ApplicationScoped
public class Routes extends RouteBuilder {
+ @ConfigProperty(name = "platform.origin.url.ssl")
+ Optional<String> sslUrl;
+
+ @Named
+ @Produces
+ @Singleton
+ public SSLContextParameters sslContextParameters() {
+ KeyStoreParameters keyStore = new KeyStoreParameters();
+ keyStore.setPassword("changeit");
+ keyStore.setResource("file://target/certs/proxy-ssl-keystore.p12");
+
+ KeyManagersParameters keyManagersParameters = new
KeyManagersParameters();
+ keyManagersParameters.setKeyPassword("changeit");
+ keyManagersParameters.setKeyStore(keyStore);
+
+ TrustManagersParameters trustManagersParameters = new
TrustManagersParameters();
+ trustManagersParameters.setKeyStore(keyStore);
+
+ SSLContextParameters sslContextParameters = new SSLContextParameters();
+ sslContextParameters.setKeyManagers(keyManagersParameters);
+ sslContextParameters.setTrustManagers(trustManagersParameters);
+ return sslContextParameters;
+ }
+
+ @Named
+ public NoopHostnameVerifier x509HostnameVerifier() {
+ return NoopHostnameVerifier.INSTANCE;
+ }
+
@Override
public void configure() throws Exception {
+ // Requests addressed to the origin HTTPS port are forwarded over TLS,
everything else over plain HTTP
+ String sslHost = sslUrl.map(url ->
URI.create(url).getAuthority()).orElse("");
from("platform-http:proxy")
.log("header is :: ${headers.CamelHttpHost}")
+ .choice()
+ .when(header(Exchange.HTTP_HOST).isEqualTo(sslHost))
+ .toD("https://${headers." + Exchange.HTTP_HOST
+ +
"}?bridgeEndpoint=true&sslContextParameters=#sslContextParameters&x509HostnameVerifier=#x509HostnameVerifier")
+ .otherwise()
.toD("http://${headers." + Exchange.HTTP_HOST +
"}?bridgeEndpoint=true");
}
}
diff --git
a/integration-tests/platform-http-proxy/src/test/java/org/apache/camel/quarkus/component/platform/http/proxy/it/PlatformHttpTestResource.java
b/integration-tests/platform-http-proxy/src/test/java/org/apache/camel/quarkus/component/platform/http/proxy/it/PlatformHttpTestResource.java
index 5fe00b73f43..b624ee057c7 100644
---
a/integration-tests/platform-http-proxy/src/test/java/org/apache/camel/quarkus/component/platform/http/proxy/it/PlatformHttpTestResource.java
+++
b/integration-tests/platform-http-proxy/src/test/java/org/apache/camel/quarkus/component/platform/http/proxy/it/PlatformHttpTestResource.java
@@ -18,6 +18,7 @@ package
org.apache.camel.quarkus.component.platform.http.proxy.it;
import java.util.Map;
+import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
import
org.apache.camel.quarkus.test.wiremock.WireMockTestResourceLifecycleManager;
public class PlatformHttpTestResource extends
WireMockTestResourceLifecycleManager {
@@ -39,9 +40,19 @@ public class PlatformHttpTestResource extends
WireMockTestResourceLifecycleManag
public Map<String, String> start() {
Map<String, String> options = super.start();
if (options.containsKey("wiremock.url")) {
- String wiremockUrl = options.get("wiremock.url");
- options.put("platform.origin.url", wiremockUrl);
+ options.put("platform.origin.url", options.get("wiremock.url"));
+ }
+ if (options.containsKey("wiremock.url.ssl")) {
+ options.put("platform.origin.url.ssl",
options.get("wiremock.url.ssl"));
}
return options;
}
+
+ @Override
+ protected void customizeWiremockConfiguration(WireMockConfiguration
config) {
+ config.dynamicHttpsPort();
+ config.keystorePath("target/certs/proxy-ssl-keystore.p12");
+ config.keystorePassword("changeit");
+ config.keyManagerPassword("changeit");
+ }
}
diff --git
a/integration-tests/platform-http-proxy/src/test/java/org/apache/camel/quarkus/component/platform/http/proxy/it/ProxyTestIT.java
b/integration-tests/platform-http-proxy/src/test/java/org/apache/camel/quarkus/component/platform/http/proxy/it/ProxyIT.java
similarity index 95%
rename from
integration-tests/platform-http-proxy/src/test/java/org/apache/camel/quarkus/component/platform/http/proxy/it/ProxyTestIT.java
rename to
integration-tests/platform-http-proxy/src/test/java/org/apache/camel/quarkus/component/platform/http/proxy/it/ProxyIT.java
index c3a172647c2..d094f5b0896 100644
---
a/integration-tests/platform-http-proxy/src/test/java/org/apache/camel/quarkus/component/platform/http/proxy/it/ProxyTestIT.java
+++
b/integration-tests/platform-http-proxy/src/test/java/org/apache/camel/quarkus/component/platform/http/proxy/it/ProxyIT.java
@@ -19,5 +19,5 @@ package
org.apache.camel.quarkus.component.platform.http.proxy.it;
import io.quarkus.test.junit.QuarkusIntegrationTest;
@QuarkusIntegrationTest
-public class ProxyTestIT extends ProxyTest {
+class ProxyIT extends ProxyTest {
}
diff --git
a/integration-tests/platform-http-proxy/src/test/java/org/apache/camel/quarkus/component/platform/http/proxy/it/ProxyTest.java
b/integration-tests/platform-http-proxy/src/test/java/org/apache/camel/quarkus/component/platform/http/proxy/it/ProxyTest.java
index ef69a6c4991..6e0d035c5e1 100644
---
a/integration-tests/platform-http-proxy/src/test/java/org/apache/camel/quarkus/component/platform/http/proxy/it/ProxyTest.java
+++
b/integration-tests/platform-http-proxy/src/test/java/org/apache/camel/quarkus/component/platform/http/proxy/it/ProxyTest.java
@@ -20,23 +20,42 @@ import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
+import io.smallrye.certs.Format;
+import io.smallrye.certs.junit5.Certificate;
+import org.apache.camel.quarkus.test.support.certificate.TestCertificates;
import org.junit.jupiter.api.Test;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.equalTo;
+@TestCertificates(certificates = {
+ @Certificate(name = "proxy-ssl", formats = {
+ Format.PKCS12 }, password = "changeit") })
@QuarkusTest
@QuarkusTestResource(PlatformHttpTestResource.class)
-public class ProxyTest {
+class ProxyTest {
@Test
void testProxy() {
+ String url = given()
+ .get("/platform-http-proxy")
+ .body().asString();
- final var proxyUrl = "http://localhost:" + RestAssured.port;
+ assertProxied(url);
+ }
+ @Test
+ void testProxySsl() {
String url = given()
- .get("/platform-http-proxy")
+ .get("/platform-http-proxy/ssl")
.body().asString();
+ // forcing RestAssured to send a GET instead of CONNECT with proxy
settings
+ assertProxied(url.replace("https", "http"));
+ }
+
+ private static void assertProxied(String url) {
+ final var proxyUrl = "http://localhost:" + RestAssured.port;
+
given()
.proxy(proxyUrl)
.contentType(ContentType.JSON)
@@ -54,5 +73,4 @@ public class ProxyTest {
.statusCode(200)
.body(equalTo("{\"message\": \"Hello World!\"}"));
}
-
}
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 1d24e0e7fbe..2b7d86fb229 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -217,7 +217,6 @@
<module>pinecone</module>
<module>platform-http</module>
<module>platform-http-proxy</module>
- <module>platform-http-proxy-ssl</module>
<module>pqc</module>
<module>protobuf</module>
<module>pubnub</module>
diff --git a/tooling/scripts/test-categories.yaml
b/tooling/scripts/test-categories.yaml
index d812287b4d1..1c2d1607309 100644
--- a/tooling/scripts/test-categories.yaml
+++ b/tooling/scripts/test-categories.yaml
@@ -198,7 +198,6 @@ group-10:
- ibm-watson-language
- mail
- platform-http-proxy
- - platform-http-proxy-ssl
- solr
- swift
- tls-registry