mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 09:31:45 +00:00
Don't use to-be-deprecated names
This commit is contained in:
committed by
Dennis Klein
parent
f15f669853
commit
bfd08bb33f
@@ -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>
|
||||
|
@@ -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>
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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([&]() {
|
||||
|
@@ -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));
|
||||
|
||||
|
@@ -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) {
|
||||
|
@@ -6,7 +6,7 @@
|
||||
* copied verbatim in the file "LICENSE" *
|
||||
********************************************************************************/
|
||||
|
||||
#include <FairMQDevice.h>
|
||||
#include <fairmq/Device.h>
|
||||
|
||||
#include <fairmq/tools/Version.h>
|
||||
|
||||
|
@@ -9,8 +9,8 @@
|
||||
#ifndef FAIR_MQ_TEST_ERROR_STATE_H
|
||||
#define FAIR_MQ_TEST_ERROR_STATE_H
|
||||
|
||||
#include <FairMQDevice.h>
|
||||
#include <FairMQLogger.h>
|
||||
#include <fairmq/Device.h>
|
||||
#include <fairlogger/Logger.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
@@ -9,8 +9,8 @@
|
||||
#ifndef FAIR_MQ_TEST_EXCEPTIONS_H
|
||||
#define FAIR_MQ_TEST_EXCEPTIONS_H
|
||||
|
||||
#include <FairMQDevice.h>
|
||||
#include <FairMQLogger.h>
|
||||
#include <fairmq/Device.h>
|
||||
#include <fairlogger/Logger.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
#ifndef FAIR_MQ_TEST_PAIRLEFT_H
|
||||
#define FAIR_MQ_TEST_PAIRLEFT_H
|
||||
|
||||
#include <FairMQDevice.h>
|
||||
#include <fairmq/Device.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <thread>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
#ifndef FAIR_MQ_TEST_PAIRRIGHT_H
|
||||
#define FAIR_MQ_TEST_PAIRRIGHT_H
|
||||
|
||||
#include <FairMQDevice.h>
|
||||
#include <fairmq/Device.h>
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
@@ -9,17 +9,20 @@
|
||||
#ifndef FAIR_MQ_TEST_POLLIN_H
|
||||
#define FAIR_MQ_TEST_POLLIN_H
|
||||
|
||||
#include <FairMQDevice.h>
|
||||
#include <FairMQLogger.h>
|
||||
#include <fairmq/Device.h>
|
||||
#include <fairmq/ProgOptions.h>
|
||||
|
||||
#include <fairlogger/Logger.h>
|
||||
|
||||
#include <thread>
|
||||
|
||||
namespace fair::mq::test
|
||||
{
|
||||
|
||||
using namespace std;
|
||||
using namespace fair::mq;
|
||||
|
||||
class PollIn : public FairMQDevice
|
||||
class PollIn : public Device
|
||||
{
|
||||
public:
|
||||
PollIn()
|
||||
@@ -35,12 +38,12 @@ class PollIn : public FairMQDevice
|
||||
|
||||
auto Run() -> void override
|
||||
{
|
||||
vector<FairMQChannel*> chans;
|
||||
vector<Channel*> chans;
|
||||
|
||||
chans.push_back(&GetChannel("data1", 0));
|
||||
chans.push_back(&GetChannel("data2", 0));
|
||||
|
||||
FairMQPollerPtr poller = nullptr;
|
||||
PollerPtr poller = nullptr;
|
||||
|
||||
if (fPollType == 0)
|
||||
{
|
||||
@@ -59,8 +62,8 @@ class PollIn : public FairMQDevice
|
||||
bool arrived2 = false;
|
||||
bool bothArrived = false;
|
||||
|
||||
FairMQMessagePtr msg1(NewMessage());
|
||||
FairMQMessagePtr msg2(NewMessage());
|
||||
MessagePtr msg1(NewMessage());
|
||||
MessagePtr msg2(NewMessage());
|
||||
|
||||
while (!bothArrived)
|
||||
{
|
||||
|
@@ -9,7 +9,7 @@
|
||||
#ifndef FAIR_MQ_TEST_POLLOUT_H
|
||||
#define FAIR_MQ_TEST_POLLOUT_H
|
||||
|
||||
#include <FairMQDevice.h>
|
||||
#include <fairmq/Device.h>
|
||||
#include <thread>
|
||||
|
||||
namespace fair::mq::test
|
||||
|
@@ -9,8 +9,8 @@
|
||||
#ifndef FAIR_MQ_TEST_PUB_H
|
||||
#define FAIR_MQ_TEST_PUB_H
|
||||
|
||||
#include <FairMQDevice.h>
|
||||
#include <FairMQLogger.h>
|
||||
#include <fairmq/Device.h>
|
||||
#include <fairlogger/Logger.h>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
|
@@ -9,8 +9,8 @@
|
||||
#ifndef FAIR_MQ_TEST_PULL_H
|
||||
#define FAIR_MQ_TEST_PULL_H
|
||||
|
||||
#include <FairMQDevice.h>
|
||||
#include <FairMQLogger.h>
|
||||
#include <fairmq/Device.h>
|
||||
#include <fairlogger/Logger.h>
|
||||
#include <thread>
|
||||
|
||||
namespace fair::mq::test
|
||||
|
@@ -9,7 +9,7 @@
|
||||
#ifndef FAIR_MQ_TEST_PUSH_H
|
||||
#define FAIR_MQ_TEST_PUSH_H
|
||||
|
||||
#include <FairMQDevice.h>
|
||||
#include <fairmq/Device.h>
|
||||
#include <thread>
|
||||
|
||||
namespace fair::mq::test
|
||||
|
@@ -9,8 +9,8 @@
|
||||
#ifndef FAIR_MQ_TEST_REP_H
|
||||
#define FAIR_MQ_TEST_REP_H
|
||||
|
||||
#include <FairMQDevice.h>
|
||||
#include <FairMQLogger.h>
|
||||
#include <fairmq/Device.h>
|
||||
#include <fairlogger/Logger.h>
|
||||
#include <thread>
|
||||
|
||||
namespace fair::mq::test
|
||||
|
@@ -9,8 +9,8 @@
|
||||
#ifndef FAIR_MQ_TEST_REQ_H
|
||||
#define FAIR_MQ_TEST_REQ_H
|
||||
|
||||
#include <FairMQDevice.h>
|
||||
#include <FairMQLogger.h>
|
||||
#include <fairmq/Device.h>
|
||||
#include <fairlogger/Logger.h>
|
||||
#include <thread>
|
||||
|
||||
namespace fair::mq::test
|
||||
|
@@ -9,8 +9,8 @@
|
||||
#ifndef FAIR_MQ_TEST_SIGNALS_H
|
||||
#define FAIR_MQ_TEST_SIGNALS_H
|
||||
|
||||
#include <FairMQDevice.h>
|
||||
#include <FairMQLogger.h>
|
||||
#include <fairmq/Device.h>
|
||||
#include <fairlogger/Logger.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <csignal>
|
||||
|
@@ -9,8 +9,8 @@
|
||||
#ifndef FAIR_MQ_TEST_SUB_H
|
||||
#define FAIR_MQ_TEST_SUB_H
|
||||
|
||||
#include <FairMQDevice.h>
|
||||
#include <FairMQLogger.h>
|
||||
#include <fairmq/Device.h>
|
||||
#include <fairlogger/Logger.h>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
|
@@ -9,13 +9,16 @@
|
||||
#ifndef FAIR_MQ_TEST_TRANSFERTIMEOUT_H
|
||||
#define FAIR_MQ_TEST_TRANSFERTIMEOUT_H
|
||||
|
||||
#include <FairMQDevice.h>
|
||||
#include <FairMQLogger.h>
|
||||
#include <fairmq/Device.h>
|
||||
|
||||
#include <fairlogger/Logger.h>
|
||||
|
||||
namespace fair::mq::test
|
||||
{
|
||||
|
||||
class TransferTimeout : public FairMQDevice
|
||||
using namespace fair::mq;
|
||||
|
||||
class TransferTimeout : public Device
|
||||
{
|
||||
protected:
|
||||
auto Run() -> void override
|
||||
@@ -38,8 +41,8 @@ class TransferTimeout : public FairMQDevice
|
||||
bool send2PartsCancelingAfter0ms = false;
|
||||
bool receive2PartsCancelingAfter0ms = false;
|
||||
|
||||
FairMQMessagePtr msg1(NewMessage());
|
||||
FairMQMessagePtr msg2(NewMessage());
|
||||
MessagePtr msg1(NewMessage());
|
||||
MessagePtr msg2(NewMessage());
|
||||
|
||||
if (Send(msg1, "data-out", 0, 200) == static_cast<int>(TransferCode::timeout)) {
|
||||
LOG(info) << "send msg canceled (200ms)";
|
||||
@@ -69,9 +72,9 @@ class TransferTimeout : public FairMQDevice
|
||||
LOG(error) << "receive msg did not cancel (0ms)";
|
||||
}
|
||||
|
||||
FairMQParts parts1;
|
||||
Parts parts1;
|
||||
parts1.AddPart(NewMessage(10));
|
||||
FairMQParts parts2;
|
||||
Parts parts2;
|
||||
|
||||
if (Send(parts1, "data-out", 0, 200) == static_cast<int>(TransferCode::timeout)) {
|
||||
LOG(info) << "send 1 part canceled (200ms)";
|
||||
@@ -101,10 +104,10 @@ class TransferTimeout : public FairMQDevice
|
||||
LOG(error) << "receive 1 part did not cancel (0ms)";
|
||||
}
|
||||
|
||||
FairMQParts parts3;
|
||||
Parts parts3;
|
||||
parts3.AddPart(NewMessage(10));
|
||||
parts3.AddPart(NewMessage(10));
|
||||
FairMQParts parts4;
|
||||
Parts parts4;
|
||||
|
||||
if (Send(parts3, "data-out", 0, 200) == static_cast<int>(TransferCode::timeout)) {
|
||||
LOG(info) << "send 2 parts canceled (200ms)";
|
||||
|
@@ -9,8 +9,8 @@
|
||||
#ifndef FAIR_MQ_TEST_WAITFOR_H
|
||||
#define FAIR_MQ_TEST_WAITFOR_H
|
||||
|
||||
#include <FairMQDevice.h>
|
||||
#include <FairMQLogger.h>
|
||||
#include <fairmq/Device.h>
|
||||
#include <fairlogger/Logger.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
@@ -6,7 +6,7 @@
|
||||
* copied verbatim in the file "LICENSE" *
|
||||
********************************************************************************/
|
||||
|
||||
#include <fairmq/FairMQTransportFactory.h>
|
||||
#include <fairmq/TransportFactory.h>
|
||||
#include <fairmq/MemoryResourceTools.h>
|
||||
#include <fairmq/ProgOptions.h>
|
||||
#include <fairmq/tools/Unique.h>
|
||||
@@ -24,7 +24,7 @@ namespace
|
||||
using namespace std;
|
||||
using namespace fair::mq;
|
||||
|
||||
using FactoryType = shared_ptr<FairMQTransportFactory>;
|
||||
using FactoryType = shared_ptr<TransportFactory>;
|
||||
|
||||
struct TestData
|
||||
{
|
||||
@@ -81,8 +81,8 @@ TEST(MemoryResources, transportAllocatorMap)
|
||||
// config.SetProperty<string>("session", to_string(session));
|
||||
config.SetProperty<string>("session", "default");
|
||||
|
||||
FactoryType factoryZMQ = FairMQTransportFactory::CreateTransportFactory("zeromq", fair::mq::tools::Uuid(), &config);
|
||||
FactoryType factorySHM = FairMQTransportFactory::CreateTransportFactory("shmem", fair::mq::tools::Uuid(), &config);
|
||||
FactoryType factoryZMQ = TransportFactory::CreateTransportFactory("zeromq", fair::mq::tools::Uuid(), &config);
|
||||
FactoryType factorySHM = TransportFactory::CreateTransportFactory("shmem", fair::mq::tools::Uuid(), &config);
|
||||
|
||||
auto allocZMQ = factoryZMQ->GetMemoryResource();
|
||||
auto allocSHM = factorySHM->GetMemoryResource();
|
||||
@@ -103,7 +103,7 @@ TEST(MemoryResources, allocator)
|
||||
ProgOptions config;
|
||||
config.SetProperty<string>("session", to_string(session));
|
||||
|
||||
FactoryType factoryZMQ = FairMQTransportFactory::CreateTransportFactory("zeromq", fair::mq::tools::Uuid(), &config);
|
||||
FactoryType factoryZMQ = TransportFactory::CreateTransportFactory("zeromq", fair::mq::tools::Uuid(), &config);
|
||||
|
||||
auto allocZMQ = factoryZMQ->GetMemoryResource();
|
||||
|
||||
@@ -131,12 +131,12 @@ TEST(MemoryResources, getMessage)
|
||||
ProgOptions config;
|
||||
config.SetProperty<string>("session", to_string(session));
|
||||
|
||||
FactoryType factoryZMQ = FairMQTransportFactory::CreateTransportFactory("zeromq", fair::mq::tools::Uuid(), &config);
|
||||
FactoryType factorySHM = FairMQTransportFactory::CreateTransportFactory("shmem", fair::mq::tools::Uuid(), &config);
|
||||
FactoryType factoryZMQ = TransportFactory::CreateTransportFactory("zeromq", fair::mq::tools::Uuid(), &config);
|
||||
FactoryType factorySHM = TransportFactory::CreateTransportFactory("shmem", fair::mq::tools::Uuid(), &config);
|
||||
|
||||
auto allocZMQ = factoryZMQ->GetMemoryResource();
|
||||
|
||||
FairMQMessagePtr message{nullptr};
|
||||
MessagePtr message{nullptr};
|
||||
|
||||
int* messageArray{nullptr};
|
||||
|
||||
|
@@ -6,7 +6,6 @@
|
||||
* copied verbatim in the file "LICENSE" *
|
||||
********************************************************************************/
|
||||
|
||||
#include <fairlogger/Logger.h>
|
||||
#include <fairmq/Channel.h>
|
||||
#include <fairmq/ProgOptions.h>
|
||||
#include <fairmq/tools/Semaphore.h>
|
||||
@@ -15,6 +14,8 @@
|
||||
#include <fairmq/TransportFactory.h>
|
||||
#include <fairmq/shmem/Message.h>
|
||||
|
||||
#include <fairlogger/Logger.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <array>
|
||||
@@ -282,8 +283,8 @@ auto ZeroCopyFromUnmanaged(string const& address) -> void
|
||||
});
|
||||
|
||||
{
|
||||
FairMQChannel push("Push", "push", factory1);
|
||||
FairMQChannel pull("Pull", "pull", factory2);
|
||||
Channel push("Push", "push", factory1);
|
||||
Channel pull("Pull", "pull", factory2);
|
||||
|
||||
push.Bind(address);
|
||||
pull.Connect(address);
|
||||
|
@@ -7,8 +7,8 @@
|
||||
********************************************************************************/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <FairMQParts.h>
|
||||
#include <FairMQTransportFactory.h>
|
||||
#include <fairmq/Parts.h>
|
||||
#include <fairmq/TransportFactory.h>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
@@ -21,11 +21,11 @@ using namespace std;
|
||||
|
||||
class RandomAccessIterator : public ::testing::Test {
|
||||
protected:
|
||||
FairMQParts mParts;
|
||||
shared_ptr<FairMQTransportFactory> mFactory;
|
||||
fair::mq::Parts mParts;
|
||||
shared_ptr<fair::mq::TransportFactory> mFactory;
|
||||
|
||||
RandomAccessIterator()
|
||||
: mFactory(FairMQTransportFactory::CreateTransportFactory("zeromq"))
|
||||
: mFactory(fair::mq::TransportFactory::CreateTransportFactory("zeromq"))
|
||||
{
|
||||
mParts.AddPart(mFactory->NewSimpleMessage("1"));
|
||||
mParts.AddPart(mFactory->NewSimpleMessage("2"));
|
||||
@@ -62,7 +62,7 @@ TEST_F(RandomAccessIterator, RangeForLoopMutation)
|
||||
TEST_F(RandomAccessIterator, ForEachConst)
|
||||
{
|
||||
stringstream out;
|
||||
for_each(mParts.cbegin(), mParts.cend(), [&out](const FairMQMessagePtr& part) {
|
||||
for_each(mParts.cbegin(), mParts.cend(), [&out](const fair::mq::MessagePtr& part) {
|
||||
out << string{static_cast<char*>(part->GetData()), part->GetSize()};
|
||||
});
|
||||
|
||||
|
@@ -9,17 +9,19 @@
|
||||
#ifndef FAIR_MQ_TEST_FIXTURE
|
||||
#define FAIR_MQ_TEST_FIXTURE
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <fairmq/PluginServices.h>
|
||||
#include <FairMQDevice.h>
|
||||
#include <fairmq/Device.h>
|
||||
#include <fairmq/ProgOptions.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <memory>
|
||||
#include <thread>
|
||||
|
||||
namespace fair::mq::test
|
||||
{
|
||||
|
||||
inline auto control(FairMQDevice& device) -> void
|
||||
inline auto control(fair::mq::Device& device) -> void
|
||||
{
|
||||
device.ChangeState(fair::mq::Transition::InitDevice);
|
||||
device.WaitForState(fair::mq::State::InitializingDevice);
|
||||
@@ -42,7 +44,7 @@ struct PluginServices : ::testing::Test {
|
||||
, mServices(mConfig, mDevice)
|
||||
, fRunStateMachineThread()
|
||||
{
|
||||
fRunStateMachineThread = std::thread(&FairMQDevice::RunStateMachine, &mDevice);
|
||||
fRunStateMachineThread = std::thread(&fair::mq::Device::RunStateMachine, &mDevice);
|
||||
mDevice.SetTransport("zeromq");
|
||||
}
|
||||
|
||||
@@ -55,7 +57,7 @@ struct PluginServices : ::testing::Test {
|
||||
}
|
||||
|
||||
fair::mq::ProgOptions mConfig;
|
||||
FairMQDevice mDevice;
|
||||
fair::mq::Device mDevice;
|
||||
fair::mq::PluginServices mServices;
|
||||
std::thread fRunStateMachineThread;
|
||||
};
|
||||
|
@@ -10,7 +10,7 @@
|
||||
#include <fairmq/Plugin.h>
|
||||
#include <fairmq/PluginServices.h>
|
||||
#include <fairmq/tools/Version.h>
|
||||
#include <FairMQDevice.h>
|
||||
#include <fairmq/Device.h>
|
||||
#include <fairmq/ProgOptions.h>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
@@ -24,28 +24,28 @@ namespace _plugin
|
||||
using namespace std;
|
||||
using namespace fair::mq;
|
||||
|
||||
auto control(FairMQDevice& device) -> void
|
||||
auto control(Device& device) -> void
|
||||
{
|
||||
device.SetTransport("zeromq");
|
||||
|
||||
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::ResetDevice);
|
||||
device.WaitForState(fair::mq::State::Idle);
|
||||
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::ResetDevice);
|
||||
device.WaitForState(State::Idle);
|
||||
|
||||
device.ChangeState(fair::mq::Transition::End);
|
||||
device.ChangeState(Transition::End);
|
||||
}
|
||||
|
||||
TEST(Plugin, Operators)
|
||||
{
|
||||
fair::mq::ProgOptions config;
|
||||
FairMQDevice device;
|
||||
ProgOptions config;
|
||||
Device device;
|
||||
PluginServices services{config, device};
|
||||
Plugin p1{"dds", {1, 0, 0}, "Foo Bar <foo.bar@test.net>", "https://git.test.net/dds.git", &services};
|
||||
Plugin p2{"dds", {1, 0, 0}, "Foo Bar <foo.bar@test.net>", "https://git.test.net/dds.git", &services};
|
||||
@@ -61,8 +61,8 @@ TEST(Plugin, Operators)
|
||||
|
||||
TEST(Plugin, OstreamOperators)
|
||||
{
|
||||
fair::mq::ProgOptions config;
|
||||
FairMQDevice device;
|
||||
ProgOptions config;
|
||||
Device device;
|
||||
PluginServices services{config, device};
|
||||
Plugin p1{"dds", {1, 0, 0}, "Foo Bar <foo.bar@test.net>", "https://git.test.net/dds.git", &services};
|
||||
stringstream ss;
|
||||
@@ -77,9 +77,9 @@ TEST(Plugin, OstreamOperators)
|
||||
|
||||
TEST(PluginVersion, Operators)
|
||||
{
|
||||
struct fair::mq::tools::Version v1{1, 0, 0};
|
||||
struct fair::mq::tools::Version v2{1, 0, 0};
|
||||
struct fair::mq::tools::Version v3{1, 2, 0};
|
||||
struct tools::Version v1{1, 0, 0};
|
||||
struct tools::Version v2{1, 0, 0};
|
||||
struct tools::Version v3{1, 2, 0};
|
||||
EXPECT_EQ(v1, v2);
|
||||
EXPECT_NE(v1, v3);
|
||||
EXPECT_GT(v3, v2);
|
||||
|
@@ -9,9 +9,9 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <fairmq/PluginManager.h>
|
||||
#include <fairmq/PluginServices.h>
|
||||
#include <FairMQDevice.h>
|
||||
#include <fairmq/Device.h>
|
||||
#include <fairmq/ProgOptions.h>
|
||||
#include <FairMQLogger.h>
|
||||
#include <fairlogger/Logger.h>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
@@ -25,28 +25,28 @@ using namespace boost::filesystem;
|
||||
using namespace boost::program_options;
|
||||
using namespace std;
|
||||
|
||||
auto control(FairMQDevice& device) -> void
|
||||
auto control(Device& device) -> void
|
||||
{
|
||||
device.SetTransport("zeromq");
|
||||
|
||||
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::ResetDevice);
|
||||
device.WaitForState(fair::mq::State::Idle);
|
||||
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::ResetDevice);
|
||||
device.WaitForState(State::Idle);
|
||||
|
||||
device.ChangeState(fair::mq::Transition::End);
|
||||
device.ChangeState(Transition::End);
|
||||
}
|
||||
|
||||
TEST(PluginManager, LoadPluginDynamic)
|
||||
{
|
||||
fair::mq::ProgOptions config;
|
||||
FairMQDevice device;
|
||||
ProgOptions config;
|
||||
Device device;
|
||||
PluginManager mgr;
|
||||
mgr.EmplacePluginServices(config, device);
|
||||
|
||||
@@ -77,13 +77,13 @@ TEST(PluginManager, LoadPluginDynamic)
|
||||
|
||||
TEST(PluginManager, LoadPluginStatic)
|
||||
{
|
||||
FairMQDevice device;
|
||||
Device device;
|
||||
PluginManager mgr;
|
||||
device.SetTransport("zeromq");
|
||||
|
||||
ASSERT_NO_THROW(mgr.LoadPlugin("s:control"));
|
||||
|
||||
fair::mq::ProgOptions config;
|
||||
ProgOptions config;
|
||||
config.SetProperty<string>("control", "static");
|
||||
config.SetProperty("catch-signals", 0);
|
||||
mgr.EmplacePluginServices(config, device);
|
||||
|
@@ -6,13 +6,14 @@
|
||||
* copied verbatim in the file "LICENSE" *
|
||||
********************************************************************************/
|
||||
|
||||
#include <FairMQLogger.h>
|
||||
#include <FairMQTransportFactory.h>
|
||||
#include <fairmq/TransportFactory.h>
|
||||
#include <fairmq/ProgOptions.h>
|
||||
#include <fairmq/tools/Unique.h>
|
||||
#include <fairmq/tools/Semaphore.h>
|
||||
#include <fairmq/tools/Strings.h>
|
||||
|
||||
#include <fairlogger/Logger.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <memory> // make_unique
|
||||
@@ -22,31 +23,32 @@ namespace
|
||||
{
|
||||
|
||||
using namespace std;
|
||||
using namespace fair::mq;
|
||||
|
||||
void RegionsCache(const string& transport, const string& address)
|
||||
{
|
||||
size_t session1 = fair::mq::tools::UuidHash();
|
||||
size_t session2 = fair::mq::tools::UuidHash();
|
||||
size_t session1 = tools::UuidHash();
|
||||
size_t session2 = tools::UuidHash();
|
||||
|
||||
fair::mq::ProgOptions config1;
|
||||
fair::mq::ProgOptions config2;
|
||||
ProgOptions config1;
|
||||
ProgOptions config2;
|
||||
config1.SetProperty<string>("session", to_string(session1));
|
||||
config2.SetProperty<string>("session", to_string(session2));
|
||||
|
||||
auto factory1 = FairMQTransportFactory::CreateTransportFactory(transport, fair::mq::tools::Uuid(), &config1);
|
||||
auto factory2 = FairMQTransportFactory::CreateTransportFactory(transport, fair::mq::tools::Uuid(), &config2);
|
||||
auto factory1 = TransportFactory::CreateTransportFactory(transport, tools::Uuid(), &config1);
|
||||
auto factory2 = TransportFactory::CreateTransportFactory(transport, tools::Uuid(), &config2);
|
||||
|
||||
auto region1 = factory1->CreateUnmanagedRegion(1000000, [](void*, size_t, void*) {});
|
||||
auto region2 = factory2->CreateUnmanagedRegion(1000000, [](void*, size_t, void*) {});
|
||||
void* r1ptr = region1->GetData();
|
||||
void* r2ptr = region2->GetData();
|
||||
|
||||
FairMQChannel push1("Push1", "push", factory1);
|
||||
FairMQChannel pull1("Pull1", "pull", factory1);
|
||||
Channel push1("Push1", "push", factory1);
|
||||
Channel pull1("Pull1", "pull", factory1);
|
||||
push1.Bind(address + to_string(1));
|
||||
pull1.Connect(address + to_string(1));
|
||||
FairMQChannel push2("Push2", "push", factory2);
|
||||
FairMQChannel pull2("Pull2", "pull", factory2);
|
||||
Channel push2("Push2", "push", factory2);
|
||||
Channel pull2("Pull2", "pull", factory2);
|
||||
push2.Bind(address + to_string(2));
|
||||
pull2.Connect(address + to_string(2));
|
||||
|
||||
@@ -56,27 +58,27 @@ void RegionsCache(const string& transport, const string& address)
|
||||
static_cast<char*>(r2ptr)[0] = 99; // c
|
||||
static_cast<char*>(static_cast<char*>(r2ptr) + 100)[0] = 100; // d
|
||||
|
||||
FairMQMessagePtr m1(push1.NewMessage(region1, r1ptr, 100, nullptr));
|
||||
FairMQMessagePtr m2(push1.NewMessage(region1, static_cast<char*>(r1ptr) + 100, 100, nullptr));
|
||||
MessagePtr m1(push1.NewMessage(region1, r1ptr, 100, nullptr));
|
||||
MessagePtr m2(push1.NewMessage(region1, static_cast<char*>(r1ptr) + 100, 100, nullptr));
|
||||
push1.Send(m1);
|
||||
push1.Send(m2);
|
||||
|
||||
FairMQMessagePtr m3(push2.NewMessage(region2, r2ptr, 100, nullptr));
|
||||
FairMQMessagePtr m4(push2.NewMessage(region2, static_cast<char*>(r2ptr) + 100, 100, nullptr));
|
||||
MessagePtr m3(push2.NewMessage(region2, r2ptr, 100, nullptr));
|
||||
MessagePtr m4(push2.NewMessage(region2, static_cast<char*>(r2ptr) + 100, 100, nullptr));
|
||||
push2.Send(m3);
|
||||
push2.Send(m4);
|
||||
}
|
||||
|
||||
{
|
||||
FairMQMessagePtr m1(pull1.NewMessage());
|
||||
FairMQMessagePtr m2(pull1.NewMessage());
|
||||
MessagePtr m1(pull1.NewMessage());
|
||||
MessagePtr m2(pull1.NewMessage());
|
||||
ASSERT_EQ(pull1.Receive(m1), 100);
|
||||
ASSERT_EQ(pull1.Receive(m2), 100);
|
||||
ASSERT_EQ(static_cast<char*>(m1->GetData())[0], 'a');
|
||||
ASSERT_EQ(static_cast<char*>(m2->GetData())[0], 'b');
|
||||
|
||||
FairMQMessagePtr m3(pull2.NewMessage());
|
||||
FairMQMessagePtr m4(pull2.NewMessage());
|
||||
MessagePtr m3(pull2.NewMessage());
|
||||
MessagePtr m4(pull2.NewMessage());
|
||||
ASSERT_EQ(pull2.Receive(m3), 100);
|
||||
ASSERT_EQ(pull2.Receive(m4), 100);
|
||||
ASSERT_EQ(static_cast<char*>(m3->GetData())[0], 'c');
|
||||
@@ -86,17 +88,17 @@ void RegionsCache(const string& transport, const string& address)
|
||||
|
||||
void RegionEventSubscriptions(const string& transport)
|
||||
{
|
||||
size_t session{fair::mq::tools::UuidHash()};
|
||||
size_t session{tools::UuidHash()};
|
||||
|
||||
fair::mq::ProgOptions config;
|
||||
ProgOptions config;
|
||||
config.SetProperty<string>("session", to_string(session));
|
||||
|
||||
auto factory = FairMQTransportFactory::CreateTransportFactory(transport, fair::mq::tools::Uuid(), &config);
|
||||
auto factory = TransportFactory::CreateTransportFactory(transport, tools::Uuid(), &config);
|
||||
|
||||
constexpr int size1 = 1000000;
|
||||
constexpr int size2 = 5000000;
|
||||
constexpr int64_t userFlags = 12345;
|
||||
fair::mq::tools::Semaphore blocker;
|
||||
tools::Semaphore blocker;
|
||||
|
||||
{
|
||||
auto region1 = factory->CreateUnmanagedRegion(size1, [](void*, size_t, void*) {});
|
||||
@@ -110,14 +112,14 @@ void RegionEventSubscriptions(const string& transport)
|
||||
ASSERT_EQ(region2->GetSize(), size2);
|
||||
|
||||
ASSERT_EQ(factory->SubscribedToRegionEvents(), false);
|
||||
factory->SubscribeToRegionEvents([&, id1, id2, ptr1, ptr2](FairMQRegionInfo info) {
|
||||
factory->SubscribeToRegionEvents([&, id1, id2, ptr1, ptr2](RegionInfo info) {
|
||||
LOG(info) << ">>> " << info.event << ": "
|
||||
<< (info.managed ? "managed" : "unmanaged")
|
||||
<< ", id: " << info.id
|
||||
<< ", ptr: " << info.ptr
|
||||
<< ", size: " << info.size
|
||||
<< ", flags: " << info.flags;
|
||||
if (info.event == FairMQRegionEvent::created) {
|
||||
if (info.event == RegionEvent::created) {
|
||||
if (info.id == id1) {
|
||||
ASSERT_EQ(info.size, size1);
|
||||
ASSERT_EQ(info.ptr, ptr1);
|
||||
@@ -128,7 +130,7 @@ void RegionEventSubscriptions(const string& transport)
|
||||
ASSERT_EQ(info.flags, userFlags);
|
||||
blocker.Signal();
|
||||
}
|
||||
} else if (info.event == FairMQRegionEvent::destroyed) {
|
||||
} else if (info.event == RegionEvent::destroyed) {
|
||||
if (info.id == id1) {
|
||||
blocker.Signal();
|
||||
} else if (info.id == id2) {
|
||||
@@ -157,22 +159,22 @@ void RegionEventSubscriptions(const string& transport)
|
||||
|
||||
void RegionCallbacks(const string& transport, const string& _address)
|
||||
{
|
||||
size_t session(fair::mq::tools::UuidHash());
|
||||
std::string address(fair::mq::tools::ToString(_address, "_", transport));
|
||||
size_t session(tools::UuidHash());
|
||||
std::string address(tools::ToString(_address, "_", transport));
|
||||
|
||||
fair::mq::ProgOptions config;
|
||||
ProgOptions config;
|
||||
config.SetProperty<string>("session", to_string(session));
|
||||
|
||||
auto factory = FairMQTransportFactory::CreateTransportFactory(transport, fair::mq::tools::Uuid(), &config);
|
||||
auto factory = TransportFactory::CreateTransportFactory(transport, tools::Uuid(), &config);
|
||||
|
||||
unique_ptr<int> intPtr1 = make_unique<int>(42);
|
||||
unique_ptr<int> intPtr2 = make_unique<int>(43);
|
||||
fair::mq::tools::Semaphore blocker;
|
||||
tools::Semaphore blocker;
|
||||
|
||||
FairMQChannel push("Push", "push", factory);
|
||||
Channel push("Push", "push", factory);
|
||||
push.Bind(address);
|
||||
|
||||
FairMQChannel pull("Pull", "pull", factory);
|
||||
Channel pull("Pull", "pull", factory);
|
||||
pull.Connect(address);
|
||||
|
||||
void* ptr1 = nullptr;
|
||||
@@ -189,7 +191,7 @@ void RegionCallbacks(const string& transport, const string& _address)
|
||||
});
|
||||
ptr1 = region1->GetData();
|
||||
|
||||
auto region2 = factory->CreateUnmanagedRegion(3000000, [&](const std::vector<fair::mq::RegionBlock>& blocks) {
|
||||
auto region2 = factory->CreateUnmanagedRegion(3000000, [&](const std::vector<RegionBlock>& blocks) {
|
||||
ASSERT_EQ(blocks.size(), 1);
|
||||
ASSERT_EQ(blocks.at(0).ptr, ptr2);
|
||||
ASSERT_EQ(blocks.at(0).size, size2);
|
||||
@@ -200,15 +202,15 @@ void RegionCallbacks(const string& transport, const string& _address)
|
||||
ptr2 = region2->GetData();
|
||||
|
||||
{
|
||||
FairMQMessagePtr msg1out(push.NewMessage(region1, ptr1, size1, intPtr1.get()));
|
||||
FairMQMessagePtr msg2out(push.NewMessage(region2, ptr2, size2, intPtr2.get()));
|
||||
MessagePtr msg1out(push.NewMessage(region1, ptr1, size1, intPtr1.get()));
|
||||
MessagePtr msg2out(push.NewMessage(region2, ptr2, size2, intPtr2.get()));
|
||||
ASSERT_EQ(push.Send(msg1out), size1);
|
||||
ASSERT_EQ(push.Send(msg2out), size2);
|
||||
}
|
||||
|
||||
{
|
||||
FairMQMessagePtr msg1in(pull.NewMessage());
|
||||
FairMQMessagePtr msg2in(pull.NewMessage());
|
||||
MessagePtr msg1in(pull.NewMessage());
|
||||
MessagePtr msg2in(pull.NewMessage());
|
||||
ASSERT_EQ(pull.Receive(msg1in), size1);
|
||||
ASSERT_EQ(pull.Receive(msg2in), size2);
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <fairmq/StateMachine.h>
|
||||
#include <FairMQLogger.h>
|
||||
#include <fairlogger/Logger.h>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
|
@@ -39,7 +39,7 @@ void CheckOldOptionInterface(Channel& channel, const string& option)
|
||||
|
||||
void RunOptionsTest(const string& transport)
|
||||
{
|
||||
fair::mq::ProgOptions config;
|
||||
ProgOptions config;
|
||||
config.SetProperty<string>("session", tools::Uuid());
|
||||
auto factory = TransportFactory::CreateTransportFactory(transport, tools::Uuid(), &config);
|
||||
Channel channel("Push", "push", factory);
|
||||
@@ -85,15 +85,15 @@ void ZeroingAndMlock(const string& transport)
|
||||
|
||||
void ZeroingAndMlockOnCreation(const string& transport)
|
||||
{
|
||||
size_t session{fair::mq::tools::UuidHash()};
|
||||
size_t session{tools::UuidHash()};
|
||||
|
||||
fair::mq::ProgOptions config;
|
||||
ProgOptions config;
|
||||
config.SetProperty<string>("session", to_string(session));
|
||||
config.SetProperty<size_t>("shm-segment-size", 16384); // NOLINT
|
||||
config.SetProperty<bool>("shm-mlock-segment-on-creation", true);
|
||||
config.SetProperty<bool>("shm-zero-segment-on-creation", true);
|
||||
|
||||
auto factory = FairMQTransportFactory::CreateTransportFactory(transport, fair::mq::tools::Uuid(), &config);
|
||||
auto factory = TransportFactory::CreateTransportFactory(transport, tools::Uuid(), &config);
|
||||
|
||||
constexpr size_t size{10000};
|
||||
auto outMsg(factory->CreateMessage(size));
|
||||
|
@@ -9,7 +9,7 @@
|
||||
#include <fairmq/ProgOptions.h>
|
||||
#include <fairmq/shmem/Monitor.h>
|
||||
#include <fairmq/tools/Unique.h>
|
||||
#include <FairMQTransportFactory.h>
|
||||
#include <fairmq/TransportFactory.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
@@ -29,7 +29,7 @@ void GetFreeMemory()
|
||||
|
||||
ASSERT_THROW(shmem::Monitor::GetFreeMemory(shmem::SessionId{sessionId}, 0), shmem::Monitor::MonitorError);
|
||||
|
||||
auto factory = FairMQTransportFactory::CreateTransportFactory("shmem", tools::Uuid(), &config);
|
||||
auto factory = TransportFactory::CreateTransportFactory("shmem", tools::Uuid(), &config);
|
||||
|
||||
ASSERT_NO_THROW(shmem::Monitor::GetFreeMemory(shmem::SessionId{sessionId}, 0));
|
||||
ASSERT_THROW(shmem::Monitor::GetFreeMemory(shmem::SessionId{sessionId}, 1), shmem::Monitor::MonitorError);
|
||||
|
@@ -7,13 +7,16 @@
|
||||
********************************************************************************/
|
||||
|
||||
#include "runner.h"
|
||||
#include <FairMQChannel.h>
|
||||
#include <FairMQLogger.h>
|
||||
#include <FairMQTransportFactory.h>
|
||||
|
||||
#include <fairmq/Channel.h>
|
||||
#include <fairmq/TransportFactory.h>
|
||||
#include <fairmq/ProgOptions.h>
|
||||
#include <fairmq/tools/Process.h>
|
||||
#include <fairmq/tools/Strings.h>
|
||||
#include <fairmq/tools/Unique.h>
|
||||
|
||||
#include <fairlogger/Logger.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <chrono>
|
||||
@@ -24,10 +27,11 @@ namespace
|
||||
{
|
||||
|
||||
using namespace std;
|
||||
using namespace fair::mq;
|
||||
using namespace fair::mq::test;
|
||||
using namespace fair::mq::tools;
|
||||
|
||||
void delayedInterruptor(FairMQTransportFactory& transport)
|
||||
void delayedInterruptor(TransportFactory& transport)
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
transport.Interrupt();
|
||||
@@ -35,7 +39,7 @@ void delayedInterruptor(FairMQTransportFactory& transport)
|
||||
|
||||
auto RunTransferTimeout(string transport) -> void
|
||||
{
|
||||
size_t session{fair::mq::tools::UuidHash()};
|
||||
size_t session{UuidHash()};
|
||||
stringstream cmd;
|
||||
cmd << runTestDevice << " --id transfer_timeout_" << transport << " --control static --transport " << transport
|
||||
<< " --session " << session << " --color false --mq-config \"" << mqConfig << "\"";
|
||||
@@ -48,18 +52,18 @@ auto RunTransferTimeout(string transport) -> void
|
||||
|
||||
void InterruptTransfer(const string& transport, const string& _address)
|
||||
{
|
||||
size_t session{fair::mq::tools::UuidHash()};
|
||||
std::string address(fair::mq::tools::ToString(_address, "_", transport));
|
||||
size_t session{UuidHash()};
|
||||
std::string address(ToString(_address, "_", transport));
|
||||
|
||||
fair::mq::ProgOptions config;
|
||||
config.SetProperty<string>("session", to_string(session));
|
||||
|
||||
auto factory = FairMQTransportFactory::CreateTransportFactory(transport, fair::mq::tools::Uuid(), &config);
|
||||
auto factory = TransportFactory::CreateTransportFactory(transport, Uuid(), &config);
|
||||
|
||||
FairMQChannel pull{"Pull", "pull", factory};
|
||||
Channel pull{"Pull", "pull", factory};
|
||||
pull.Bind(address);
|
||||
|
||||
FairMQMessagePtr msg(pull.NewMessage());
|
||||
MessagePtr msg(pull.NewMessage());
|
||||
|
||||
auto t = thread(delayedInterruptor, ref(*factory));
|
||||
|
||||
|
Reference in New Issue
Block a user