diff --git a/CHANGELOG.md b/CHANGELOG.md index bce87d5256020c3749631f19cd18d4b0538593b1..10652f17f2f515bb408d91ffc2f18564c7452f1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -* Initial release. - ### Changed ### Deprecated diff --git a/CMakeLists.txt b/CMakeLists.txt index dadeb33ea056c981c000061646d16d5f534091be..5efa13e5f7d352a02a4755176e73f440f5c61a45 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -177,7 +177,7 @@ target_link_libraries(ccaosdb ${CONAN_LIBS} ) -add_executable(ccaosdbcli src/ccaosdbcli.c) +add_executable(ccaosdbcli EXCLUDE_FROM_ALL src/ccaosdbcli.c) target_include_directories(ccaosdbcli PUBLIC $<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/include> $<BUILD_INTERFACE:${libcaosdb_BINARY_DIR}/include> @@ -189,7 +189,7 @@ target_link_libraries(ccaosdbcli ${CONAN_LIBS} ) -add_executable(cxxcaosdbcli src/cxxcaosdbcli.cpp) +add_executable(cxxcaosdbcli EXCLUDE_FROM_ALL src/cxxcaosdbcli.cpp) target_include_directories(cxxcaosdbcli PUBLIC $<BUILD_INTERFACE:${libcaosdb_SOURCE_DIR}/include> $<BUILD_INTERFACE:${libcaosdb_BINARY_DIR}/include> diff --git a/include/caosdb/configuration.h b/include/caosdb/configuration.h index 6426ab4b9e5b6dbfebb3cce4d67983df58a57a6a..80bc927018cb625d045e4f7379555b5a90d7b9b5 100644 --- a/include/caosdb/configuration.h +++ b/include/caosdb/configuration.h @@ -26,9 +26,10 @@ #include "boost/json/object.hpp" // for object #include "boost/json/value.hpp" // for value #include "boost/json/value_ref.hpp" // IWYU pragma: keep -#include "caosdb/authentication.h" // for Authenticator, PlainPassw... -#include "caosdb/certificate_provider.h" // for CertificateProvider, path -#include "caosdb/exceptions.h" // for ConfigurationError +// IWYU pragma: no_include "boost/json/fwd.hpp" +#include "caosdb/authentication.h" // for Authenticator, PlainPassw... +#include "caosdb/certificate_provider.h" // for CertificateProvider, path +#include "caosdb/exceptions.h" // for ConfigurationError #include "caosdb/logging.h" #include "caosdb/utility.h" // for load_json_file #include "grpcpp/security/credentials.h" // for ChannelCredentials diff --git a/include/caosdb/entity.h b/include/caosdb/entity.h index 99f38591fe6426c6a6b6ca1aad26d6bce5fa1aa4..4249b91b275902a5b155484922b552d0d5238d67 100644 --- a/include/caosdb/entity.h +++ b/include/caosdb/entity.h @@ -446,7 +446,6 @@ public: auto AppendProperty(const Property &property) -> void; auto AppendParent(const Parent &parent) -> void; - auto Switch(ProtoEntity *entity) -> void; /** * Copy all of this entity's features to the target ProtoEntity. */ diff --git a/proto b/proto index daf705ef4e86c30f96b3aac429a66667f50c7b77..36d7956b6eca506fb87096d8d50b6f4b820778b8 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit daf705ef4e86c30f96b3aac429a66667f50c7b77 +Subproject commit 36d7956b6eca506fb87096d8d50b6f4b820778b8 diff --git a/src/caosdb/entity.cpp b/src/caosdb/entity.cpp index 999ba3753b068909dc7dd54518ca5ff8bd8033bf..1d616663642c11737228ce02b4e1fd15fc8d77a6 100644 --- a/src/caosdb/entity.cpp +++ b/src/caosdb/entity.cpp @@ -177,13 +177,6 @@ auto Entity::SetVersionId(const std::string &id) -> void { this->wrapped->mutable_version()->set_id(id); } -// TODO(tf) Re-implement s.th. properties and parents are kept. -auto Entity::Switch(ProtoEntity *entity) -> void { - this->wrapped->Swap(entity); - this->wrapped->Clear(); - this->wrapped = entity; -} - auto Entity::CopyTo(ProtoEntity *target) -> void { target->CopyFrom(*(this->wrapped)); } diff --git a/src/caosdb/transaction.cpp b/src/caosdb/transaction.cpp index b9482232c63e55c6fb545d4b9e2ffa35ae7c13aa..e900560a6989654cdae701b41e323f908477357a 100644 --- a/src/caosdb/transaction.cpp +++ b/src/caosdb/transaction.cpp @@ -144,8 +144,9 @@ auto Transaction::InsertEntity(Entity *entity) noexcept -> StatusCode { auto Transaction::Execute() -> TransactionStatus { ExecuteAsynchronously(); - this->status.ThrowExceptionIfError(); - return this->status; + auto status = WaitForIt(); + status.ThrowExceptionIfError(); + return status; } auto Transaction::ExecuteAsynchronously() noexcept -> StatusCode { diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index fc8e134ea90db40f0d67fde6f44de9ca826adcd8..389d5d919f8200a77ea1ffb93267c11ac70baf75 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -36,7 +36,7 @@ set(test_cases # special linting for tests set(_CMAKE_CXX_CLANG_TIDY_TEST_CHECKS - "${_CMAKE_CXX_CLANG_TIDY_CHECKS},-cert-err58-cpp,-cppcoreguidelines-avoid-non-const-global-variables,-cppcoreguidelines-owning-memory,-modernize-use-trailing-return-type,-google-readability-avoid-underscore-in-googletest-name,-cppcoreguidelines-avoid-magic-numbers,-readability-magic-numbers,-cppcoreguidelines-avoid-goto,-hicpp-avoid-goto" + "${_CMAKE_CXX_CLANG_TIDY_CHECKS},-cert-err58-cpp,-cppcoreguidelines-avoid-non-const-global-variables,-cppcoreguidelines-owning-memory,-modernize-use-trailing-return-type,-google-readability-avoid-underscore-in-googletest-name,-cppcoreguidelines-avoid-magic-numbers,-readability-magic-numbers,-cppcoreguidelines-avoid-goto,-hicpp-avoid-goto,-readability-function-cognitive-complexity" ) # add special cmake functions for gtest diff --git a/test/test_configuration.cpp b/test/test_configuration.cpp index 3c047850e82da2a30039cc0c46361542284af38b..abc797fbe97fb408e0ff05ea5deab2a8581f194a 100644 --- a/test/test_configuration.cpp +++ b/test/test_configuration.cpp @@ -38,8 +38,7 @@ protected: void TearDown() override { ConfigurationManager::Clear(); } }; -// TODO(tf) cogintive complexity > 25 (threshold) -TEST_F(test_configuration, load_json) { // NOLINT +TEST_F(test_configuration, load_json) { ConfigurationManager::LoadSingleJSONConfiguration(TEST_DATA_DIR + "/test_caosdb_client.json"); EXPECT_THROW_MESSAGE( @@ -53,9 +52,7 @@ TEST_F(test_configuration, load_json) { // NOLINT ConfigurationManager::Clear(); } -// TODO(tf) cognitive complexity again -TEST_F(test_configuration, // NOLINT - get_default_connection_configuration_error) { // NOLINT +TEST_F(test_configuration, get_default_connection_configuration_error) { EXPECT_THROW_MESSAGE(ConfigurationManager::GetDefaultConnectionName(), ConfigurationError, "This CaosDB client has not been configured."); diff --git a/test/test_connection.cpp b/test/test_connection.cpp index 6c5fa0b58f224233a1826d7605a8c94e8270a7e9..7c2efab9566d58c709c060e4206fc0d193ac75df 100644 --- a/test/test_connection.cpp +++ b/test/test_connection.cpp @@ -65,8 +65,7 @@ TEST_F(test_connection, configure_ssl_localhost_8080) { EXPECT_TRUE(sslcc != nullptr); } -// TODO(tf) cognitive complexity > 25 (threshold) -TEST_F(test_connection, connection_manager_unknown_connection) { // NOLINT +TEST_F(test_connection, connection_manager_unknown_connection) { EXPECT_THROW_MESSAGE(ConnectionManager::GetConnection("test"), caosdb::exceptions::UnknownConnectionError, "No connection named 'test' present."); diff --git a/test/test_entity.cpp b/test/test_entity.cpp index ec117968e3a8d72304eacd27663889cf1cd156f0..6a24ab7cb11ae59e6a0cbffed499286c773a399f 100644 --- a/test/test_entity.cpp +++ b/test/test_entity.cpp @@ -78,8 +78,7 @@ TEST(test_entity, test_property_setters) { EXPECT_EQ(prop.GetDatatype(), "prop_dtype"); } -// TODO(fspreck) cognitive complexity > 25 (threshold) -TEST(test_entity, test_append_property) { // NOLINT +TEST(test_entity, test_append_property) { auto entity = Entity(); auto prop = Property(); @@ -151,8 +150,7 @@ TEST(test_entity, test_insert_entity) { EXPECT_EQ(entity.GetVersionId(), "version_id"); } -// TODO(fspreck) cognitive complexity > 25 (threshold) -TEST(test_entity, test_insert_with_role) { // NOLINT +TEST(test_entity, test_insert_with_role) { auto transaction = caosdb::transaction::Transaction( std::shared_ptr<transaction::EntityTransactionService::Stub>(nullptr)); @@ -201,8 +199,7 @@ TEST(test_entity, test_insert_with_parent) { EXPECT_EQ(inserted_parent.GetName(), parent.GetName()); } -// TODO(fspreck) cognitive complexity > 25 (threshold) -TEST(test_entity, test_insert_with_property) { // NOLINT +TEST(test_entity, test_insert_with_property) { auto transaction = caosdb::transaction::Transaction( std::shared_ptr<transaction::EntityTransactionService::Stub>(nullptr)); @@ -233,8 +230,7 @@ TEST(test_entity, test_insert_with_property) { // NOLINT EXPECT_EQ(prop.GetDatatype(), inserted_prop.GetDatatype()); } -// TODO(tf) cognitive complexity > 25 (threshold) -TEST(test_entity, test_from_id_response) { // NOLINT +TEST(test_entity, test_from_id_response) { IdResponse idResponse; idResponse.set_id("entity_id"); auto *error = idResponse.add_entity_errors(); diff --git a/test/test_protobuf.cpp b/test/test_protobuf.cpp index 61b85c89ae1fc1f5ee0a101ff4f8b4438275648f..9dc957a2f85cd95ce3ead5f59ab8c10868582003 100644 --- a/test/test_protobuf.cpp +++ b/test/test_protobuf.cpp @@ -29,8 +29,7 @@ namespace caosdb { using caosdb::entity::v1alpha1::Entity; using caosdb::entity::v1alpha1::Message; -// TODO(tf) cognitive complexity > 25 (threshold) -TEST(test_protobuf, test_swap_trivial) { // NOLINT +TEST(test_protobuf, test_swap_trivial) { Message message_source; message_source.set_code(1234); message_source.set_description("desc"); @@ -50,8 +49,7 @@ TEST(test_protobuf, test_swap_trivial) { // NOLINT EXPECT_EQ(message_destination.description(), "desc"); } -// TODO(tf) cognitive complexity again -TEST(test_protobuf, test_swap_nested) { // NOLINT +TEST(test_protobuf, test_swap_nested) { Entity entity_source; entity_source.set_id("entity_id"); auto *version_source = entity_source.mutable_version(); diff --git a/test/test_transaction.cpp b/test/test_transaction.cpp index b0f77d074d5d3bbcef2c05d020378992061a98d5..118208595ea5d100dacb8302be555772c8fcd80e 100644 --- a/test/test_transaction.cpp +++ b/test/test_transaction.cpp @@ -41,8 +41,7 @@ using caosdb::exceptions::ConnectionError; using caosdb::transaction::UniqueResult; using ProtoEntity = caosdb::entity::v1alpha1::Entity; -// TODO(tf) cognitive complexity > 25 (threshold) -TEST(test_transaction, create_transaction) { // NOLINT +TEST(test_transaction, create_transaction) { const auto *host = "localhost"; auto configuration = InsecureConnectionConfiguration(host, 8000); Connection connection(configuration);