Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions include/pulsar/c/client_configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
31 changes: 31 additions & 0 deletions tests/c/c_ClientConfigurationTest.cc
Original file line number Diff line number Diff line change
@@ -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");
}