mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 09:31:45 +00:00
SDK: Pass CSession as shared ptr
Even though it is copyable the copy does not work.
This commit is contained in:
@@ -6,8 +6,8 @@
|
||||
* copied verbatim in the file "LICENSE" *
|
||||
********************************************************************************/
|
||||
|
||||
#ifndef FAIR_MQ_TEST_TOPOLOGYFIXTURE
|
||||
#define FAIR_MQ_TEST_TOPOLOGYFIXTURE
|
||||
#ifndef FAIR_MQ_TEST_FIXTURES
|
||||
#define FAIR_MQ_TEST_FIXTURES
|
||||
|
||||
#include "TestEnvironment.h"
|
||||
#include <fairmq/SDK.h>
|
||||
@@ -51,10 +51,6 @@ struct TopologyFixture : ::testing::Test
|
||||
mDDSSession.StopOnDestruction();
|
||||
}
|
||||
|
||||
// auto ActivateDDSTopology(const std::string& topology_file) -> void {
|
||||
// LOG(debug) << "ActivateDDSTopology(\"" << topology_file << "\")";
|
||||
// }
|
||||
|
||||
auto SetUp() -> void override {
|
||||
LOG(info) << mDDSEnv;
|
||||
LOG(info) << mDDSSession;
|
||||
@@ -78,5 +74,5 @@ struct TopologyFixture : ::testing::Test
|
||||
} /* namespace mq */
|
||||
} /* namespace fair */
|
||||
|
||||
#endif /* FAIR_MQ_TEST_TOPOLOGYFIXTURE */
|
||||
#endif /* FAIR_MQ_TEST_FIXTURES */
|
||||
|
@@ -6,41 +6,44 @@
|
||||
* copied verbatim in the file "LICENSE" *
|
||||
********************************************************************************/
|
||||
|
||||
#include <TestEnvironment.h>
|
||||
#include <fairlogger/Logger.h>
|
||||
#include <fairmq/sdk/DDSEnvironment.h>
|
||||
#include <fairmq/sdk/DDSInfo.h>
|
||||
#include <fairmq/sdk/DDSSession.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include "Fixtures.h"
|
||||
|
||||
#include <DDS/Topology.h>
|
||||
#include <DDS/Tools.h>
|
||||
|
||||
namespace {
|
||||
|
||||
auto setup() -> void
|
||||
TEST(DDSEnvironment, Construction)
|
||||
{
|
||||
fair::Logger::SetConsoleSeverity("debug");
|
||||
fair::Logger::DefineVerbosity("user1",
|
||||
fair::VerbositySpec::Make(fair::VerbositySpec::Info::timestamp_us,
|
||||
fair::VerbositySpec::Info::severity));
|
||||
fair::Logger::SetVerbosity("user1");
|
||||
fair::Logger::SetConsoleColor();
|
||||
}
|
||||
|
||||
TEST(DDS, Environment)
|
||||
{
|
||||
setup();
|
||||
fair::mq::test::LoggerConfig cfg;
|
||||
|
||||
fair::mq::sdk::DDSEnvironment env(CMAKE_CURRENT_BINARY_DIR);
|
||||
LOG(debug) << env;
|
||||
}
|
||||
|
||||
TEST(DDS, Session)
|
||||
TEST(DDSSession, Construction)
|
||||
{
|
||||
setup();
|
||||
|
||||
fair::mq::test::LoggerConfig cfg;
|
||||
fair::mq::sdk::DDSEnvironment env(CMAKE_CURRENT_BINARY_DIR);
|
||||
|
||||
fair::mq::sdk::DDSSession session(env);
|
||||
session.StopOnDestruction();
|
||||
LOG(debug) << session;
|
||||
}
|
||||
|
||||
TEST(DDSSession, Construction2)
|
||||
{
|
||||
fair::mq::test::LoggerConfig cfg;
|
||||
fair::mq::sdk::DDSEnvironment env(CMAKE_CURRENT_BINARY_DIR);
|
||||
|
||||
auto nativeSession(std::make_shared<dds::tools_api::CSession>());
|
||||
nativeSession->create();
|
||||
|
||||
fair::mq::sdk::DDSSession session(nativeSession, env);
|
||||
session.StopOnDestruction();
|
||||
LOG(debug) << session;
|
||||
|
||||
session.RequestCommanderInfo();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@@ -6,7 +6,7 @@
|
||||
* copied verbatim in the file "LICENSE" *
|
||||
********************************************************************************/
|
||||
|
||||
#include "TopologyFixture.h"
|
||||
#include "Fixtures.h"
|
||||
|
||||
#include <DDS/Topology.h>
|
||||
#include <DDS/Tools.h>
|
||||
@@ -20,13 +20,15 @@ using Topology = fair::mq::test::TopologyFixture;
|
||||
TEST(Topology2, ConstructionWithNativeDdsApiObjects)
|
||||
{
|
||||
// This is only needed for this unit test
|
||||
fair::mq::test::LoggerConfig cfg;
|
||||
fair::mq::sdk::DDSEnv env(CMAKE_CURRENT_BINARY_DIR);
|
||||
/////////////////////////////////////////
|
||||
|
||||
// Example usage:
|
||||
dds::topology_api::CTopology nativeTopo(fair::mq::tools::ToString(SDK_TESTSUITE_SOURCE_DIR, "/test_topo.xml"));
|
||||
dds::tools_api::CSession nativeSession;
|
||||
nativeSession.create();
|
||||
fair::mq::sdk::Topology topo(nativeTopo, nativeSession, env);
|
||||
auto nativeSession(std::make_shared<dds::tools_api::CSession>());
|
||||
nativeSession->create();
|
||||
EXPECT_THROW(fair::mq::sdk::Topology topo(nativeTopo, nativeSession, env), std::runtime_error);
|
||||
}
|
||||
|
||||
TEST_F(Topology, Construction)
|
||||
|
Reference in New Issue
Block a user