This is an automated email from the ASF dual-hosted git repository.
xyz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pulsar-client-cpp.git
The following commit(s) were added to refs/heads/main by this push:
new 27000ee Perfect missing tls related method definitions. (#287)
27000ee is described below
commit 27000eeff0f2e82232f10ad4bef07fb65fa43369
Author: Baodi Shi <[email protected]>
AuthorDate: Wed Jun 21 16:58:53 2023 +0800
Perfect missing tls related method definitions. (#287)
---
include/pulsar/c/client_configuration.h | 12 ++++++++++++
tests/c/c_ClientConfigurationTest.cc | 31 +++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+)
diff --git a/include/pulsar/c/client_configuration.h
b/include/pulsar/c/client_configuration.h
index ef1ae24..90a29a6 100644
--- a/include/pulsar/c/client_configuration.h
+++ b/include/pulsar/c/client_configuration.h
@@ -160,6 +160,18 @@ PULSAR_PUBLIC const char
*pulsar_client_configuration_get_tls_trust_certs_file_p
PULSAR_PUBLIC void
pulsar_client_configuration_set_tls_allow_insecure_connection(
pulsar_client_configuration_t *conf, int allowInsecure);
+PULSAR_PUBLIC void pulsar_client_configuration_set_tls_private_key_file_path(
+ pulsar_client_configuration_t *conf, const char *private_key_file_path);
+
+PULSAR_PUBLIC const char
*pulsar_client_configuration_get_tls_private_key_file_path(
+ pulsar_client_configuration_t *conf);
+
+PULSAR_PUBLIC void pulsar_client_configuration_set_tls_certificate_file_path(
+ pulsar_client_configuration_t *conf, const char *certificateFilePath);
+
+PULSAR_PUBLIC const char
*pulsar_client_configuration_get_tls_certificate_file_path(
+ pulsar_client_configuration_t *conf);
+
PULSAR_PUBLIC int pulsar_client_configuration_is_tls_allow_insecure_connection(
pulsar_client_configuration_t *conf);
diff --git a/tests/c/c_ClientConfigurationTest.cc
b/tests/c/c_ClientConfigurationTest.cc
new file mode 100644
index 0000000..f22f28a
--- /dev/null
+++ b/tests/c/c_ClientConfigurationTest.cc
@@ -0,0 +1,31 @@
+/**
+ * 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.
+ */
+#include <gtest/gtest.h>
+
+#include "pulsar/c/client_configuration.h"
+
+TEST(C_ClientConfigurationTest, testCApiConfig) {
+ pulsar_client_configuration_t *conf = pulsar_client_configuration_create();
+
+ pulsar_client_configuration_set_tls_private_key_file_path(conf,
"private.key");
+ pulsar_client_configuration_set_tls_certificate_file_path(conf,
"certificate.pem");
+
+
ASSERT_STREQ(pulsar_client_configuration_get_tls_private_key_file_path(conf),
"private.key");
+
ASSERT_STREQ(pulsar_client_configuration_get_tls_certificate_file_path(conf),
"certificate.pem");
+}