Skip to content
Snippets Groups Projects

Minimal c interface

Merged Timm Fitschen requested to merge f-extern-c into dev
All threads resolved!
2 files
+ 14
17
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 12
15
@@ -20,33 +20,30 @@
*
*/
#include <gtest/gtest-message.h> // for Message
#include <gtest/gtest-test-part.h> // for TestPartResult, SuiteApiRes...
#include <memory> // for allocator, operator!=, shar...
#include "caosdb/connection.h" // for PemCACertProvider, Insecure...
#include "grpcpp/security/credentials.h" // for ChannelCredentials
#include "gtest/gtest_pred_impl.h" // for Test, AssertionResult, EXPE...
#include <gtest/gtest-message.h> // for Message
#include <gtest/gtest-test-part.h> // for TestPartResult, SuiteApiRes...
#include <memory> // for allocator, operator!=, shar...
#include "caosdb/connection.h" // for PemCACertProvider, Insecure...
#include "gtest/gtest_pred_impl.h" // for Test, AssertionResult, EXPE...
namespace caosdb::connection {
TEST(test_connection, configure_insecure_localhost_8080) {
InsecureCaosDBConnectionConfig config("localhost", 8000);
EXPECT_EQ("localhost", config.getHost());
EXPECT_EQ(8000, config.getPort());
std::shared_ptr<grpc::ChannelCredentials> icc =
config.getChannelCredentials();
EXPECT_EQ("localhost", config.GetHost());
EXPECT_EQ(8000, config.GetPort());
auto icc = config.GetChannelCredentials();
EXPECT_TRUE(icc != nullptr);
}
TEST(test_connection, configure_ssl_localhost_8080) {
auto cacert = std::make_shared<PemCACertProvider>("ca chain");
auto cacert = PemCACertProvider("ca chain");
SslCaosDBConnectionConfig config("localhost", 44300, cacert);
EXPECT_EQ("localhost", config.getHost());
EXPECT_EQ(44300, config.getPort());
std::shared_ptr<grpc::ChannelCredentials> sslcc =
config.getChannelCredentials();
EXPECT_EQ("localhost", config.GetHost());
EXPECT_EQ(44300, config.GetPort());
auto sslcc = config.GetChannelCredentials();
EXPECT_TRUE(sslcc != nullptr);
}
Loading