mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 17:41:45 +00:00
Tests.SDK: Implement Topology test fixture
This commit is contained in:
committed by
Dennis Klein
parent
cfcdd666bf
commit
53be96d93c
@@ -9,22 +9,25 @@
|
||||
#ifndef FAIR_MQ_TEST_TOPOLOGYFIXTURE
|
||||
#define FAIR_MQ_TEST_TOPOLOGYFIXTURE
|
||||
|
||||
#include <DDS/Topology.h>
|
||||
#include <TestEnvironment.h>
|
||||
#include <fairlogger/Logger.h>
|
||||
#include "TestEnvironment.h"
|
||||
#include <fairmq/sdk/DDSSession.h>
|
||||
#include <fairmq/Tools.h>
|
||||
|
||||
#include <DDS/Topology.h>
|
||||
#include <chrono>
|
||||
#include <cstdlib>
|
||||
#include <fairlogger/Logger.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <stdlib.h>
|
||||
#include <thread>
|
||||
|
||||
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<dds::tools_api::SAgentInfoRequest>(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 */
|
||||
|
Reference in New Issue
Block a user