Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
@@ -15,8 +15,7 @@
|
||||
#include <QThread>
|
||||
|
||||
|
||||
DataTopicTests::DataTopicTests()
|
||||
: m_domainParticipantPub(nullptr)
|
||||
DataTopicTests::DataTopicTests() : m_domainParticipantPub(nullptr)
|
||||
, m_domainParticipantSub(nullptr)
|
||||
, m_domainId(0)
|
||||
, m_partitionId(1)
|
||||
@@ -26,12 +25,12 @@ DataTopicTests::DataTopicTests()
|
||||
, m_subscriberListener(nullptr)
|
||||
, m_dtcTestPart(nullptr)
|
||||
, m_mainThreadId(QThread::currentThreadId())
|
||||
.getNGLLogger("UnitTests.DataTopicTests"))
|
||||
{
|
||||
.getNGLLogger("UnitTests.DataTopicTests")),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
if (!DDS::QosProfile::setDefault())
|
||||
ERROR_LOG() << "Error setting default QoS from xml-file ";
|
||||
ERROR_LOG(m_logger) << "Error setting default QoS from xml-file ";
|
||||
|
||||
DEBUG_LOG() << "Main thread ID is " << m_mainThreadId;
|
||||
DEBUG_LOG(m_logger) << "Main thread ID is " << m_mainThreadId;
|
||||
}
|
||||
|
||||
DataTopicTests::~DataTopicTests()
|
||||
@@ -65,7 +64,7 @@ bool DataTopicTests::initPublisher()
|
||||
partitionQos.name( { partition.toStdString() } );
|
||||
publisherQos << partitionQos;
|
||||
|
||||
DEBUG_LOG() << "Publish on partition " << partition;
|
||||
DEBUG_LOG(m_logger) << "Publish on partition " << partition;
|
||||
|
||||
m_ddsPublisher = dds::pub::Publisher(m_domainParticipantPub, publisherQos);
|
||||
m_testPart = new DTS::TestParticipantImpl(m_domainParticipantPub, m_ddsPublisher);
|
||||
@@ -75,8 +74,8 @@ bool DataTopicTests::initPublisher()
|
||||
|
||||
bool DataTopicTests::write(const DdsUnitTests::TestParticipant &data)
|
||||
{
|
||||
INFO_LOG() << "Publish topic TestParticipant ";
|
||||
DEBUG_LOG() << "ParticipantId: " << data.location().participantId()
|
||||
INFO_LOG(m_logger) << "Publish topic TestParticipant ";
|
||||
DEBUG_LOG(m_logger) << "ParticipantId: " << data.location().participantId()
|
||||
<< ", equipNo = " << data.location().equipNo();
|
||||
|
||||
return m_testPart->write(data);
|
||||
@@ -88,7 +87,7 @@ bool DataTopicTests::write(const DdsUnitTests::TestParticipant &data)
|
||||
|
||||
bool DataTopicTests::initSubscriber()
|
||||
{
|
||||
DEBUG_LOG() << "Initialisation DDS (Subscriber/Reader)";
|
||||
DEBUG_LOG(m_logger) << "Initialisation DDS (Subscriber/Reader)";
|
||||
|
||||
m_domainParticipantSub =
|
||||
dds::domain::DomainParticipant(m_domainId,
|
||||
@@ -108,7 +107,7 @@ bool DataTopicTests::initSubscriber()
|
||||
partitionQos.name( partitions );
|
||||
subscriberQos << partitionQos;
|
||||
|
||||
DEBUG_LOG() << "Initialise DTC::SubscriberListener";
|
||||
DEBUG_LOG(m_logger) << "Initialise DTC::SubscriberListener";
|
||||
m_subscriberListener = new DDSGeneric::SubscriberListener();
|
||||
m_ddsSubscriber = dds::sub::Subscriber(m_domainParticipantSub,
|
||||
subscriberQos,
|
||||
@@ -142,10 +141,10 @@ void DataTopicTests::deleteSubscriber()
|
||||
|
||||
void DataTopicTests::processData(const DdsUnitTests::TestParticipant &instance, const dds::sub::SampleInfo &si)
|
||||
{
|
||||
INFO_LOG() << "process data in topic TestParticipant, Sampleinfo: " << si.source_timestamp().sec();
|
||||
INFO_LOG(m_logger) << "process data in topic TestParticipant, Sampleinfo: " << si.source_timestamp().sec();
|
||||
|
||||
DEBUG_LOG() << "participantId: " << instance.location().participantId();
|
||||
DEBUG_LOG() << "equipNo: " << instance.location().equipNo();
|
||||
DEBUG_LOG(m_logger) << "participantId: " << instance.location().participantId();
|
||||
DEBUG_LOG(m_logger) << "equipNo: " << instance.location().equipNo();
|
||||
|
||||
m_receivedParticipantData = instance;
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void processData(const DdsUnitTests::TestParticipant &instance, const dds::sub::SampleInfo &si);
|
||||
|
||||
Q_SIGNALS:
|
||||
|
||||
@@ -33,7 +33,7 @@ DataTopicTestsMain::DataTopicTestsMain()
|
||||
|
||||
void DataTopicTestsMain::initTestCase()
|
||||
{
|
||||
DEBUG_LOG() <<"DataTopicTestsMain: initTestCase";
|
||||
DEBUG_LOG(m_logger) <<"DataTopicTestsMain: initTestCase";
|
||||
|
||||
m_dtTest = new DataTopicTests();
|
||||
QVERIFY2(m_dtTest, "Initialisation of DataTopicTest failed");
|
||||
@@ -46,20 +46,20 @@ void DataTopicTestsMain::initTestCase()
|
||||
|
||||
void DataTopicTestsMain::publishTestCase()
|
||||
{
|
||||
DEBUG_LOG() <<"DataTopicTestsMain: publish TestParticipant";
|
||||
DEBUG_LOG(m_logger) <<"DataTopicTestsMain: publish TestParticipant";
|
||||
|
||||
m_sentParticipantData.location().participantId(100);
|
||||
m_sentParticipantData.location().equipNo(1010);
|
||||
m_sentParticipantData.testId(100);
|
||||
QVERIFY2(m_dtTest->write(m_sentParticipantData), "Publishing Topic TestParticipant failed");
|
||||
|
||||
DEBUG_LOG() <<"DataTopicTestsMain: publish ready";
|
||||
DEBUG_LOG(m_logger) <<"DataTopicTestsMain: publish ready";
|
||||
}
|
||||
|
||||
|
||||
void DataTopicTestsMain::subscribeTestCase()
|
||||
{
|
||||
DEBUG_LOG() << "IN subscribeTestCase";
|
||||
DEBUG_LOG(m_logger) << "IN subscribeTestCase";
|
||||
|
||||
QTRY_COMPARE(m_participantDataArrivedSpy->count(), 1);
|
||||
|
||||
@@ -95,7 +95,7 @@ void DataTopicTestsMain::deleteDataReaderTestCase()
|
||||
|
||||
void DataTopicTestsMain::cleanupTestCase()
|
||||
{
|
||||
DEBUG_LOG() <<"DataTopicTestsMain: cleanupTestCase";
|
||||
DEBUG_LOG(m_logger) <<"DataTopicTestsMain: cleanupTestCase";
|
||||
delete m_dtTest; m_dtTest = nullptr;
|
||||
delete m_participantDataArrivedSpy; m_participantDataArrivedSpy = nullptr;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ private Q_SLOTS:
|
||||
|
||||
protected:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
private:
|
||||
DdsUnitTests::TestParticipant m_sentParticipantData;
|
||||
QSignalSpy *m_participantDataArrivedSpy = nullptr;
|
||||
|
||||
@@ -27,10 +27,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
FunctionTopicTests::FunctionTopicTests()
|
||||
: m_mainThreadId(QThread::currentThreadId())
|
||||
.getNGLLogger("UnitTests.FunctionTopicTests"))
|
||||
{
|
||||
FunctionTopicTests::FunctionTopicTests() : m_mainThreadId(QThread::currentThreadId())
|
||||
.getNGLLogger("UnitTests.FunctionTopicTests")),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
qRegisterMetaType<DdsUnitTests::FunctionReply>("DdsUnitTests::FunctionReply");
|
||||
qRegisterMetaType<DdsUnitTests::FunctionReplyWithState>("DdsUnitTests::FunctionReplyWithState");
|
||||
}
|
||||
@@ -38,7 +37,7 @@ FunctionTopicTests::FunctionTopicTests()
|
||||
|
||||
void FunctionTopicTests::initTestCase()
|
||||
{
|
||||
DEBUG_LOG() <<"FunctionTopicTests: initTestCase";
|
||||
DEBUG_LOG(m_logger) <<"FunctionTopicTests: initTestCase";
|
||||
|
||||
const int domainId = 0;
|
||||
|
||||
@@ -97,7 +96,7 @@ void FunctionTopicTests::requestWithState()
|
||||
QSignalSpy spyRequest(this, &FunctionTopicTests::functionTopicRequestFinished);
|
||||
QSignalSpy spyReply(this, &FunctionTopicTests::functionTopicReply);
|
||||
|
||||
DEBUG_LOG() <<"FunctionTopicTests: request";
|
||||
DEBUG_LOG(m_logger) <<"FunctionTopicTests: request";
|
||||
|
||||
|
||||
DdsUnitTests::FunctionRequestWithState data;
|
||||
@@ -125,7 +124,7 @@ void FunctionTopicTests::requestTestCase2()
|
||||
QSignalSpy spyRequest(this, &FunctionTopicTests::functionTopicRequestFinished);
|
||||
QSignalSpy spyReply(this, &FunctionTopicTests::functionTopicReply);
|
||||
|
||||
DEBUG_LOG() <<"FunctionTopicTests: request";
|
||||
DEBUG_LOG(m_logger) <<"FunctionTopicTests: request";
|
||||
|
||||
|
||||
DdsUnitTests::FunctionRequest data;
|
||||
@@ -149,7 +148,7 @@ void FunctionTopicTests::requestTestCase2()
|
||||
|
||||
void FunctionTopicTests::cleanupTestCase()
|
||||
{
|
||||
DEBUG_LOG() <<"FunctionTopicTests: cleanupTestCase";
|
||||
DEBUG_LOG(m_logger) <<"FunctionTopicTests: cleanupTestCase";
|
||||
|
||||
m_fts = nullptr;
|
||||
m_ftc = nullptr;
|
||||
@@ -165,7 +164,7 @@ void FunctionTopicTests::onFunctionTopicRequest(const rti::core::SampleIdentity
|
||||
{
|
||||
QCOMPARE(m_mainThreadId, QThread::currentThreadId());
|
||||
|
||||
INFO_LOG() << "Got function topic request (with status member)";
|
||||
INFO_LOG(m_logger) << "Got function topic request (with status member)";
|
||||
m_requestTopicWithState = request;
|
||||
QCOMPARE(m_requestTopicWithState.id(), 1);
|
||||
QCOMPARE(m_requestTopicWithState.info().get(), std::string("Test request"));
|
||||
@@ -173,7 +172,7 @@ void FunctionTopicTests::onFunctionTopicRequest(const rti::core::SampleIdentity
|
||||
|
||||
DdsUnitTests::FunctionReplyWithState reply;
|
||||
|
||||
DEBUG_LOG() << "Send sample with status REPLY_COMPLETED";
|
||||
DEBUG_LOG(m_logger) << "Send sample with status REPLY_COMPLETED";
|
||||
reply.id(1);
|
||||
reply.errorString("Hello");
|
||||
reply.replyState(Core::FtReplyState::Completed);
|
||||
@@ -191,7 +190,7 @@ void FunctionTopicTests::onFunctionTopicRequest(const rti::core::SampleIdentity
|
||||
{
|
||||
QCOMPARE(m_mainThreadId, QThread::currentThreadId());
|
||||
|
||||
INFO_LOG() << "Got function topic request (without status member)";
|
||||
INFO_LOG(m_logger) << "Got function topic request (without status member)";
|
||||
|
||||
m_requestTopic = request;
|
||||
|
||||
@@ -214,7 +213,7 @@ void FunctionTopicTests::slotRequestedData(const DdsUnitTests::FunctionTopicTest
|
||||
Q_UNUSED(seqNo);
|
||||
QCOMPARE(m_mainThreadId, QThread::currentThreadId());
|
||||
|
||||
INFO_LOG() << "Got reply from FTS: " << reply.replyState();
|
||||
INFO_LOG(m_logger) << "Got reply from FTS: " << reply.replyState();
|
||||
|
||||
m_replyTopicWithState = reply;
|
||||
|
||||
|
||||
@@ -48,9 +48,11 @@ protected Q_SLOTS:
|
||||
const DdsUnitTests::FunctionRequestWithState &request);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void requestWithState();
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::unique_ptr<FTS::FunctionTopicTest> m_fts;
|
||||
std::unique_ptr<FTS::FunctionTopicTestWithState> m_ftsWS;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ GenericDataTests::GenericDataTests()
|
||||
|
||||
void GenericDataTests::initTestCase()
|
||||
{
|
||||
DEBUG_LOG() <<"GenericDataTests: initTestCase";
|
||||
DEBUG_LOG(m_logger) <<"GenericDataTests: initTestCase";
|
||||
|
||||
m_init = new Initialisation();
|
||||
|
||||
@@ -81,7 +81,7 @@ void GenericDataTests::initDWTestCase()
|
||||
|
||||
void GenericDataTests::dataWriterTestCase()
|
||||
{
|
||||
DEBUG_LOG() <<"GenericDataTests: dataWriter";
|
||||
DEBUG_LOG(m_logger) <<"GenericDataTests: dataWriter";
|
||||
|
||||
|
||||
DdsUnitTests::SpatialData data;
|
||||
@@ -125,7 +125,7 @@ void GenericDataTests::dataWriterTestCase()
|
||||
|
||||
void GenericDataTests::dataReaderTestCase()
|
||||
{
|
||||
DEBUG_LOG() << "GenericDataTests: dataReader";
|
||||
DEBUG_LOG(m_logger) << "GenericDataTests: dataReader";
|
||||
|
||||
|
||||
QTRY_COMPARE(m_spatialData.equipNo(), 999);
|
||||
@@ -136,7 +136,7 @@ void GenericDataTests::dataReaderTestCase()
|
||||
|
||||
bool bSeenUnreadSamples = false;
|
||||
dds::sub::LoanedSamples<DdsUnitTests::TestParticipant> vecTp = m_dataReader->readAlive(bSeenUnreadSamples);
|
||||
INFO_LOG() <<"vecTp size: " << vecTp.length();
|
||||
INFO_LOG(m_logger) <<"vecTp size: " << vecTp.length();
|
||||
QCOMPARE(vecTp.length(), static_cast<decltype(vecTp.length())>(5));
|
||||
QCOMPARE(vecTp[0].data().id(), 10000);
|
||||
QCOMPARE(vecTp[1].data().id(), 11000);
|
||||
@@ -145,7 +145,7 @@ void GenericDataTests::dataReaderTestCase()
|
||||
QCOMPARE(vecTp[4].data().id(), 11111);
|
||||
|
||||
dds::sub::LoanedSamples<DdsUnitTests::TestParticipant> vecTpLoaned = m_dataReader->takeAlive(bSeenUnreadSamples);
|
||||
INFO_LOG() <<"vecTpLoaned size: " << vecTp.length();
|
||||
INFO_LOG(m_logger) <<"vecTpLoaned size: " << vecTp.length();
|
||||
QCOMPARE(vecTpLoaned.length(), static_cast<decltype(vecTpLoaned.length())>(5));
|
||||
QCOMPARE(vecTpLoaned[0].data().id(), 10000);
|
||||
QCOMPARE(vecTpLoaned[1].data().id(), 11000);
|
||||
@@ -177,7 +177,7 @@ void GenericDataTests::deleteDataReaderTestCase()
|
||||
|
||||
void GenericDataTests::cleanupTestCase()
|
||||
{
|
||||
DEBUG_LOG() <<"GenericDataTests: cleanupTestCase";
|
||||
DEBUG_LOG(m_logger) <<"GenericDataTests: cleanupTestCase";
|
||||
if (m_dataReader)
|
||||
{
|
||||
m_init->getSubscriberListener()->removeCallback(m_dataReader->getDataReader(), this);
|
||||
@@ -198,21 +198,21 @@ void GenericDataTests::cleanupTestCase()
|
||||
|
||||
void GenericDataTests::processData(const DdsUnitTests::SpatialData &data, DataModification modType)
|
||||
{
|
||||
DEBUG_LOG() << "SpatialData: equipNo = " << data.equipNo() << " modType: " << modType;
|
||||
DEBUG_LOG(m_logger) << "SpatialData: equipNo = " << data.equipNo() << " modType: " << modType;
|
||||
m_spatialData = data;
|
||||
}
|
||||
|
||||
void GenericDataTests::processData(const DdsUnitTests::TestParticipant &data, const dds::sub::SampleInfo &si)
|
||||
{
|
||||
Q_UNUSED(si);
|
||||
DEBUG_LOG() << "TestParticipant: equipNo = " << data.location().equipNo();
|
||||
DEBUG_LOG(m_logger) << "TestParticipant: equipNo = " << data.location().equipNo();
|
||||
m_testPart = data;
|
||||
}
|
||||
|
||||
void GenericDataTests::droDataAvailable(const std::string &topicType, const std::string &topicName)
|
||||
{
|
||||
Q_UNUSED(topicName)
|
||||
DEBUG_LOG() << "IN droDataAvailable: type = " << topicType;
|
||||
DEBUG_LOG(m_logger) << "IN droDataAvailable: type = " << topicType;
|
||||
if (topicType == "DdsUnitTests::TestParticipant")
|
||||
{
|
||||
m_init->getSubscriberListener()->enableCallback(m_dataReader->getDataReader(), this);
|
||||
|
||||
@@ -34,6 +34,7 @@ private Q_SLOTS:
|
||||
void cleanupTestCase();
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void droDataAvailable(const std::string &topicType, const std::string &topicName) override;
|
||||
void noWriterAnymore(const std::string &topicType, const std::string &topicName) override
|
||||
{
|
||||
|
||||
@@ -8,18 +8,17 @@
|
||||
#include <Lts/Common/ProjectConfig/project_defines.h>
|
||||
|
||||
|
||||
Initialisation::Initialisation()
|
||||
: m_domainParticipant(nullptr)
|
||||
Initialisation::Initialisation() : m_domainParticipant(nullptr)
|
||||
, m_domainParticipantSub(nullptr)
|
||||
, m_domainId(0)
|
||||
, m_exerciseId(-1)
|
||||
, m_ddsPublisher(nullptr)
|
||||
, m_ddsSubscriber(nullptr)
|
||||
, m_subListener(new DDSGeneric::SubscriberListener)
|
||||
.getNGLLogger("UnitTests.Initialisation"))
|
||||
{
|
||||
.getNGLLogger("UnitTests.Initialisation")),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
if (!DDS::QosProfile::setDefault())
|
||||
ERROR_LOG() << "Error setting default QoS from xml-file ";
|
||||
ERROR_LOG(m_logger) << "Error setting default QoS from xml-file ";
|
||||
|
||||
}
|
||||
|
||||
@@ -52,7 +51,7 @@ bool Initialisation::initDDS(int domainId, int exerciseId, PubSub pubsub)
|
||||
{
|
||||
dds::pub::qos::PublisherQos publisherQos = m_domainParticipant.default_publisher_qos();
|
||||
|
||||
DEBUG_LOG() << "Publish on partition " << IDL::exercisePartition(exerciseId);
|
||||
DEBUG_LOG(m_logger) << "Publish on partition " << IDL::exercisePartition(exerciseId);
|
||||
|
||||
|
||||
dds::core::policy::Partition partitionQos;
|
||||
@@ -74,7 +73,7 @@ bool Initialisation::initDDS(int domainId, int exerciseId, PubSub pubsub)
|
||||
|
||||
dds::sub::qos::SubscriberQos subscriberQos = domainPart.default_subscriber_qos();
|
||||
|
||||
DEBUG_LOG() << "Subsribing on partition " << IDL::exercisePartition(exerciseId);
|
||||
DEBUG_LOG(m_logger) << "Subsribing on partition " << IDL::exercisePartition(exerciseId);
|
||||
|
||||
|
||||
dds::core::policy::Partition partitionQos;
|
||||
|
||||
@@ -33,6 +33,7 @@ public:
|
||||
DDSGeneric::SubscriberListener *getSubscriberListener() { return m_subListener; }
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
dds::domain::DomainParticipant m_domainParticipant;
|
||||
dds::domain::DomainParticipant m_domainParticipantSub;
|
||||
int m_domainId;
|
||||
|
||||
Reference in new issue
Block a user