You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ts...@apache.org on 2021/03/11 05:39:31 UTC

[camel-kafka-connector] 02/02: Reproduced issue #1077 - HTTPS-sink-connector duplicates protocol

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

tsato pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git

commit d9893e52c18a066c51376499c79978111c03fdea
Author: Tadayoshi Sato <sa...@gmail.com>
AuthorDate: Thu Mar 11 13:34:20 2021 +0900

    Reproduced issue #1077 - HTTPS-sink-connector duplicates protocol
---
 .../https/sink/CamelHTTPSPropertyFactory.java         |  4 ++++
 .../https/sink/CamelSinkHTTPSITCase.java              | 19 +++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/tests/itests-https/src/test/java/org/apache/camel/kafkaconnector/https/sink/CamelHTTPSPropertyFactory.java b/tests/itests-https/src/test/java/org/apache/camel/kafkaconnector/https/sink/CamelHTTPSPropertyFactory.java
index 31993ca..99a96a3 100644
--- a/tests/itests-https/src/test/java/org/apache/camel/kafkaconnector/https/sink/CamelHTTPSPropertyFactory.java
+++ b/tests/itests-https/src/test/java/org/apache/camel/kafkaconnector/https/sink/CamelHTTPSPropertyFactory.java
@@ -32,6 +32,10 @@ final class CamelHTTPSPropertyFactory extends SinkConnectorPropertyFactory<Camel
         return setProperty("camel.sink.path.httpUri", uri);
     }
 
+    public CamelHTTPSPropertyFactory withHttpMethod(String method) {
+        return setProperty("camel.sink.endpoint.httpMethod", method);
+    }
+
     public CamelHTTPSPropertyFactory withSslContextParameters(String bean, String keyStore, String password) {
         withBeans("ksp", classRef(KeyStoreParameters.class));
         withBeans("ksp.resource", keyStore);
diff --git a/tests/itests-https/src/test/java/org/apache/camel/kafkaconnector/https/sink/CamelSinkHTTPSITCase.java b/tests/itests-https/src/test/java/org/apache/camel/kafkaconnector/https/sink/CamelSinkHTTPSITCase.java
index e5d6672..90b7089 100644
--- a/tests/itests-https/src/test/java/org/apache/camel/kafkaconnector/https/sink/CamelSinkHTTPSITCase.java
+++ b/tests/itests-https/src/test/java/org/apache/camel/kafkaconnector/https/sink/CamelSinkHTTPSITCase.java
@@ -41,6 +41,7 @@ import org.apache.camel.kafkaconnector.common.utils.NetworkUtils;
 import org.apache.http.conn.ssl.NoopHostnameVerifier;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.Timeout;
 import org.slf4j.Logger;
@@ -156,6 +157,24 @@ public class CamelSinkHTTPSITCase extends CamelSinkTestSupport {
 
     @Test
     @Timeout(60)
+    @Disabled("HTTPS-sink-connector duplicates protocol #1077")
+    public void testBasicSendReceiveHttpUriWithQueryString() throws Exception {
+        startMockServer();
+
+        String uri = mockServer.getHostName() + ":" + mockServer.getPort() + "/ckc?aaa=xxx&bbb=yyy&ccc=zzz";
+        ConnectorPropertyFactory connectorPropertyFactory = CamelHTTPSPropertyFactory.basic()
+                .withTopics(topicName)
+                .withHttpUri(uri)
+                .withHttpMethod("POST")
+                .withSslContextParameters("scp", toPath("client-truststore.jks"), "secret")
+                // let's skip host verification as hostname may vary depending on test env
+                .withX509HostnameVerifier("x509HostnameVerifier", NoopHostnameVerifier.class);
+
+        runTest(connectorPropertyFactory, topicName, expect);
+    }
+
+    @Test
+    @Timeout(60)
     public void testBasicSendReceiveUsingUrl() throws Exception {
         startMockServer();