diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9de5ef9f..4931c972 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -287,14 +287,14 @@ if(BUILD_SDK) add_testsuite(SDK SOURCES ${CMAKE_CURRENT_BINARY_DIR}/runner.cxx - sdk/_dds.cxx + # sdk/_dds.cxx sdk/_topology.cxx sdk/TopologyFixture.h LINKS SDK Tools - DDS::dds_tools_lib + DDS::dds_topology_lib INCLUDES ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} TIMEOUT 15 diff --git a/test/sdk/TopologyFixture.h b/test/sdk/TopologyFixture.h index 95b5f6cc..8aab2475 100644 --- a/test/sdk/TopologyFixture.h +++ b/test/sdk/TopologyFixture.h @@ -9,22 +9,25 @@ #ifndef FAIR_MQ_TEST_TOPOLOGYFIXTURE #define FAIR_MQ_TEST_TOPOLOGYFIXTURE -#include -#include -#include +#include "TestEnvironment.h" #include +#include + +#include +#include +#include +#include #include +#include +#include namespace fair { namespace mq { namespace test { -struct Topology : ::testing::Test +struct LoggerConfig { - Topology() - : mDDSTopologyFile(std::string(SDK_TESTSUITE_SOURCE_DIR) + "/test_topo.xml") - , mDDSEnv(CMAKE_CURRENT_BINARY_DIR) - , mDDSSession(mDDSEnv) + LoggerConfig() { Logger::SetConsoleSeverity("debug"); Logger::DefineVerbosity("user1", @@ -32,27 +35,23 @@ struct Topology : ::testing::Test VerbositySpec::Info::severity)); Logger::SetVerbosity("user1"); Logger::SetConsoleColor(); + + std::string path(std::getenv("PATH")); + path = tools::ToString(FAIRMQ_TEST_ENVIRONMENT, ":", path); + setenv("PATH", path.c_str(), 1); } -// - // auto WaitForIdleDDSAgents(int required) -> void { - // LOG(debug) << "WaitForIdleDDSAgents(" << required << ")"; -// - // DDS Agent Info request - // dds::tools_api::SAgentInfoRequestData agentInfoInfo; - // auto agentInfoRequest = dds::tools_api::SAgentInfoRequest::makeRequest(agentInfoInfo); - // agentInfoRequest->setResponseCallback( - // [&](const dds::tools_api::SAgentInfoResponseData& _response) { - // LOG(debug) << "agent: " << _response.m_index << "/" << _response.m_activeAgentsCount; - // LOG(debug) << "info: " << _response.m_agentInfo; - // }); - // agentInfoRequest->setMessageCallback( - // [](const dds::tools_api::SMessageResponseData& _message) { LOG(debug) << _message; }); - // agentInfoRequest->setDoneCallback([&]() { - // mActiveDDSOps.Signal(); - // }); - // mDDSSession.sendRequest(agentInfoRequest); - // mActiveDDSOps.Wait(); - // } +}; + +struct TopologyFixture : ::testing::Test +{ + TopologyFixture() + : mLoggerConfig() + , mDDSTopologyFile(std::string(SDK_TESTSUITE_SOURCE_DIR) + "/test_topo.xml") + , mDDSEnv(CMAKE_CURRENT_BINARY_DIR) + , mDDSSession(mDDSEnv) + , mDDSTopology(mDDSTopologyFile) + {} + // // // auto ActivateDDSTopology(const std::string& topology_file) -> void { // LOG(debug) << "ActivateDDSTopology(\"" << topology_file << "\")"; @@ -60,15 +59,19 @@ struct Topology : ::testing::Test auto SetUp() -> void override { LOG(info) << mDDSEnv; - mDDSSession.SubmitAgents(1); - mDDSSession.SubmitAgents(1); + LOG(info) << mDDSSession; + mDDSSession.SubmitAgents(2); + std::this_thread::sleep_for(std::chrono::seconds(1)); + mDDSSession.ActivateTopology(mDDSTopologyFile); } auto TearDown() -> void override {} + LoggerConfig mLoggerConfig; std::string mDDSTopologyFile; sdk::DDSEnvironment mDDSEnv; sdk::DDSSession mDDSSession; + dds::topology_api::CTopology mDDSTopology; }; } /* namespace test */ diff --git a/test/sdk/_topology.cxx b/test/sdk/_topology.cxx index bf1db46d..42bf6bba 100644 --- a/test/sdk/_topology.cxx +++ b/test/sdk/_topology.cxx @@ -6,16 +6,17 @@ * copied verbatim in the file "LICENSE" * ********************************************************************************/ -// #include "TopologyFixture.h" +#include "TopologyFixture.h" -// #include -#include +#include namespace { +using Topology = fair::mq::test::TopologyFixture; -// TEST_F(Topology, Basic) { fair::mq::sdk::Topology topo; } -// TEST_F(Topology, Basic2) { fair::mq::sdk::Topology topo; } - +TEST_F(Topology, Basic) +{ + fair::mq::sdk::Topology topo; +} } // namespace diff --git a/test/sdk/test_topo.xml b/test/sdk/test_topo.xml index b2a3cc61..0a83d889 100644 --- a/test/sdk/test_topo.xml +++ b/test/sdk/test_topo.xml @@ -1,49 +1,33 @@ - - + - - @EX_BIN_DIR@/fairmq-ex-dds-sampler --id sampler --color false --channel-config name=data1,type=push,method=bind -S "<@DDS_PLUGIN_LIB_DIR@/" -P dds + fairmq-bsampler --id sampler --color false --channel-config name=data,type=push,method=bind -P dds --msg-rate 10 SamplerWorker - data1 - - - - - @EX_BIN_DIR@/fairmq-ex-dds-processor --id processor_%taskIndex% --config-key processor --color false --channel-config name=data1,type=pull,method=connect name=data2,type=push,method=connect -S "<@DDS_PLUGIN_LIB_DIR@/" -P dds - - ProcessorWorker - - - data1 - data2 + data - @EX_BIN_DIR@/fairmq-ex-dds-sink --id sink --color false --channel-config name=data2,type=pull,method=bind -S "<@DDS_PLUGIN_LIB_DIR@/" -P dds + fairmq-sink --id sink --color false --channel-config name=data,type=pull,method=connect -P dds SinkWorker - data2 + data
Sampler Sink - - Processor -