- 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>
288 lines
8.6 KiB
C++
Executable File
288 lines
8.6 KiB
C++
Executable File
/**
|
|
* EXM Function Topic test executable
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*
|
|
* Created by Hanna E. Rathje, SLSE, 2015-09-10
|
|
*/
|
|
|
|
#include "avm_ft_tests.h"
|
|
|
|
#include <nglapplication/nglcoreapplication.h>
|
|
#include <LtsCommandLineParser/LtsCommandLineParser.h>
|
|
#include <QTimer>
|
|
#include <QTest>
|
|
|
|
#include <AudioVideoManagement/avm_ftc.h>
|
|
|
|
//------------------------------------
|
|
namespace AudioVideoManagement
|
|
{
|
|
AvmFtTests::AvmFtTests(QObject *parent)
|
|
: QObject(parent)
|
|
, m_menuStructId(0)
|
|
, m_testId(0)
|
|
, m_mountingPointId(100)
|
|
, m_bTestsSuccessful(true)
|
|
{
|
|
qRegisterMetaType<Core::FunctionReply>("Core::FunctionReply");
|
|
}
|
|
|
|
// ------------------------------------------------------------------------------
|
|
AvmFtTests::~AvmFtTests()
|
|
{}
|
|
|
|
// ------------------------------------------------------------------------------
|
|
bool AvmFtTests::init(int domainId, int testId, int menuId, int mountingPointId)
|
|
{
|
|
INFO_LOG() << "init begin";
|
|
|
|
m_testId = testId;
|
|
m_menuStructId = menuId;
|
|
m_mountingPointId = mountingPointId;
|
|
|
|
m_ddsConnector.reset(new DDSConnector::DdsConnector(domainId, IDL::PartitionType::Any));
|
|
if (!m_ddsConnector->init())
|
|
return false;
|
|
m_ddsConnector->initPublisherSubscriber();
|
|
|
|
DEBUG_LOG() << "create ftc AVM";
|
|
m_ftc = AudioVideoManagement::Interface::Ftc::create(m_ddsConnector);
|
|
DEBUG_LOG() << "init ftc AVM";
|
|
bool bRet = m_ftc->enableAll();
|
|
DEBUG_LOG() << "init end AVM - bRet = " << bRet;
|
|
|
|
DEBUG_LOG() << "Domain Id = " << domainId;
|
|
DEBUG_LOG() << "Test Id = " << testId;
|
|
|
|
return bRet;
|
|
}
|
|
|
|
// ------------------------------------------------------------------------------
|
|
void AvmFtTests::startTest()
|
|
{
|
|
INFO_LOG() << "startTest";
|
|
if (m_testId <= 1)
|
|
QTimer::singleShot(0, this, &AvmFtTests::tryCreate);
|
|
else if (m_testId == 2)
|
|
QTimer::singleShot(0, this, &AvmFtTests::tryModify);
|
|
else if (m_testId == 3)
|
|
QTimer::singleShot(0, this, &AvmFtTests::tryDelete);
|
|
}
|
|
|
|
// ------------------------------------------------------------------------------
|
|
void AvmFtTests::tryCreate()
|
|
{
|
|
INFO_LOG() << "trying to send createMenuStructRequest";
|
|
|
|
m_menuStructId = -2;
|
|
ModifyMenuStructRequest request;
|
|
request.id(0);
|
|
request.name("TestGlobalMenu");
|
|
|
|
int newId = -10000000;
|
|
|
|
request.menuEntries().resize(3);
|
|
request.menuEntries()[0].name().set("Test-1");
|
|
request.menuEntries()[0].id(newId++);
|
|
request.menuEntries()[0].parentId(request.id());
|
|
request.menuEntries()[0].isGroup(true);
|
|
|
|
request.menuEntries()[1].mountingPointId(m_mountingPointId);
|
|
request.menuEntries()[1].id(newId++);
|
|
request.menuEntries()[1].parentId(request.menuEntries()[0].id());
|
|
request.menuEntries()[1].isGroup(false);
|
|
|
|
request.menuEntries()[2].mountingPointId(m_mountingPointId+1);
|
|
request.menuEntries()[2].id(newId++);
|
|
request.menuEntries()[2].parentId(request.menuEntries()[0].id());
|
|
request.menuEntries()[2].isGroup(false);
|
|
|
|
if (!m_ftc->modifyMenuStructRequest(request, this))
|
|
{
|
|
ERROR_LOG() << "Error requesting create data";
|
|
failExit();
|
|
}
|
|
}
|
|
|
|
// ------------------------------------------------------------------------------
|
|
void AvmFtTests::tryModify()
|
|
{
|
|
INFO_LOG() << "trying to send modify request for menuStructId = " << m_menuStructId;
|
|
ModifyMenuStructRequest request;
|
|
request.id(m_menuStructId);
|
|
request.name("TestGlobalMenuModify");
|
|
|
|
int newId = -10000000;
|
|
|
|
request.menuEntries().resize(3);
|
|
request.menuEntries()[0].name().set("Test-1-mod");
|
|
request.menuEntries()[0].id(newId++);
|
|
request.menuEntries()[0].parentId(request.id());
|
|
request.menuEntries()[0].isGroup(true);
|
|
|
|
request.menuEntries()[1].mountingPointId(m_mountingPointId);
|
|
request.menuEntries()[1].id(newId++);
|
|
request.menuEntries()[1].parentId(request.menuEntries()[0].id());
|
|
request.menuEntries()[1].isGroup(false);
|
|
|
|
request.menuEntries()[2].mountingPointId(m_mountingPointId+1);
|
|
request.menuEntries()[2].id(newId++);
|
|
request.menuEntries()[2].parentId(request.menuEntries()[0].id());
|
|
request.menuEntries()[2].isGroup(false);
|
|
|
|
if (!m_ftc->modifyMenuStructRequest(request, this))
|
|
{
|
|
ERROR_LOG() << "Error requesting modify data";
|
|
failExit();
|
|
}
|
|
}
|
|
|
|
// ------------------------------------------------------------------------------
|
|
void AvmFtTests::tryDelete()
|
|
{
|
|
INFO_LOG() << "trying to send delete request for menuStructId = " << m_menuStructId;
|
|
RemoveMenuStructRequest request;
|
|
request.id(m_menuStructId);
|
|
|
|
if (!m_ftc->removeMenuStructRequest(request, this))
|
|
{
|
|
ERROR_LOG() << "Error requesting delete data";
|
|
failExit();
|
|
}
|
|
}
|
|
|
|
// ------------------------------------------------------------------------------
|
|
void AvmFtTests::onModifyMenuStructReply(const Core::FunctionReplyObject &replyObject)
|
|
{
|
|
if (m_menuStructId == -2)
|
|
createMenuStructReply(replyObject);
|
|
else
|
|
modifyMenuStructReply(replyObject);
|
|
}
|
|
|
|
// ------------------------------------------------------------------------------
|
|
void AvmFtTests::createMenuStructReply(const Core::FunctionReplyObject &replyObject)
|
|
{
|
|
if (replyObject.error())
|
|
{
|
|
ERROR_LOG() << "Got onCreateMenuStructReply error: " << replyObject();
|
|
failExit();
|
|
return;
|
|
}
|
|
INFO_LOG() << "Got createReply with id " << replyObject.id()
|
|
<< " and errorString " << replyObject.translated();
|
|
m_menuStructId = replyObject.id();
|
|
|
|
DEBUG_LOG() << "m_testId = " << m_testId;
|
|
|
|
if(m_testId == 0)
|
|
QTimer::singleShot(0, this, &AvmFtTests::tryModify);
|
|
else
|
|
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
|
}
|
|
|
|
// ------------------------------------------------------------------------------
|
|
void AvmFtTests::modifyMenuStructReply(const Core::FunctionReplyObject &replyObject)
|
|
{
|
|
if (replyObject.error())
|
|
{
|
|
ERROR_LOG() << "Got onModifyMenuStructReply error: " << replyObject();
|
|
failExit();
|
|
return;
|
|
}
|
|
INFO_LOG() << "Got modifyRequest with id " << replyObject.id()
|
|
<< " and errorString " << replyObject.translated();
|
|
if(m_testId == 0)
|
|
QTimer::singleShot(0, this, &AvmFtTests::tryDelete);
|
|
else
|
|
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
|
}
|
|
|
|
// ------------------------------------------------------------------------------
|
|
void AvmFtTests::onRemoveMenuStructReply(const Core::FunctionReplyObject &replyObject)
|
|
{
|
|
if (replyObject.error())
|
|
{
|
|
ERROR_LOG() << "Got onRemoveMenuStructReply error: " << replyObject();
|
|
failExit();
|
|
return;
|
|
}
|
|
INFO_LOG() << "Got removeReply with id " << replyObject.id()
|
|
<< " and errorString " << replyObject.translated();
|
|
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
|
}
|
|
|
|
// ------------------------------------------------------------------------------
|
|
void AvmFtTests::failExit()
|
|
{
|
|
m_bTestsSuccessful = false;
|
|
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
|
}
|
|
|
|
} // end namespace
|
|
|
|
// ------------------------------------------------------------------
|
|
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("m") << QLatin1String("menuId")
|
|
, QLatin1String("MenuId.")
|
|
, QLatin1String("will be set during tests")
|
|
, QLatin1String("0")
|
|
} );
|
|
addOption( { QStringList() << QLatin1String("p") << QLatin1String("mountingPointId")
|
|
, QLatin1String("MountingPointId.")
|
|
, QLatin1String("Default 100")
|
|
, QLatin1String("100")
|
|
} );
|
|
}
|
|
|
|
int testId() const { return value(QLatin1String("t")).toInt(); }
|
|
int menuId() const { return value(QLatin1String("m")).toInt(); }
|
|
int mountingPointId() const{ return value(QLatin1String("p")).toInt(); }
|
|
};
|
|
|
|
using namespace AudioVideoManagement;
|
|
|
|
// ------------------------------------------------------------------
|
|
int main(int argc, char **argv)
|
|
{
|
|
NGLCoreApplication app(argc, argv);
|
|
app.createLogger("AVM", "log4cxx_avm.props");
|
|
|
|
int iRet = -1;
|
|
CmdLineParser options;
|
|
if (!options.init())
|
|
return iRet;
|
|
|
|
std::unique_ptr<AvmFtTests> avmFtTests(new AvmFtTests);
|
|
|
|
if(!avmFtTests->init(options.domainId(), options.testId(), options.menuId(), options.mountingPointId()))
|
|
return iRet;
|
|
|
|
QTimer::singleShot(0, avmFtTests.get(), &AvmFtTests::startTest);
|
|
|
|
STARTUP_LOG(app.baseLogger());
|
|
|
|
app.exec();
|
|
iRet = avmFtTests->testsSuccessful() ? 0 : 1;
|
|
fprintf(stderr, "%d\n", iRet);
|
|
|
|
DEBUG_LOG(app.baseLogger()) << "** TEST result = " << iRet;
|
|
|
|
SHUTDOWN_LOG(app.baseLogger());
|
|
|
|
return iRet;
|
|
}
|
|
|