- NGL_ADD_LIBRARY2: 87 CMakeLists.txt konvertiert für Export-Header Generierung - 44 Export-Header Include-Pfade korrigiert (_export.h) - 81 DDS-Stub-Header generiert (*_dtc.h, *_fts.h, *_dts.h, *_ftc.h) - INGLLogger: Duplikat gelöscht, m_logger Member entfernt, variadische Makros - Q_FUNC_INFO Redefinition behoben (Qt6 definiert bereits) - FATAL_LOG Makro hinzugefügt - InfrastructureManagement DDS-Stubs (ism.hpp, ism_enums.hpp, ism_ftc.h) - FilterManagement DDS-Stubs (flt_ftc.h, flt_dts.h) - AreaEffectSimulation DDS-Stubs (aes.hpp, aes_enums.hpp) - SymbolAppearance Klasse vollständig definiert mit content() Methode - BuildingComponentFilter Klasse definiert mit Copy-Konstruktor - Ftc Factory: nullptr Return (abstract class) - AesFilter Klasse in aes.hpp hinzugefügt - Dtc Klasse in ppm.hpp mit participantChanged Signal - AesType Enum: alle 15 At* Werte definiert - AesEffectState_def: EsReceived hinzugefügt - DataModification Enum: eAdded/eModified/eRemoved - function_reply_object.h → core_types.h Include-Pfad (72 Dateien) - Enum-Class-Streaming Template-Operator in INGLLogger.h - ism_mounting_point.h: QImage → QtGui/QImage, QGuiApplication/QScreen - ism_data_plugin_interface.h: QSet Include, Include-Reihenfolge - QRegExp → QRegularExpression in tpm_js_parser.cpp - .underlying() Aufrufe zu direktem Enum-Vergleich korrigiert - Include-Pfade: aes.hpp in symbol_appearance_settings_impl.h und aes_display_filter_impl.h Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
388 lines
11 KiB
C++
Executable File
388 lines
11 KiB
C++
Executable File
/**
|
|
* EXM Function Topic test executable
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*
|
|
* Created by Hanna E. Rathje, SLSE, 2015-09-10
|
|
*/
|
|
|
|
#include "pre_tests.h"
|
|
|
|
#include <nglapplication/nglcoreapplication.h>
|
|
#include <LtsCommandLineParser/LtsCommandLineParser.h>
|
|
#include <QTimer>
|
|
#include <QTest>
|
|
|
|
#include <PresentationManagement/pre_ftc.h>
|
|
|
|
namespace PresentationManagement
|
|
{
|
|
//----------------------------------------------------------------------------------
|
|
PreTests::PreTests(QObject *parent)
|
|
: QObject(parent)
|
|
, m_exerciseId(0)
|
|
, m_testId(0)
|
|
, m_presentationId(0)
|
|
, m_bTestsSuccessful(true)
|
|
{
|
|
qRegisterMetaType<Core::FunctionReply>("Core::FunctionReply");
|
|
}
|
|
|
|
//----------------------------------------------------------------------------------
|
|
bool PreTests::init(int domainId, int exerciseId, int testId, int presentationId)
|
|
{
|
|
INFO_LOG() << "init begin";
|
|
|
|
m_testId = testId;
|
|
m_exerciseId = exerciseId;
|
|
m_presentationId = presentationId;
|
|
|
|
// initialize DDS
|
|
m_ddsConnector.reset(new DDSConnector::DdsConnector(domainId, IDL::PartitionType::Exercise, m_exerciseId));
|
|
if (!m_ddsConnector->init())
|
|
return false;
|
|
DEBUG_LOG() << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
|
m_ddsConnector->initPublisherSubscriber();
|
|
|
|
DEBUG_LOG() << "create ftc PRE";
|
|
m_ftc = PresentationManagement::Interface::Ftc::create(m_ddsConnector);
|
|
DEBUG_LOG() << "init ftc PRE";
|
|
bool bRet = m_ftc->enableAll();
|
|
DEBUG_LOG() << "init end PRE - bRet = " << bRet;
|
|
|
|
DEBUG_LOG() << "Domain Id = " << domainId;
|
|
DEBUG_LOG() << "Exercise Id = " << exerciseId;
|
|
DEBUG_LOG() << "Test Id = " << testId;
|
|
|
|
//TODO: add connects
|
|
|
|
return bRet;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------------
|
|
void PreTests::startTest()
|
|
{
|
|
INFO_LOG() << "startTest";
|
|
switch (m_testId)
|
|
{
|
|
case 1:
|
|
tryCreate();
|
|
break;
|
|
case 2:
|
|
tryModify();
|
|
break;
|
|
case 3:
|
|
tryGetContent();
|
|
break;
|
|
case 4:
|
|
tryDelete();
|
|
break;
|
|
case 5:
|
|
tryChangeStatus();
|
|
break;
|
|
default:
|
|
ERROR_LOG() << "Unknown test case !";
|
|
failExit();
|
|
break;
|
|
}
|
|
INFO_LOG() << "********* endTest **************";
|
|
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
|
}
|
|
|
|
//----------------------------------------------------------------------------------
|
|
void PreTests::tryCreate()
|
|
{
|
|
INFO_LOG() << "trying to send createRequest Presentation";
|
|
m_presentationId = -1;
|
|
PresentationModifyRequest request;
|
|
|
|
request.name("Test Presentation");
|
|
request.description("Description Presentation");
|
|
request.operatorId(100);
|
|
request.lastModified(QDateTime(QDate(2017,2,14), QTime(9,34)).toMSecsSinceEpoch());
|
|
|
|
std::vector<PresentationContent> vectorPc;
|
|
|
|
vectorPc.resize(2);
|
|
vectorPc[0].presentationTopicType("pdf");
|
|
vectorPc[0].channel("1V");
|
|
vectorPc[0].duration(30);
|
|
vectorPc[0].startTime(QDateTime(QDate(2017,2,13), QTime(12,34)).toMSecsSinceEpoch());
|
|
|
|
vectorPc[1].presentationTopicType("text");
|
|
vectorPc[1].channel("2V");
|
|
vectorPc[1].duration(30);
|
|
vectorPc[1].startTime(QDateTime(QDate(2017,2,14), QTime(9,45)).toMSecsSinceEpoch());
|
|
|
|
request.content(vectorPc);
|
|
|
|
if (!m_ftc->presentationModifyRequest(request, this))
|
|
{
|
|
ERROR_LOG() << "Error requesting create data";
|
|
failExit();
|
|
}
|
|
|
|
QTest::qWait(1000);
|
|
}
|
|
|
|
//----------------------------------------------------------------------------------
|
|
void PreTests::tryModify()
|
|
{
|
|
PresentationModifyRequest request;
|
|
|
|
request.id(m_presentationId);
|
|
request.name("Presentation Modify");
|
|
request.description("Description Presentation Modify");
|
|
request.operatorId(102);
|
|
request.lastModified(QDateTime(QDate(2017,2,16), QTime(10,34)).toMSecsSinceEpoch());
|
|
|
|
std::vector<PresentationContent> &vectorPc = request.content();
|
|
|
|
vectorPc.resize(2);
|
|
vectorPc[0].presentationTopicType("pdf");
|
|
vectorPc[0].channel("1V2");
|
|
vectorPc[0].duration(60);
|
|
vectorPc[0].startTime(QDateTime(QDate(2017,2,13), QTime(12,34)).toMSecsSinceEpoch());
|
|
|
|
vectorPc[1].presentationTopicType("text");
|
|
vectorPc[1].channel("2V");
|
|
vectorPc[1].duration(60);
|
|
vectorPc[1].startTime(QDateTime(QDate(2017,2,14), QTime(9,45)).toMSecsSinceEpoch());
|
|
|
|
INFO_LOG() << "trying to send modify request for presentation Id = " << m_presentationId;
|
|
if (!m_ftc->presentationModifyRequest(request, this))
|
|
{
|
|
ERROR_LOG() << "Error requesting modify data";
|
|
failExit();
|
|
}
|
|
|
|
QTest::qWait(1000);
|
|
}
|
|
|
|
//----------------------------------------------------------------------------------
|
|
void PreTests::tryDelete()
|
|
{
|
|
PresentationRemoveRequest request;
|
|
|
|
request.id(m_presentationId);
|
|
|
|
INFO_LOG() << "trying to send delete request for presentation Id = " << m_presentationId;
|
|
if (!m_ftc->presentationRemoveRequest(request, this))
|
|
{
|
|
ERROR_LOG() << "Error requesting delete data";
|
|
failExit();
|
|
}
|
|
}
|
|
|
|
//----------------------------------------------------------------------------------
|
|
void PreTests::tryGetContent()
|
|
{
|
|
GetPresentationContentRequest request;
|
|
|
|
request.presentationId(m_presentationId);
|
|
INFO_LOG() << "trying to send content request for presentation Id = " << m_presentationId;
|
|
|
|
if (!m_ftc->getPresentationContentRequest(request, this))
|
|
{
|
|
ERROR_LOG() << "Error requesting content for presentationId: " << m_presentationId;
|
|
failExit();
|
|
}
|
|
|
|
QTest::qWait(1000);
|
|
}
|
|
|
|
//----------------------------------------------------------------------------------
|
|
void PreTests::tryChangeStatus()
|
|
{
|
|
PresentationChangeStatusRequest request;
|
|
|
|
request.id(m_presentationId);
|
|
request.operatorId(101);
|
|
request.lastModified(QDateTime::currentMSecsSinceEpoch());
|
|
request.fileStatus(FileStatus::Deleted);
|
|
|
|
INFO_LOG() << "trying to send change status request for presentation Id = " << m_presentationId;
|
|
if (!m_ftc->presentationChangeStatusRequest(request, this))
|
|
{
|
|
ERROR_LOG() << "Error requesting change status";
|
|
failExit();
|
|
}
|
|
|
|
QTest::qWait(1000);
|
|
}
|
|
|
|
//----------------------------------------------------------------------------------
|
|
void PreTests::failExit()
|
|
{
|
|
ERROR_LOG() << "FAIL EXIT !";
|
|
m_bTestsSuccessful = false;
|
|
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
|
}
|
|
|
|
//----------------------------------------------------------------------------------
|
|
void PreTests::onPresentationCreateReply(const Core::FunctionReplyObject &replyObject)
|
|
{
|
|
DEBUG_LOG() << "END (onPresentationCreateReply)";
|
|
if (replyObject.error())
|
|
{
|
|
ERROR_LOG() << "Got onPresentationCreateReply error: " << replyObject();
|
|
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
|
return;
|
|
}
|
|
INFO_LOG() << "Got createReply with id " << replyObject.id()
|
|
<< " and errorString " << replyObject.translated();
|
|
|
|
m_presentationId = replyObject.id();
|
|
if(m_testId == 0)
|
|
QTimer::singleShot(0, this, &PreTests::tryModify);
|
|
else
|
|
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
|
}
|
|
|
|
//----------------------------------------------------------------------------------
|
|
void PreTests::onPresentationModifyReply(const Core::FunctionReplyObject &replyObject)
|
|
{
|
|
if (m_presentationId == -1)
|
|
return onPresentationCreateReply(replyObject);
|
|
DEBUG_LOG() << "END (onPresentationModifyReply)";
|
|
|
|
if (replyObject.error())
|
|
{
|
|
ERROR_LOG() << "Got onPresentationModifyReply error: " << replyObject();
|
|
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
|
return;
|
|
}
|
|
INFO_LOG() << "Got createReply with id " << replyObject.id()
|
|
<< " and errorString " << replyObject.translated();
|
|
|
|
m_presentationId = replyObject.id();
|
|
|
|
if(m_testId == 0)
|
|
QTimer::singleShot(0, this, &PreTests::tryChangeStatus);
|
|
else
|
|
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
|
}
|
|
|
|
//----------------------------------------------------------------------------------
|
|
void PreTests::onPresentationChangeStatusReply(const Core::FunctionReplyObject &replyObject)
|
|
{
|
|
DEBUG_LOG() << "END (onPresentationChangeStatusReply)";
|
|
|
|
if (replyObject.error())
|
|
{
|
|
ERROR_LOG() << "Got onPresentationChangeStatusReply error: " << replyObject();
|
|
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
|
return;
|
|
}
|
|
INFO_LOG() << "Got changeStatusReply with id " << replyObject.id()
|
|
<< " and errorString " << replyObject.translated();
|
|
|
|
m_presentationId = replyObject.id();
|
|
|
|
if(m_testId == 0)
|
|
QTimer::singleShot(0, this, &PreTests::tryGetContent);
|
|
else
|
|
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
|
}
|
|
|
|
//----------------------------------------------------------------------------------
|
|
void PreTests::onPresentationRemoveReply(const Core::FunctionReplyObject &replyObject)
|
|
{
|
|
DEBUG_LOG() << "END (onPresentationRemoveReply)";
|
|
|
|
if (replyObject.error())
|
|
{
|
|
ERROR_LOG() << "Got onPresentationRemoveReply error: " << replyObject();
|
|
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
|
return;
|
|
}
|
|
|
|
INFO_LOG() << "Got reply with id " << replyObject.id()
|
|
<< " and errorString " << replyObject.translated();
|
|
|
|
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
|
}
|
|
|
|
//----------------------------------------------------------------------------------
|
|
void PreTests::onGetPresentationContentReply(const GetPresentationContentReply &replyObject)
|
|
{
|
|
DEBUG_LOG() << "END (onGetPresentationContentReply)";
|
|
|
|
if (replyObject.errorString().size() > 0)
|
|
{
|
|
ERROR_LOG() << "Got onGetPresentationContentReply error: " << replyObject.errorString();
|
|
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
|
return;
|
|
}
|
|
|
|
INFO_LOG() << "Got reply with id " << replyObject.id()
|
|
<< " and errorString " << replyObject.errorString()
|
|
<< " and content size " << replyObject.content().size();
|
|
|
|
if(m_testId == 0)
|
|
QTimer::singleShot(0, this, &PreTests::tryDelete);
|
|
else
|
|
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
|
}
|
|
|
|
}
|
|
|
|
// ------------------------------------------------------------------
|
|
class CmdLineParser : public LtsCommandLineParser::LtsCommandLineParser
|
|
{
|
|
public:
|
|
CmdLineParser()
|
|
: LtsCommandLineParser()
|
|
{
|
|
addOption( { QStringList() << QLatin1String("t") << QLatin1String("testId")
|
|
, QLatin1String("TestId.")
|
|
, QLatin1String("Default: 0 (all tests)")
|
|
, QLatin1String("0")
|
|
} );
|
|
addOption( { QStringList() << QLatin1String("p") << QLatin1String("presentationId")
|
|
, QLatin1String("PresentationId")
|
|
, QLatin1String("Default: 0 ")
|
|
, QLatin1String("0")
|
|
} );
|
|
}
|
|
|
|
int testId() const { return isSet(QLatin1String("t")) ? value(QLatin1String("t")).toInt() : -1; }
|
|
int presentationId() const { return isSet(QLatin1String("p")) ? value(QLatin1String("p")).toInt() : -1; }
|
|
|
|
};
|
|
|
|
// ------------------------------------------------------------------
|
|
int main(int argc, char **argv)
|
|
{
|
|
int iRet = -1;
|
|
|
|
NGLCoreApplication app(argc, argv);
|
|
app.createLogger("PRE", 0);
|
|
|
|
CmdLineParser options;
|
|
if (!options.init())
|
|
return iRet;
|
|
|
|
std::unique_ptr<PresentationManagement::PreTests> PreTests(new PresentationManagement::PreTests);
|
|
|
|
if (!PreTests->init(options.domainId(), options.exerciseId(), options.testId(), options.presentationId()))
|
|
return iRet;
|
|
|
|
QTimer::singleShot(0, PreTests.get(), &PresentationManagement::PreTests::startTest);
|
|
|
|
STARTUP_LOG(app.baseLogger());
|
|
|
|
app.exec();
|
|
|
|
iRet = PreTests->testsSuccessful() ? 0 : 1;
|
|
fprintf(stderr, "\n%d\n\n", iRet);
|
|
|
|
INFO_LOG(app.baseLogger()) << "** TEST result = " << iRet;
|
|
|
|
SHUTDOWN_LOG(app.baseLogger());
|
|
|
|
return iRet;
|
|
}
|
|
|