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

Fix tests

parent cf4f7094
No related branches found
No related tags found
2 merge requests!33Release 0.1,!30Debug build
Pipeline #14901 failed
......@@ -41,11 +41,11 @@ typedef boost::log::sources::severity_channel_logger_mt<int, std::string> boost_
class logger {
public:
static boost_logger_class &get() { return *logger::GetInstance()._logger_instance; }
static void destroy() {
static auto destroy() -> void {
auto &instance = logger::GetInstance();
delete instance._logger_instance;
}
static auto get() -> boost_logger_class & { return *logger::GetInstance()._logger_instance; }
private:
logger() { this->_logger_instance = new boost_logger_class(); };
......@@ -56,8 +56,6 @@ private:
boost_logger_class *_logger_instance;
};
auto inline get_logger() -> boost_logger_class & { return logger::get(); }
/**
* This class stores the integer log level.
*/
......@@ -203,17 +201,17 @@ void caosdb_log_trace(const char *channel, const char *msg);
} // namespace caosdb::logging
#define CAOSDB_LOG_FATAL(Channel) \
BOOST_LOG_CHANNEL_SEV(caosdb::logging::get_logger(), Channel, CAOSDB_LOG_LEVEL_FATAL)
BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), Channel, CAOSDB_LOG_LEVEL_FATAL)
#define CAOSDB_LOG_ERROR(Channel) \
BOOST_LOG_CHANNEL_SEV(caosdb::logging::get_logger(), Channel, CAOSDB_LOG_LEVEL_ERROR)
BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), Channel, CAOSDB_LOG_LEVEL_ERROR)
#define CAOSDB_LOG_WARN(Channel) \
BOOST_LOG_CHANNEL_SEV(caosdb::logging::get_logger(), Channel, CAOSDB_LOG_LEVEL_WARN)
BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), Channel, CAOSDB_LOG_LEVEL_WARN)
#define CAOSDB_LOG_INFO(Channel) \
BOOST_LOG_CHANNEL_SEV(caosdb::logging::get_logger(), Channel, CAOSDB_LOG_LEVEL_INFO)
BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), Channel, CAOSDB_LOG_LEVEL_INFO)
#define CAOSDB_LOG_DEBUG(Channel) \
BOOST_LOG_CHANNEL_SEV(caosdb::logging::get_logger(), Channel, CAOSDB_LOG_LEVEL_DEBUG)
BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), Channel, CAOSDB_LOG_LEVEL_DEBUG)
#define CAOSDB_LOG_TRACE(Channel) \
BOOST_LOG_CHANNEL_SEV(caosdb::logging::get_logger(), Channel, CAOSDB_LOG_LEVEL_TRACE)
BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), Channel, CAOSDB_LOG_LEVEL_TRACE)
#define CAOSDB_LOG_ERROR_AND_RETURN_STATUS(Channel, StatusCode, Message) \
CAOSDB_LOG_ERROR(Channel) << "StatusCode (" << StatusCode << ") " \
......
......@@ -44,13 +44,8 @@
#include <utility> // for move
#include <vector>
void __attribute__((constructor)) startup() {
std::cout << "LOADING CAOSDB" << std::endl;
}
void __attribute__((destructor)) shutdown() {
std::cout << "UNLOADING CAOSDB" << std::endl;
caosdb::logging::logger::destroy();
}
void __attribute__((constructor)) startup() {}
void __attribute__((destructor)) shutdown() { caosdb::logging::logger::destroy(); }
namespace caosdb::logging {
......@@ -140,7 +135,7 @@ auto initialize_logging_defaults() -> int {
}
boost::log::init_from_settings(default_settings);
// core->add_global_attribute("TimeStamp", boost::log::attributes::local_clock());
core->add_global_attribute("TimeStamp", boost::log::attributes::local_clock());
CAOSDB_LOG_DEBUG(logger_name) << "Initialized default settings.";
......@@ -176,27 +171,27 @@ auto initialize_logging(const LoggingConfiguration &configuration) -> void {
}
void caosdb_log_fatal(const char *channel, const char *msg) {
BOOST_LOG_CHANNEL_SEV(caosdb::logging::get_logger(), channel, CAOSDB_LOG_LEVEL_FATAL) << msg;
BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), channel, CAOSDB_LOG_LEVEL_FATAL) << msg;
}
void caosdb_log_error(const char *channel, const char *msg) {
BOOST_LOG_CHANNEL_SEV(caosdb::logging::get_logger(), channel, CAOSDB_LOG_LEVEL_ERROR) << msg;
BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), channel, CAOSDB_LOG_LEVEL_ERROR) << msg;
}
void caosdb_log_warn(const char *channel, const char *msg) {
BOOST_LOG_CHANNEL_SEV(caosdb::logging::get_logger(), channel, CAOSDB_LOG_LEVEL_WARN) << msg;
BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), channel, CAOSDB_LOG_LEVEL_WARN) << msg;
}
void caosdb_log_info(const char *channel, const char *msg) {
BOOST_LOG_CHANNEL_SEV(caosdb::logging::get_logger(), channel, CAOSDB_LOG_LEVEL_INFO) << msg;
BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), channel, CAOSDB_LOG_LEVEL_INFO) << msg;
}
void caosdb_log_debug(const char *channel, const char *msg) {
BOOST_LOG_CHANNEL_SEV(caosdb::logging::get_logger(), channel, CAOSDB_LOG_LEVEL_DEBUG) << msg;
BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), channel, CAOSDB_LOG_LEVEL_DEBUG) << msg;
}
void caosdb_log_trace(const char *channel, const char *msg) {
BOOST_LOG_CHANNEL_SEV(caosdb::logging::get_logger(), channel, CAOSDB_LOG_LEVEL_TRACE) << msg;
BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), channel, CAOSDB_LOG_LEVEL_TRACE) << msg;
}
} // namespace caosdb::logging
......@@ -143,16 +143,17 @@ TEST(test_entity, test_append_property) {
}
TEST(test_entity, entity_copy_constructor) {
ProtoParent parent;
parent.set_description("the parent desc");
parent.set_id("the parent id");
parent.set_name("the parent name");
ProtoProperty property;
property.set_id("the-prop-id");
property.set_description("the prop-desc");
property.set_name("the-prop-name");
property.mutable_value()->mutable_list_values()->mutable_values()->Add()->set_double_value(25.5);
property.mutable_data_type()->mutable_list_data_type()->set_atomic_data_type(
Arena arena;
auto *parent = Arena::CreateMessage<ProtoParent>(&arena);
parent->set_description("the parent desc");
parent->set_id("the parent id");
parent->set_name("the parent name");
auto *property = Arena::CreateMessage<ProtoProperty>(&arena);
property->set_id("the-prop-id");
property->set_description("the prop-desc");
property->set_name("the-prop-name");
property->mutable_value()->mutable_list_values()->mutable_values()->Add()->set_double_value(25.5);
property->mutable_data_type()->mutable_list_data_type()->set_atomic_data_type(
ProtoAtomicDataType::ATOMIC_DATA_TYPE_DOUBLE);
auto *entity_response = Arena::CreateMessage<EntityResponse>(&arena);
entity_response->mutable_entity()->set_id("the-id");
......@@ -198,16 +199,17 @@ TEST(test_entity, entity_copy_constructor) {
}
TEST(test_entity, entity_move_constructor) {
ProtoParent parent;
parent.set_description("the parent desc");
parent.set_id("the parent id");
parent.set_name("the parent name");
ProtoProperty property;
property.set_id("the-prop-id");
property.set_description("the prop-desc");
property.set_name("the-prop-name");
property.mutable_value()->mutable_list_values()->mutable_values()->Add()->set_double_value(25.5);
property.mutable_data_type()->mutable_list_data_type()->set_atomic_data_type(
Arena arena;
auto *parent = Arena::CreateMessage<ProtoParent>(&arena);
parent->set_description("the parent desc");
parent->set_id("the parent id");
parent->set_name("the parent name");
auto *property = Arena::CreateMessage<ProtoProperty>(&arena);
property->set_id("the-prop-id");
property->set_description("the prop-desc");
property->set_name("the-prop-name");
property->mutable_value()->mutable_list_values()->mutable_values()->Add()->set_double_value(25.5);
property->mutable_data_type()->mutable_list_data_type()->set_atomic_data_type(
ProtoAtomicDataType::ATOMIC_DATA_TYPE_DOUBLE);
auto *entity_response = Arena::CreateMessage<EntityResponse>(&arena);
entity_response->mutable_errors()->Add()->set_code(25);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment