Don't use to-be-deprecated names

This commit is contained in:
Alexey Rybalchenko
2022-01-14 00:48:34 +01:00
committed by Dennis Klein
parent f15f669853
commit bfd08bb33f
90 changed files with 411 additions and 391 deletions

View File

@@ -9,8 +9,8 @@
#ifndef FAIR_MQ_TEST_TESTRECEIVER_H
#define FAIR_MQ_TEST_TESTRECEIVER_H
#include <FairMQDevice.h>
#include <FairMQLogger.h>
#include <fairmq/Device.h>
#include <fairlogger/Logger.h>
#include <string>
#include <thread>

View File

@@ -9,8 +9,8 @@
#ifndef FAIR_MQ_TEST_TESTSENDER_H
#define FAIR_MQ_TEST_TESTSENDER_H
#include <FairMQDevice.h>
#include <FairMQLogger.h>
#include <fairmq/Device.h>
#include <fairlogger/Logger.h>
#include <string>
#include <thread>

View File

@@ -6,7 +6,7 @@
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#include <FairMQDevice.h>
#include <fairmq/Device.h>
#include <fairmq/DeviceRunner.h>
#include <fairmq/ProgOptions.h>
@@ -19,52 +19,53 @@ namespace _config
{
using namespace std;
using namespace fair::mq;
void control(FairMQDevice& device)
void control(Device& device)
{
device.ChangeState(fair::mq::Transition::InitDevice);
device.WaitForState(fair::mq::State::InitializingDevice);
device.ChangeState(fair::mq::Transition::CompleteInit);
device.WaitForState(fair::mq::State::Initialized);
device.ChangeState(fair::mq::Transition::Bind);
device.WaitForState(fair::mq::State::Bound);
device.ChangeState(fair::mq::Transition::Connect);
device.WaitForState(fair::mq::State::DeviceReady);
device.ChangeState(fair::mq::Transition::InitTask);
device.WaitForState(fair::mq::State::Ready);
device.ChangeState(Transition::InitDevice);
device.WaitForState(State::InitializingDevice);
device.ChangeState(Transition::CompleteInit);
device.WaitForState(State::Initialized);
device.ChangeState(Transition::Bind);
device.WaitForState(State::Bound);
device.ChangeState(Transition::Connect);
device.WaitForState(State::DeviceReady);
device.ChangeState(Transition::InitTask);
device.WaitForState(State::Ready);
device.ChangeState(fair::mq::Transition::Run);
device.WaitForState(fair::mq::State::Ready);
device.ChangeState(Transition::Run);
device.WaitForState(State::Ready);
device.ChangeState(fair::mq::Transition::ResetTask);
device.WaitForState(fair::mq::State::DeviceReady);
device.ChangeState(fair::mq::Transition::ResetDevice);
device.WaitForState(fair::mq::State::Idle);
device.ChangeState(Transition::ResetTask);
device.WaitForState(State::DeviceReady);
device.ChangeState(Transition::ResetDevice);
device.WaitForState(State::Idle);
device.ChangeState(fair::mq::Transition::End);
device.ChangeState(Transition::End);
}
class TestDevice : public FairMQDevice
class TestDevice : public Device
{
public:
TestDevice(const string& transport)
{
fDeviceThread = thread(&FairMQDevice::RunStateMachine, this);
fDeviceThread = thread(&Device::RunStateMachine, this);
SetTransport(transport);
ChangeState(fair::mq::Transition::InitDevice);
WaitForState(fair::mq::State::InitializingDevice);
ChangeState(fair::mq::Transition::CompleteInit);
WaitForState(fair::mq::State::Initialized);
ChangeState(fair::mq::Transition::Bind);
WaitForState(fair::mq::State::Bound);
ChangeState(fair::mq::Transition::Connect);
WaitForState(fair::mq::State::DeviceReady);
ChangeState(fair::mq::Transition::InitTask);
WaitForState(fair::mq::State::Ready);
ChangeState(Transition::InitDevice);
WaitForState(State::InitializingDevice);
ChangeState(Transition::CompleteInit);
WaitForState(State::Initialized);
ChangeState(Transition::Bind);
WaitForState(State::Bound);
ChangeState(Transition::Connect);
WaitForState(State::DeviceReady);
ChangeState(Transition::InitTask);
WaitForState(State::Ready);
ChangeState(fair::mq::Transition::Run);
ChangeState(Transition::Run);
}
TestDevice(const TestDevice&) = delete;
@@ -74,15 +75,15 @@ class TestDevice : public FairMQDevice
~TestDevice() override
{
WaitForState(fair::mq::State::Running);
ChangeState(fair::mq::Transition::Stop);
WaitForState(fair::mq::State::Ready);
ChangeState(fair::mq::Transition::ResetTask);
WaitForState(fair::mq::State::DeviceReady);
ChangeState(fair::mq::Transition::ResetDevice);
WaitForState(fair::mq::State::Idle);
WaitForState(State::Running);
ChangeState(Transition::Stop);
WaitForState(State::Ready);
ChangeState(Transition::ResetTask);
WaitForState(State::DeviceReady);
ChangeState(Transition::ResetDevice);
WaitForState(State::Idle);
ChangeState(fair::mq::Transition::End);
ChangeState(Transition::End);
if (fDeviceThread.joinable()) {
fDeviceThread.join();
@@ -100,7 +101,7 @@ class Config : public ::testing::Test
string TestDeviceSetConfig(const string& transport)
{
fair::mq::ProgOptions config;
ProgOptions config;
vector<string> emptyArgs = {"dummy", "--id", "test", "--color", "false"};
@@ -108,10 +109,10 @@ class Config : public ::testing::Test
config.SetProperty("transport", transport);
FairMQDevice device;
Device device;
device.SetConfig(config);
FairMQChannel channel;
Channel channel;
channel.UpdateType("pub");
channel.UpdateMethod("connect");
channel.UpdateAddress("tcp://localhost:5558");
@@ -130,14 +131,14 @@ class Config : public ::testing::Test
string TestDeviceSetConfigWithPlugins(const string& transport)
{
fair::mq::ProgOptions config;
ProgOptions config;
vector<string> emptyArgs = {"dummy", "--id", "test", "--color", "false"};
config.SetProperty("transport", transport);
FairMQDevice device;
fair::mq::PluginManager mgr;
Device device;
PluginManager mgr;
mgr.LoadPlugin("s:config");
mgr.ForEachPluginProgOptions([&](boost::program_options::options_description options) {
config.AddToCmdLineOptions(options);
@@ -146,10 +147,10 @@ class Config : public ::testing::Test
mgr.InstantiatePlugins();
config.ParseAll(emptyArgs, true);
fair::mq::DeviceRunner::HandleGeneralOptions(config);
DeviceRunner::HandleGeneralOptions(config);
device.SetConfig(config);
FairMQChannel channel;
Channel channel;
channel.UpdateType("pub");
channel.UpdateMethod("connect");
channel.UpdateAddress("tcp://localhost:5558");
@@ -177,16 +178,16 @@ class Config : public ::testing::Test
string TestDeviceSetTransport(const string& transport)
{
FairMQDevice device;
Device device;
device.SetTransport(transport);
FairMQChannel channel;
Channel channel;
channel.UpdateType("pub");
channel.UpdateMethod("connect");
channel.UpdateAddress("tcp://localhost:5558");
device.AddChannel("data", std::move(channel));
thread t(&FairMQDevice::RunStateMachine, &device);
thread t(&Device::RunStateMachine, &device);
control(device);

View File

@@ -12,7 +12,7 @@
#include <boost/process.hpp>
#include <fairmq/tools/Process.h>
#include <fairmq/tools/Unique.h>
#include <FairMQDevice.h>
#include <fairmq/Device.h>
#include <string>
#include <thread>
@@ -22,24 +22,25 @@ namespace
{
using namespace std;
using namespace fair::mq;
using namespace fair::mq::test;
using namespace fair::mq::tools;
class BadDevice : public FairMQDevice
class BadDevice : public Device
{
public:
BadDevice()
{
fDeviceThread = thread([&](){
EXPECT_THROW(RunStateMachine(), fair::mq::MessageError);
EXPECT_THROW(RunStateMachine(), MessageError);
});
SetTransport("shmem");
ChangeState(fair::mq::Transition::InitDevice);
WaitForState(fair::mq::State::InitializingDevice);
ChangeState(fair::mq::Transition::CompleteInit);
WaitForState(fair::mq::State::Initialized);
ChangeState(Transition::InitDevice);
WaitForState(State::InitializingDevice);
ChangeState(Transition::CompleteInit);
WaitForState(State::Initialized);
parts.AddPart(NewMessage());
}
@@ -51,7 +52,7 @@ class BadDevice : public FairMQDevice
~BadDevice() override
{
ChangeState(fair::mq::Transition::ResetDevice);
ChangeState(Transition::ResetDevice);
if (fDeviceThread.joinable()) {
fDeviceThread.join();
@@ -60,12 +61,12 @@ class BadDevice : public FairMQDevice
private:
thread fDeviceThread;
FairMQParts parts;
Parts parts;
};
void RunErrorStateIn(const string& state, const string& control, const string& input = "")
{
size_t session{fair::mq::tools::UuidHash()};
size_t session{tools::UuidHash()};
execute_result result{"", 100};
thread device_thread([&]() {

View File

@@ -21,7 +21,7 @@ namespace
using namespace std;
using namespace fair::mq;
void control(FairMQDevice& device)
void control(Device& device)
{
thread t([&] {
device.ChangeState(Transition::InitDevice);
@@ -62,7 +62,7 @@ class MultipleDevices : public ::testing::Test {
test::Sender sender("data");
sender.SetTransport("zeromq");
FairMQChannel channel("push", "connect", "ipc://multiple-devices-test");
Channel channel("push", "connect", "ipc://multiple-devices-test");
channel.UpdateRateLogging(0);
sender.AddChannel("data", std::move(channel));
@@ -75,7 +75,7 @@ class MultipleDevices : public ::testing::Test {
test::Receiver receiver("data");
receiver.SetTransport("zeromq");
FairMQChannel channel("pull", "bind", "ipc://multiple-devices-test");
Channel channel("pull", "bind", "ipc://multiple-devices-test");
channel.UpdateRateLogging(0);
receiver.AddChannel("data", std::move(channel));

View File

@@ -6,8 +6,8 @@
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#include <FairMQDevice.h>
#include <FairMQLogger.h>
#include <fairmq/Device.h>
#include <fairlogger/Logger.h>
#include <gtest/gtest.h>
@@ -20,7 +20,7 @@ namespace
using namespace std;
using namespace fair::mq;
class SlowDevice : public FairMQDevice
class SlowDevice : public Device
{
public:
SlowDevice() = default;
@@ -34,7 +34,7 @@ class SlowDevice : public FairMQDevice
void transitionTo(const vector<State>& states, int numExpectedStates)
{
FairMQDevice device;
Device device;
thread t([&] {
for (const auto& s : states) {

View File

@@ -6,7 +6,7 @@
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#include <FairMQDevice.h>
#include <fairmq/Device.h>
#include <fairmq/tools/Version.h>