Skip to content
Snippets Groups Projects
Verified Commit 4fca47f9 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

ENH: basic c interface

parent 9655d9df
No related branches found
No related tags found
1 merge request!1Minimal c interface
Pipeline #10238 failed
This commit is part of merge request !1. Comments created here will be created in the context of that merge request.
......@@ -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);
}
......
......@@ -39,8 +39,8 @@ using caosdb::transaction::UniqueResult;
using ProtoEntity = caosdb::entity::v1alpha1::Entity;
TEST(test_transaction, create_transaction) {
const auto *pHost = "localhost";
auto config = std::make_shared<InsecureCaosDBConnectionConfig>(pHost, 8000);
const auto *host = "localhost";
auto config = InsecureCaosDBConnectionConfig(host, 8000);
CaosDBConnection connection(config);
auto transaction = connection.CreateTransaction();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment