Qt6 Migration: Complete migration with DDS/RTI support and build validation

Major Changes:
- Merged latest Qt5 devel content from dlbo (292 files changed, 7 new dirs)
- Consolidated forward-declarations and include folders
- Removed unneeded modules per Niklas' repo check list

Build System Fixes:
- Fixed CMake VERSION_GREATER syntax in ParticipantManagement/CMakeLists.txt
- Added VLC packages (libvlc-dev, vlc-plugin-base) to docker_build.sh
- Added PostgreSQL dev packages (libpq-dev, postgresql-server-dev-all) to Dockerfile
- Fixed locale warnings (ANSI_X3.4-1968 → C.UTF-8)
- Fixed ArcGIS SDK path warnings when BUILD_ARCGIS=OFF

Code Generation Fixes:
- Fixed IDL enum collisions (PortType→CorePortType/DdsutPortType, PdmEventType)
- Fixed Grantlee template svc_translation.cpp.grantlee:
  - Changed {{ idl_enum.name }}_def:: to {{ idl_enum.name }}::
  - Fixed .underlying() calls for C++11 scoped enums (enum class)
- Removed generated files from repo (moc_*, *_dtc.h, *_ftc.h)

Validation:
- BUILD_RTI=ON: SUCCESS
- BUILD_RTI=OFF: SUCCESS
- C++17 standard maintained for RTI 7.7 compatibility
- Ubuntu 26.04 Docker environment verified

Remaining Warnings (expected):
- BgViewer, KDChart, KDReports, Poppler-Qt6 not found (optional features)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
torstenandCopilot committed 2026-09-15 18:20:26 +00:00
1 parent f23384bb68
commit 7173785915
18662 files changed
+4115092 -5435

No files matched your search

@@ -0,0 +1,261 @@
/**
* Unit test for function topic server / client (fts/ftc)
* $Id$
* $HeadURL$
* $Author$
*/
#include "function_topic_tests.h"
#include <Common/ProjectConfig/project_defines.h>
#include <DDS/DDSConnector/subscriber.h>
#include <DDS/DDSConnector/publisher.h>
#include <QtTest/QTest>
#include <nglapplication/nglcoreapplication.h>
#include <NGLLogger/INGLLogger.h>
//-------------------------------------------------------------------------------------------------------
int main(int argc, char *argv[])
{
NGLCoreApplication app(argc, argv);
app.createLogger("UnitTests", "log4cxx_ddsUnitTests.props");
FunctionTopicTests *tc = new FunctionTopicTests;
int retCode = QTest::qExec(tc, argc, argv);
delete tc;
return retCode;
}
//-------------------------------------------------------------------------------------------------------
FunctionTopicTests::FunctionTopicTests()
: m_mainThreadId(QThread::currentThreadId())
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("UnitTests.FunctionTopicTests"))
{
qRegisterMetaType<DdsUnitTests::FunctionReply>("DdsUnitTests::FunctionReply");
qRegisterMetaType<DdsUnitTests::FunctionReplyWithState>("DdsUnitTests::FunctionReplyWithState");
}
//-------------------------------------------------------------------------------------------------------
void FunctionTopicTests::initTestCase()
{
DEBUG_LOG(m_logger) <<"FunctionTopicTests: initTestCase";
const int domainId = 0;
m_ddsConnectorClient = std::make_shared<DDSConnector::DdsConnector>(domainId, IDL::PartitionType::Global);
QVERIFY2(m_ddsConnectorClient->init(), "Initialisation of ddsconnector (Client) failed");
m_ddsConnectorClient->initSubscriber();
QVERIFY2(m_ddsConnectorClient->getSubscriber(), "Initialisation of Subscriber (DdsConnectorClient) failed");
m_ddsConnectorClient->initPublisher();
QVERIFY2(m_ddsConnectorClient->getPublisher(), "Initialisation of Publisher (DdsConnectorClient) failed");
m_ddsConnectorServer = std::make_shared<DDSConnector::DdsConnector>(domainId, IDL::PartitionType::Global);
QVERIFY2(m_ddsConnectorServer->init(), "Initialisation of ddsconnector (Server) failed");
m_ddsConnectorServer->initSubscriber();
QVERIFY2(m_ddsConnectorServer->getSubscriber(), "Initialisation of Subscriber (DdsConnectorServer) failed");
m_ddsConnectorServer->initPublisher();
QVERIFY2(m_ddsConnectorServer->getPublisher(), "Initialisation of Publisher (DdsConnectorServer) failed");
}
//-------------------------------------------------------------------------------------------------------
void FunctionTopicTests::initFTSTestCase()
{
m_fts.reset(m_ddsConnectorServer->createFTS<FTS::FunctionTopicTest>());
QVERIFY2(m_fts.get(), "Initialisation of FTS Replier failed");
m_fts->setSubscriberCallback([this](const rti::core::SampleIdentity &identity, const DdsUnitTests::FunctionRequest &request) { this->onFunctionTopicRequest(identity, request);});
m_ftsWS.reset(m_ddsConnectorServer->createFTS<FTS::FunctionTopicTestWithState>());
QVERIFY2(m_ftsWS.get(), "Initialisation of FTS Replier failed");
m_ftsWS->setSubscriberCallback([this](const rti::core::SampleIdentity &identity, const DdsUnitTests::FunctionRequestWithState &request) { this->onFunctionTopicRequest(identity, request);});
}
void FunctionTopicTests::initFTCTestCase()
{
m_ftc.reset(m_ddsConnectorClient->createFTC<FTC::FunctionTopicTest>(this));
QVERIFY2(m_ftc.get(), "Initialisation of FTC Requester failed");
m_ftcWS.reset(m_ddsConnectorClient->createFTC<FTC::FunctionTopicTestWithState>(this));
QVERIFY2(m_ftc.get(), "Initialisation of FTC Requester failed");
}
//-------------------------------------------------------------------------------------------------------
void FunctionTopicTests::requestTestCase1()
{
// request two times to check if WaitSetHandler etc. is working correct
requestWithState();
// 3 conditions - abortCondition + FunctionRequest + FunctionRequestWithState
QCOMPARE(m_ddsConnectorServer->getWaitSetHandler()->attachedConditionCount(), 3);
requestWithState();
// 3 conditions - abortCondition + FunctionRequest + FunctionRequestWithState
QCOMPARE(m_ddsConnectorServer->getWaitSetHandler()->attachedConditionCount(), 3);
}
//-------------------------------------------------------------------------------------------------------
void FunctionTopicTests::requestWithState()
{
// @StartTime => catch all signals (timing)
QSignalSpy spyRequest(this, &FunctionTopicTests::functionTopicRequestFinished);
QSignalSpy spyReply(this, &FunctionTopicTests::functionTopicReply);
DEBUG_LOG(m_logger) <<"FunctionTopicTests: request";
// Topic
DdsUnitTests::FunctionRequestWithState data;
data.id(1);
data.info(std::string("Test request"));
data.value(1000.0);
int uniqueId = 0;
bool bRet = m_ftcWS->requestDataClassic(data,
SLOT(slotRequestedData(DdsUnitTests::FunctionTopicTestWithStateReply,int,bool)),
SLOT(slotRequestedDataError(int,int,int)),
uniqueId);
QVERIFY2(bRet, "Could not request data!");
QTRY_COMPARE(spyRequest.count(), 1); // make sure the signal was emitted exactly one time
QTRY_COMPARE(spyReply.count(), 2); // make sure the signal was emitted exactly two times (reply in progress/reply finished)
}
//-------------------------------------------------------------------------------------------------------
void FunctionTopicTests::requestTestCase2()
{
// Start@beginning => all signals need catching (timing)
QSignalSpy spyRequest(this, &FunctionTopicTests::functionTopicRequestFinished);
QSignalSpy spyReply(this, &FunctionTopicTests::functionTopicReply);
DEBUG_LOG(m_logger) <<"FunctionTopicTests: request";
// Topic
DdsUnitTests::FunctionRequest data;
data.id(1);
data.info(std::string("Test request"));
data.value(1000.0);
int uniqueId = 0;
bool bRet = m_ftc->requestDataClassic(data,
SLOT(slotRequestedData(DdsUnitTests::FunctionTopicTestReply,int,bool)),
SLOT(slotRequestedDataError(int,int,int)),
uniqueId);
QVERIFY2(bRet, "Could not request data!");
QTRY_COMPARE(spyRequest.count(), 1); // make sure the signal was emitted exactly one time
QTRY_COMPARE(spyReply.count(), 1); // make sure the signal was emitted exactly one time (no status member)
}
//-------------------------------------------------------------------------------------------------------
void FunctionTopicTests::cleanupTestCase()
{
DEBUG_LOG(m_logger) <<"FunctionTopicTests: cleanupTestCase";
m_fts = nullptr;
m_ftc = nullptr;
m_ftsWS = nullptr;
m_ftcWS = nullptr;
m_ddsConnectorServer = nullptr;
m_ddsConnectorClient = nullptr;
}
//-------------------------------------------------------------------------------------------------------
void FunctionTopicTests::onFunctionTopicRequest(const rti::core::SampleIdentity &sampleId,
const DdsUnitTests::FunctionRequestWithState &request)
{
QCOMPARE(m_mainThreadId, QThread::currentThreadId());
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"));
QCOMPARE(m_requestTopicWithState.value(), 1000.0);
DdsUnitTests::FunctionReplyWithState reply;
DEBUG_LOG(m_logger) << "Send sample with status REPLY_COMPLETED";
reply.id(1);
reply.errorString("Hello");
reply.replyState(Core::FtReplyState::Completed);
bool bRet = m_ftsWS->sendReply(sampleId, reply);
QVERIFY2(bRet, "Sending Reply failed");
emit functionTopicRequestFinished();
}
//-------------------------------------------------------------------------------------------------------
void FunctionTopicTests::onFunctionTopicRequest(const rti::core::SampleIdentity &sampleId,
const DdsUnitTests::FunctionRequest &request)
{
QCOMPARE(m_mainThreadId, QThread::currentThreadId());
INFO_LOG(m_logger) << "Got function topic request (without status member)";
m_requestTopic = request;
DdsUnitTests::FunctionReply reply;
reply.id(2);
reply.errorString("What?");
bool bRet = m_fts->sendReply(sampleId, reply);
QVERIFY2(bRet, "Sending Reply failed");
emit functionTopicRequestFinished();
}
//-------------------------------------------------------------------------------------------------------
void FunctionTopicTests::slotRequestedData(const DdsUnitTests::FunctionTopicTestWithStateReply &reply,
int seqNo, bool bFinished)
{
Q_UNUSED(seqNo);
QCOMPARE(m_mainThreadId, QThread::currentThreadId());
INFO_LOG(m_logger) << "Got reply from FTS: " << reply.replyState();
m_replyTopicWithState = reply;
if (m_replyTopicWithState.replyState() == Core::FtReplyState::InProgress)
{
QVERIFY(!bFinished);
QCOMPARE(m_replyTopicWithState.id(), 0);
}
else
{
QVERIFY(bFinished);
QCOMPARE(m_replyTopicWithState.id(), 1);
QCOMPARE(m_replyTopicWithState.errorString(), std::string("Hello"));
QCOMPARE(m_replyTopicWithState.replyState().underlying(), Core::FtReplyState::Completed);
}
emit functionTopicReply();
}
void FunctionTopicTests::slotRequestedData(const DdsUnitTests::FunctionTopicTestReply &reply,
int seqNo, bool bFinished)
{
Q_UNUSED(seqNo);
QVERIFY(bFinished);
QCOMPARE(m_mainThreadId, QThread::currentThreadId());
m_replyTopic = reply;
QCOMPARE(m_replyTopic.id(), 2);
QCOMPARE(m_replyTopic.errorString(), std::string("What?"));
emit functionTopicReply();
}
//-------------------------------------------------------------------------------------------------------
void FunctionTopicTests::slotRequestedDataError(int reason, int seqNo, int requestId)
{
Q_UNUSED(seqNo);
Q_UNUSED(requestId);
QFAIL(qPrintable(QStringLiteral("Error when trying to request data: %1").arg(reason)));
}