Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,73 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
#
|
||||
|
||||
SET(SRCS_FT_TEST
|
||||
avm_ft_tests.cpp
|
||||
)
|
||||
SET(HDRS_FT_TEST
|
||||
avm_ft_tests.h
|
||||
)
|
||||
|
||||
SET(SRCS_VCA_TEST
|
||||
avm_vca_tests.cpp
|
||||
)
|
||||
SET(HDRS_VCA_TEST
|
||||
avm_vca_tests.h
|
||||
)
|
||||
|
||||
SET(SRCS_MVS_TEST
|
||||
mvs_tests.cpp
|
||||
)
|
||||
SET(HDRS_MVS_TEST
|
||||
mvs_tests.h
|
||||
)
|
||||
|
||||
|
||||
IF(BUILD_TESTING)
|
||||
IF(TARGET svcAvmClient)
|
||||
|
||||
ADD_EXECUTABLE(avmFtTests ${SRCS_FT_TEST} ${HDRS_FT_TEST})
|
||||
TARGET_LINK_LIBRARIES(avmFtTests
|
||||
Qt5::Core
|
||||
Qt5::Test
|
||||
RTI::nddscpp2
|
||||
svcAvmClient
|
||||
LtsCommandLineParser
|
||||
ddsconnector
|
||||
nglcoreapplication
|
||||
)
|
||||
|
||||
ADD_EXECUTABLE(avmVcaTests ${SRCS_VCA_TEST} ${HDRS_VCA_TEST})
|
||||
TARGET_LINK_LIBRARIES(avmVcaTests
|
||||
Qt5::Core
|
||||
Qt5::Test
|
||||
RTI::nddscpp2
|
||||
svcAvmClient
|
||||
svcCoreClient
|
||||
LtsCommandLineParser
|
||||
ddsconnector
|
||||
nglcoreapplication
|
||||
)
|
||||
|
||||
ADD_EXECUTABLE(mvsTests ${SRCS_MVS_TEST} ${HDRS_MVS_TEST})
|
||||
TARGET_LINK_LIBRARIES(mvsTests
|
||||
Qt5::Core
|
||||
Qt5::Test
|
||||
RTI::nddscpp2
|
||||
svcAvmClient
|
||||
LtsCommandLineParser
|
||||
ddsconnector
|
||||
nglcoreapplication
|
||||
)
|
||||
|
||||
IF(NOT BUILD_RPM)
|
||||
NGL_INSTALL(SV TARGETS avmFtTests DESTINATION bin/test)
|
||||
NGL_INSTALL(SV TARGETS avmVcaTests DESTINATION bin/test)
|
||||
NGL_INSTALL(SV TARGETS mvsTests DESTINATION bin/test)
|
||||
NGL_INSTALL(SV FILES ../log4cxx_avm.props DESTINATION bin/test)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
@@ -0,0 +1,288 @@
|
||||
/**
|
||||
* 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)
|
||||
, m_logger(getLogger("FtTest"))
|
||||
{
|
||||
qRegisterMetaType<Core::FunctionReply>("Core::FunctionReply");
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
AvmFtTests::~AvmFtTests()
|
||||
{}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
bool AvmFtTests::init(int domainId, int testId, int menuId, int mountingPointId)
|
||||
{
|
||||
INFO_LOG(m_logger) << "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(m_logger) << "create ftc AVM";
|
||||
m_ftc = AudioVideoManagement::Interface::Ftc::create(m_ddsConnector);
|
||||
DEBUG_LOG(m_logger) << "init ftc AVM";
|
||||
bool bRet = m_ftc->enableAll();
|
||||
DEBUG_LOG(m_logger) << "init end AVM - bRet = " << bRet;
|
||||
|
||||
DEBUG_LOG(m_logger) << "Domain Id = " << domainId;
|
||||
DEBUG_LOG(m_logger) << "Test Id = " << testId;
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
void AvmFtTests::startTest()
|
||||
{
|
||||
INFO_LOG(m_logger) << "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(m_logger) << "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(m_logger) << "Error requesting create data";
|
||||
failExit();
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
void AvmFtTests::tryModify()
|
||||
{
|
||||
INFO_LOG(m_logger) << "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(m_logger) << "Error requesting modify data";
|
||||
failExit();
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
void AvmFtTests::tryDelete()
|
||||
{
|
||||
INFO_LOG(m_logger) << "trying to send delete request for menuStructId = " << m_menuStructId;
|
||||
RemoveMenuStructRequest request;
|
||||
request.id(m_menuStructId);
|
||||
|
||||
if (!m_ftc->removeMenuStructRequest(request, this))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "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(m_logger) << "Got onCreateMenuStructReply error: " << replyObject();
|
||||
failExit();
|
||||
return;
|
||||
}
|
||||
INFO_LOG(m_logger) << "Got createReply with id " << replyObject.id()
|
||||
<< " and errorString " << replyObject.translated();
|
||||
m_menuStructId = replyObject.id();
|
||||
|
||||
DEBUG_LOG(m_logger) << "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(m_logger) << "Got onModifyMenuStructReply error: " << replyObject();
|
||||
failExit();
|
||||
return;
|
||||
}
|
||||
INFO_LOG(m_logger) << "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(m_logger) << "Got onRemoveMenuStructReply error: " << replyObject();
|
||||
failExit();
|
||||
return;
|
||||
}
|
||||
INFO_LOG(m_logger) << "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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
*
|
||||
* EXM Function Topic test executable
|
||||
*
|
||||
* ModuleTests for create/modify/remove exercise
|
||||
* ---------------------------------------------------
|
||||
* Client FTC is implemented
|
||||
*
|
||||
* => (!) Preconditon:
|
||||
* - Service sExeMgmt running
|
||||
*
|
||||
* -------------------------------------------------
|
||||
*
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Hanna E. Rathje, SLSE, 2015-09-10
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AudioVideoManagement/avm_ftc.h>
|
||||
#include <AudioVideoManagement/avm_ftc_types.h>
|
||||
#include <AudioVideoManagement/logger.h>
|
||||
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <QObject>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
class AvmFtTests : public QObject
|
||||
, protected AudioVideoManagement::Interface::Ftc::ModifyMenuStructReplyHandler
|
||||
, protected AudioVideoManagement::Interface::Ftc::RemoveMenuStructReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AvmFtTests(QObject *parent = nullptr);
|
||||
~AvmFtTests();
|
||||
|
||||
bool init(int domainId, int testId, int menuId, int mountingPointId);
|
||||
|
||||
bool testsSuccessful() const { return m_bTestsSuccessful; }
|
||||
|
||||
public Q_SLOTS:
|
||||
void startTest();
|
||||
protected Q_SLOTS:
|
||||
void tryCreate();
|
||||
void tryModify();
|
||||
void tryDelete();
|
||||
protected:
|
||||
void onModifyMenuStructReply(const Core::FunctionReplyObject &replyObject) override final;
|
||||
void createMenuStructReply(const Core::FunctionReplyObject &replyObject);
|
||||
void modifyMenuStructReply(const Core::FunctionReplyObject &replyObject);
|
||||
void onRemoveMenuStructReply(const Core::FunctionReplyObject &replyObject) override final;
|
||||
void failExit();
|
||||
|
||||
private:
|
||||
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
|
||||
std::shared_ptr<AudioVideoManagement::Interface::Ftc> m_ftc;
|
||||
|
||||
int m_menuStructId;
|
||||
int m_testId;
|
||||
int m_mountingPointId;
|
||||
bool m_bTestsSuccessful;
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
};
|
||||
|
||||
} // namespace AudioVideoManagement
|
||||
@@ -0,0 +1,4 @@
|
||||
Parameters, Comment
|
||||
-t 1,1. Create new AVS menu
|
||||
-t 2 -m 1,2. Modify AVS menu
|
||||
-t 3 -m 5,3. Delete AVS menu
|
||||
|
@@ -0,0 +1,306 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Gerlinde Rudolphus, SLSE, 2017-10-20
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Requirements for this test:
|
||||
* - an exercise
|
||||
* - an operator
|
||||
* - svcAudioVideoManagement -e 0
|
||||
*
|
||||
* How to start?
|
||||
* - avmVcaTests [-d <domainId>] [-e <exerciseId>] [--operatorid=<operatorId>] [-- <QTest options>]
|
||||
* - default exercise is 42
|
||||
* - default operator is 22
|
||||
*/
|
||||
|
||||
#include "avm_vca_tests.h"
|
||||
#include <AudioVideoManagement/avm_dtc.h>
|
||||
#include <nglapplication/nglcoreapplication.h>
|
||||
#include <LtsCommandLineParser/LtsCommandLineParser.h>
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
#include <QTest>
|
||||
#include <QtGlobal>
|
||||
#include <QStringList>
|
||||
#include <QMap>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
AvmVcaTests::AvmVcaTests(int domainId, int exerciseId, int operatorId)
|
||||
: m_ddsConnector(std::make_shared<DDSConnector::DdsConnector>(domainId, IDL::PartitionType::Exercise))
|
||||
, m_exerciseId(exerciseId)
|
||||
, m_operatorId(operatorId)
|
||||
, m_logger(NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("VcaTest"))
|
||||
{
|
||||
Q_ASSERT(exerciseId > 0);
|
||||
Q_ASSERT(operatorId > 0);
|
||||
|
||||
bool status = m_ddsConnector->init();
|
||||
Q_ASSERT(status);
|
||||
m_ddsConnector->initPublisherSubscriber();
|
||||
|
||||
m_ftc = Interface::Ftc::create(m_ddsConnector);
|
||||
status = m_ftc->enableAll();
|
||||
Q_ASSERT(status);
|
||||
|
||||
m_dtc = Interface::Dtc::create(m_ddsConnector);
|
||||
status = m_dtc->enableAll();
|
||||
Q_ASSERT(status);
|
||||
}
|
||||
|
||||
void AvmVcaTests::initTestCase()
|
||||
{
|
||||
createTvcConfig();
|
||||
createCnrConfig();
|
||||
}
|
||||
|
||||
void AvmVcaTests::cleanupTestCase()
|
||||
{
|
||||
removeTvcConfig();
|
||||
removeCnrConfig();
|
||||
}
|
||||
|
||||
void AvmVcaTests::test()
|
||||
{
|
||||
create();
|
||||
QVERIFY(!QTest::currentTestFailed());
|
||||
modify();
|
||||
QVERIFY(!QTest::currentTestFailed());
|
||||
remove();
|
||||
QVERIFY(!QTest::currentTestFailed());
|
||||
}
|
||||
|
||||
void AvmVcaTests::create()
|
||||
{
|
||||
CnrTvcProfile createRequest;
|
||||
|
||||
createRequest.id(0); // create
|
||||
createRequest.exerciseId(m_exerciseId);
|
||||
createRequest.operatorId(m_operatorId);
|
||||
|
||||
createRequest.data().resize(3);
|
||||
createRequest.data()[0] = CnrTvcProfileData(m_cnrConfigIds.at(0), RadioSystem::Cnr);
|
||||
createRequest.data()[1] = CnrTvcProfileData(m_tvcConfigIds.at(0), RadioSystem::Tvc);
|
||||
createRequest.data()[2] = CnrTvcProfileData(m_cnrConfigIds.at(1), RadioSystem::Cnr);
|
||||
|
||||
m_modifyReplyReceived = false;
|
||||
bool status = m_ftc->modifyCnrTvcProfileRequest(createRequest, this);
|
||||
QVERIFY(status);
|
||||
QTRY_VERIFY(m_modifyReplyReceived);
|
||||
QVERIFY(m_circuitId > 0);
|
||||
|
||||
CnrTvcProfile expected = createRequest;
|
||||
expected.id(m_circuitId);
|
||||
QTRY_COMPARE(m_dtc->cnrTvcProfile(m_circuitId), expected);
|
||||
}
|
||||
|
||||
void AvmVcaTests::modify()
|
||||
{
|
||||
CnrTvcProfile request;
|
||||
|
||||
request.id(m_circuitId); // modify
|
||||
request.exerciseId(m_exerciseId);
|
||||
request.operatorId(m_operatorId);
|
||||
|
||||
request.data().resize(4);
|
||||
request.data()[0] = CnrTvcProfileData(m_tvcConfigIds.at(0), RadioSystem::Tvc);
|
||||
request.data()[1] = CnrTvcProfileData(m_tvcConfigIds.at(1), RadioSystem::Tvc);
|
||||
request.data()[2] = CnrTvcProfileData(m_cnrConfigIds.at(2), RadioSystem::Cnr);
|
||||
request.data()[3] = CnrTvcProfileData(m_cnrConfigIds.at(1), RadioSystem::Cnr);
|
||||
|
||||
m_modifyReplyReceived = false;
|
||||
bool status = m_ftc->modifyCnrTvcProfileRequest(request, this);
|
||||
QVERIFY(status);
|
||||
QTRY_VERIFY(m_modifyReplyReceived);
|
||||
QCOMPARE(m_circuitId, request.id());
|
||||
|
||||
CnrTvcProfile expected = request;
|
||||
QTRY_COMPARE(m_dtc->cnrTvcProfile(m_circuitId), expected);
|
||||
}
|
||||
|
||||
void AvmVcaTests::remove()
|
||||
{
|
||||
Core::RemoveElementRequest request;
|
||||
request.id(m_circuitId);
|
||||
|
||||
m_removeReplyReceived = false;
|
||||
bool status = m_ftc->removeCnrTvcProfileRequest(request, this);
|
||||
QVERIFY(status);
|
||||
QTRY_VERIFY(m_removeReplyReceived);
|
||||
QCOMPARE(m_circuitId, request.id());
|
||||
|
||||
CnrTvcProfile expected;
|
||||
QTRY_COMPARE(m_dtc->cnrTvcProfile(m_circuitId), expected);
|
||||
}
|
||||
|
||||
void AvmVcaTests::onModifyCnrTvcProfileReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
m_modifyReplyReceived = true;
|
||||
QVERIFY2(!replyObject.error(), replyObject.str().c_str());
|
||||
m_circuitId = replyObject.id();
|
||||
}
|
||||
|
||||
void AvmVcaTests::onRemoveCnrTvcProfileReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
m_removeReplyReceived = true;
|
||||
QVERIFY2(!replyObject.error(), replyObject.str().c_str());
|
||||
m_circuitId = replyObject.id();
|
||||
}
|
||||
|
||||
void AvmVcaTests::createTvcConfig()
|
||||
{
|
||||
ModifyTvcConfigRequest createRequest{0, 1, "tvc01", false, 42, "test"};
|
||||
bool status = m_ftc->modifyTvcConfigRequest(createRequest, this);
|
||||
Q_ASSERT(status);
|
||||
|
||||
createRequest = {0, 2, "tvc02", false, 42, "test2"};
|
||||
status = m_ftc->modifyTvcConfigRequest(createRequest, this);
|
||||
Q_ASSERT(status);
|
||||
|
||||
createRequest = {0, 3, "tvc03", false, 42, ""};
|
||||
status = m_ftc->modifyTvcConfigRequest(createRequest, this);
|
||||
Q_ASSERT(status);
|
||||
|
||||
QTRY_VERIFY(m_tvcConfigIds.size() == 3);
|
||||
}
|
||||
|
||||
void AvmVcaTests::createCnrConfig()
|
||||
{
|
||||
ModifyCnrConfigRequest createRequest{0, 3, m_exerciseId, "vhf01", false, {}, 0, "call sign"};
|
||||
bool status = m_ftc->modifyCnrConfigRequest(createRequest, this);
|
||||
Q_ASSERT(status);
|
||||
|
||||
createRequest = {0, 4, m_exerciseId, "vhf02", false, {}, 0, "call sign"};
|
||||
status = m_ftc->modifyCnrConfigRequest(createRequest, this);
|
||||
Q_ASSERT(status);
|
||||
|
||||
createRequest = {0, 5, m_exerciseId, "vhf03", false, {}, 0, "call sign"};
|
||||
status = m_ftc->modifyCnrConfigRequest(createRequest, this);
|
||||
Q_ASSERT(status);
|
||||
|
||||
QTRY_VERIFY(m_cnrConfigIds.size() == 3);
|
||||
}
|
||||
|
||||
void AvmVcaTests::removeTvcConfig()
|
||||
{
|
||||
for (auto id: qAsConst(m_tvcConfigIds))
|
||||
m_ftc->removeTvcConfigRequest(RemoveTvcConfigRequest{id}, this);
|
||||
QTRY_VERIFY(m_tvcConfigIds.isEmpty());
|
||||
}
|
||||
|
||||
void AvmVcaTests::removeCnrConfig()
|
||||
{
|
||||
for (auto id: qAsConst(m_cnrConfigIds))
|
||||
m_ftc->removeCnrConfigRequest(RemoveCnrConfigRequest{id}, this);
|
||||
QTRY_VERIFY(m_cnrConfigIds.isEmpty());
|
||||
}
|
||||
|
||||
void AvmVcaTests::onModifyTvcConfigReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
QVERIFY(!replyObject.error());
|
||||
m_tvcConfigIds.push_back(replyObject.id());
|
||||
}
|
||||
|
||||
void AvmVcaTests::onModifyCnrConfigReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
QVERIFY(!replyObject.error());
|
||||
m_cnrConfigIds.push_back(replyObject.id());
|
||||
}
|
||||
|
||||
void AvmVcaTests::onRemoveTvcConfigReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
QVERIFY(!replyObject.error());
|
||||
m_tvcConfigIds.removeAll(replyObject.id());
|
||||
}
|
||||
|
||||
void AvmVcaTests::onRemoveCnrConfigReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
QVERIFY(!replyObject.error());
|
||||
QVERIFY(!replyObject.error());
|
||||
m_cnrConfigIds.removeAll(replyObject.id());
|
||||
}
|
||||
|
||||
} // end namespace
|
||||
|
||||
|
||||
using namespace AudioVideoManagement;
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
const int EXERCISE_42 = 42;
|
||||
const int OPERATOR = 22;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
class CmdLineParser : public LtsCommandLineParser::LtsCommandLineParser
|
||||
{
|
||||
public:
|
||||
CmdLineParser()
|
||||
: LtsCommandLineParser()
|
||||
{
|
||||
addOption( { QStringList() << QLatin1String("o") << QLatin1String("operatorId")
|
||||
, QLatin1String("OperatorId.")
|
||||
, QLatin1String("Operator")
|
||||
, QString::number(OPERATOR)
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
int operatorId() const { return isSet(QLatin1String("o")) ? value(QLatin1String("o")).toInt() : OPERATOR; }
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* The command line options are possibly separated by "--".
|
||||
* All options left from "--" are consumed by ourselves.
|
||||
* Options right from "--" are cosumed by QTest::qExec().
|
||||
*/
|
||||
int findDoubleDash(int argc, char **argv)
|
||||
{
|
||||
const std::string doubleDash{"--"};
|
||||
auto found = std::find_if(&argv[0], &argv[argc], [&doubleDash] (const char *s) { return s == doubleDash; });
|
||||
return found - argv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrun all the command line options right of "--". These are supposed to be given to QTest::qExec().
|
||||
*/
|
||||
QStringList qTestOptions(int argc, char **argv, int dashIndex)
|
||||
{
|
||||
Q_ASSERT(argc > 0);
|
||||
Q_ASSERT(dashIndex > 0 && dashIndex <= argc);
|
||||
QStringList options{QString::fromUtf8(argv[0])}; // program name
|
||||
if (dashIndex == argc)
|
||||
return options;
|
||||
|
||||
std::transform(&argv[dashIndex + 1], &argv[argc], std::back_inserter(options), [] (const char *s) { return QString::fromUtf8(s); });
|
||||
return options;
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int dashIndex = findDoubleDash(argc, argv);
|
||||
NGLCoreApplication app(dashIndex, argv);
|
||||
app.createLogger("avm", "log4cxx_avm.props");
|
||||
|
||||
CmdLineParser cmdlineOptions;
|
||||
Q_ASSERT(cmdlineOptions.init());
|
||||
|
||||
const int exerciseId = cmdlineOptions.exerciseId() > 0 ? cmdlineOptions.exerciseId() : EXERCISE_42;
|
||||
AvmVcaTests tests{cmdlineOptions.domainId(), exerciseId, cmdlineOptions.operatorId()};
|
||||
|
||||
return QTest::qExec(&tests, qTestOptions(argc, argv, dashIndex));
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
*
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Gerlinde Rudolphus, SLSE, 2017-10-20
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AudioVideoManagement/avm_ftc.h>
|
||||
#include <AudioVideoManagement/avm_ftc_types.h>
|
||||
#include <AudioVideoManagement/avm_dtc.h>
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
|
||||
/**
|
||||
* @author Astrid Mueller, Christian Fröbel
|
||||
*/
|
||||
class AvmVcaTests : public QObject
|
||||
, protected Interface::Ftc::ModifyCnrTvcProfileReplyHandler
|
||||
, protected Interface::Ftc::RemoveCnrTvcProfileReplyHandler
|
||||
, protected Interface::Ftc::ModifyTvcConfigReplyHandler
|
||||
, protected Interface::Ftc::ModifyCnrConfigReplyHandler
|
||||
, protected Interface::Ftc::RemoveTvcConfigReplyHandler
|
||||
, protected Interface::Ftc::RemoveCnrConfigReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AvmVcaTests(int domainId, int exerciseId, int operatorId);
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
void cleanupTestCase();
|
||||
|
||||
void test();
|
||||
|
||||
private:
|
||||
void create();
|
||||
void modify();
|
||||
void remove();
|
||||
|
||||
/** FunctionTopic replies */
|
||||
///@{
|
||||
void onModifyCnrTvcProfileReply(const Core::FunctionReplyObject &replyObject) override final;
|
||||
void onRemoveCnrTvcProfileReply(const Core::FunctionReplyObject &replyObject) override final;
|
||||
void onModifyTvcConfigReply(const Core::FunctionReplyObject &replyObject) override final;
|
||||
void onModifyCnrConfigReply(const Core::FunctionReplyObject &replyObject) override final;
|
||||
void onRemoveTvcConfigReply(const Core::FunctionReplyObject &replyObject) override final;
|
||||
void onRemoveCnrConfigReply(const Core::FunctionReplyObject &replyObject) override final;
|
||||
///@}
|
||||
|
||||
void createTvcConfig();
|
||||
void createCnrConfig();
|
||||
void removeTvcConfig();
|
||||
void removeCnrConfig();
|
||||
|
||||
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
|
||||
std::shared_ptr<AudioVideoManagement::Interface::Ftc> m_ftc;
|
||||
std::shared_ptr<AudioVideoManagement::Interface::Dtc> m_dtc;
|
||||
const int m_exerciseId;
|
||||
const int m_operatorId;
|
||||
int m_circuitId{-1};
|
||||
bool m_modifyReplyReceived{false};
|
||||
bool m_removeReplyReceived{false};
|
||||
QVector<int> m_tvcConfigIds;
|
||||
QVector<int> m_cnrConfigIds;
|
||||
NGL::INGLLogger &m_logger;
|
||||
};
|
||||
|
||||
} // namespace AudioVideoManagement
|
||||
+419
@@ -0,0 +1,419 @@
|
||||
/**
|
||||
* EXM Function Topic test executable
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Hanna E. Rathje, SLSE, 2015-09-10
|
||||
*/
|
||||
|
||||
#include "mvs_tests.h"
|
||||
|
||||
#include <nglapplication/nglcoreapplication.h>
|
||||
#include <LtsCommandLineParser/LtsCommandLineParser.h>
|
||||
#include <QTimer>
|
||||
#include <QTest>
|
||||
|
||||
#include <AudioVideoManagement/avm_ftc.h>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
//----------------------------------------------------------------------------------
|
||||
MvsTests::MvsTests(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_testId(0)
|
||||
, m_teamId(0)
|
||||
, m_receiverId(0)
|
||||
, m_radioStationId(200)
|
||||
, m_exerciseId(0)
|
||||
, m_bTestsSuccessful(true)
|
||||
, m_logger(getLogger("Test"))
|
||||
{
|
||||
qRegisterMetaType<Core::FunctionReply>("Core::FunctionReply");
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
MvsTests::~MvsTests()
|
||||
{}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
bool MvsTests::init(int domainId, int testId, int teamId, int receiverId, int stationId, int exerciseId)
|
||||
{
|
||||
INFO_LOG(m_logger) << "init begin";
|
||||
|
||||
m_testId = testId;
|
||||
m_teamId = teamId;
|
||||
m_receiverId = receiverId;
|
||||
m_radioStationId = stationId;
|
||||
m_exerciseId = exerciseId;
|
||||
|
||||
// initialize DDS, always on exercise 0
|
||||
m_ddsConnector.reset(new DDSConnector::DdsConnector(domainId, IDL::PartitionType::Global));
|
||||
if (!m_ddsConnector->init())
|
||||
return false;
|
||||
m_ddsConnector->initPublisherSubscriber();
|
||||
|
||||
DEBUG_LOG(m_logger) << "create ftc MVS";
|
||||
m_ftc = AudioVideoManagement::Interface::Ftc::create(m_ddsConnector);
|
||||
DEBUG_LOG(m_logger) << "init ftc MVS";
|
||||
bool bRet = m_ftc->enableAll();
|
||||
DEBUG_LOG(m_logger) << "init end MVS - bRet = " << bRet;
|
||||
|
||||
DEBUG_LOG(m_logger) << "Domain Id = " << domainId;
|
||||
DEBUG_LOG(m_logger) << "Team Id = " << teamId;
|
||||
DEBUG_LOG(m_logger) << "Test Id = " << testId;
|
||||
DEBUG_LOG(m_logger) << "Receiver Id = " << receiverId;
|
||||
DEBUG_LOG(m_logger) << "Radio Station Id = " << stationId;
|
||||
DEBUG_LOG(m_logger) << "Exercise Id = " << exerciseId;
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
void MvsTests::startTest()
|
||||
{
|
||||
INFO_LOG(m_logger) << "startTest";
|
||||
switch (m_testId)
|
||||
{
|
||||
// case 1:
|
||||
// tryCreateVideoTeam();
|
||||
// break;
|
||||
case 2:
|
||||
tryModifyVideoTeam();
|
||||
break;
|
||||
// case 3:
|
||||
// tryDeleteVideoTeam();
|
||||
// break;
|
||||
case 4:
|
||||
tryCreateVideoReceiver();
|
||||
break;
|
||||
case 5:
|
||||
tryModifyVideoReceiver();
|
||||
break;
|
||||
case 6:
|
||||
tryDeleteVideoReceiver();
|
||||
break;
|
||||
case 7:
|
||||
tryModifyActiveVideoReceiver();
|
||||
break;
|
||||
case 8:
|
||||
tryModifyAvsVideoReceiver();
|
||||
break;
|
||||
default:
|
||||
ERROR_LOG(m_logger) << "Unknown test case !";
|
||||
failExit();
|
||||
break;
|
||||
}
|
||||
INFO_LOG(m_logger) << "********* endTest **************";
|
||||
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
//void MvsTests::tryCreateVideoTeam()
|
||||
//{
|
||||
// INFO_LOG(m_logger) << "trying to send createRequest VideoTeam";
|
||||
// VideoTeamModifyRequest request;
|
||||
|
||||
// request.id(0);
|
||||
// request.name("MVS00");
|
||||
// request.streamName("Stream name for MVS00");
|
||||
// request.ssrc(0);
|
||||
// request.vtPort(0);
|
||||
// if (m_exerciseId > 0)
|
||||
// request.exerciseId(m_exerciseId);
|
||||
// else
|
||||
// request.exerciseId(0);
|
||||
|
||||
// if (!m_ftc->videoTeamModifyRequest(request, this))
|
||||
// {
|
||||
// INFO_LOG(m_logger) << "Error requesting create data, as expected";
|
||||
// successExit();
|
||||
// }
|
||||
|
||||
// QTest::qWait(1000);
|
||||
//}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
void MvsTests::tryModifyVideoTeam()
|
||||
{
|
||||
VideoTeamModifyRequest request;
|
||||
|
||||
request.id(m_teamId);
|
||||
request.name("MVS001");
|
||||
request.streamName("Stream name for MVS001");
|
||||
if (m_exerciseId > 0)
|
||||
request.exerciseId(m_exerciseId);
|
||||
else
|
||||
request.exerciseId(0);
|
||||
|
||||
request.vtPort(0);
|
||||
request.ssrc(0);
|
||||
|
||||
if (!m_ftc->videoTeamModifyRequest(request, this))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error requesting modify data";
|
||||
failExit();
|
||||
}
|
||||
|
||||
QTest::qWait(1000);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
//void MvsTests::tryDeleteVideoTeam()
|
||||
//{
|
||||
// Core::RemoveElementRequest request;
|
||||
|
||||
// request.id(m_teamId);
|
||||
|
||||
// if (!m_ftc->videoTeamRemoveRequest(request, this))
|
||||
// {
|
||||
// ERROR_LOG(m_logger) << "Error requesting remove data";
|
||||
// failExit();
|
||||
// }
|
||||
|
||||
// QTest::qWait(1000);
|
||||
//}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
void MvsTests::tryCreateVideoReceiver()
|
||||
{
|
||||
INFO_LOG(m_logger) << "trying to send createRequest VideoReceiver";
|
||||
VideoReceiverModifyRequest request;
|
||||
|
||||
request.id(0);
|
||||
request.streamName("Stream name MVS_00");
|
||||
request.mainStructureElementId(m_radioStationId);
|
||||
request.teamId(m_teamId);
|
||||
request.hostName("Hostname");
|
||||
request.frequency(0);
|
||||
request.isLocked(false);
|
||||
|
||||
if (!m_ftc->videoReceiverModifyRequest(request, this))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error requesting create data";
|
||||
failExit();
|
||||
}
|
||||
|
||||
QTest::qWait(1000);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
void MvsTests::tryModifyVideoReceiver()
|
||||
{
|
||||
VideoReceiverModifyRequest request;
|
||||
|
||||
request.id(m_receiverId);
|
||||
request.streamName("Stream name MVS_001");
|
||||
request.mainStructureElementId(m_radioStationId);
|
||||
request.teamId(m_teamId);
|
||||
request.hostName("Hostname");
|
||||
request.frequency(0);
|
||||
request.isLocked(false);
|
||||
|
||||
if (!m_ftc->videoReceiverModifyRequest(request, this))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error requesting modify data";
|
||||
failExit();
|
||||
}
|
||||
|
||||
QTest::qWait(1000);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
void MvsTests::tryModifyAvsVideoReceiver()
|
||||
{
|
||||
VideoReceiverModifyAvsRequest request;
|
||||
|
||||
request.id(m_receiverId);
|
||||
request.dbm(80);
|
||||
request.snr(20);
|
||||
|
||||
if (!m_ftc->videoReceiverModifyAvsRequest(request, this))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error requesting modify AVS data";
|
||||
failExit();
|
||||
}
|
||||
|
||||
QTest::qWait(1000);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
void MvsTests::tryModifyActiveVideoReceiver()
|
||||
{
|
||||
VideoReceiverModifyActiveRequest request;
|
||||
|
||||
request.id(m_receiverId);
|
||||
request.isActive(true);
|
||||
|
||||
if (!m_ftc->videoReceiverModifyActiveRequest(request, this))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error requesting modify active data";
|
||||
failExit();
|
||||
}
|
||||
|
||||
QTest::qWait(1000);
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
void MvsTests::tryDeleteVideoReceiver()
|
||||
{
|
||||
Core::RemoveElementRequest request;
|
||||
|
||||
request.id(m_receiverId);
|
||||
|
||||
if (!m_ftc->videoReceiverRemoveRequest(request, this))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error requesting remove data";
|
||||
failExit();
|
||||
}
|
||||
|
||||
QTest::qWait(1000);
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
void MvsTests::failExit()
|
||||
{
|
||||
ERROR_LOG(m_logger) << "FAIL EXIT !";
|
||||
m_bTestsSuccessful = false;
|
||||
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
void MvsTests::successExit()
|
||||
{
|
||||
INFO_LOG(m_logger) << "SUCCES EXIT !";
|
||||
m_bTestsSuccessful = true;
|
||||
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
||||
}
|
||||
|
||||
/*
|
||||
//----------------------------------------------------------------------------------
|
||||
void MvsTests::onVideoTeamModifyReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "END (onVideoTeamModifyReply)";
|
||||
if (replyObject.error())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Got onVideoTeamModifyReply error: " << replyObject();
|
||||
QTimer::singleShot(0, qApp, SLOT(quit()));
|
||||
return;
|
||||
}
|
||||
INFO_LOG(m_logger) << "Got Reply with id " << replyObject.id()
|
||||
<< " and errorString " << replyObject.translated();
|
||||
|
||||
m_teamId = replyObject.id();
|
||||
|
||||
QTimer::singleShot(0, qApp, SLOT(quit()));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
void MvsTests::onVideoReceiverModifyReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "END (onVideoReceiverModifyReply)";
|
||||
if (replyObject.error())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Got onVideoReceiverModifyReply error: " << replyObject();
|
||||
QTimer::singleShot(0, qApp, SLOT(quit()));
|
||||
return;
|
||||
}
|
||||
INFO_LOG(m_logger) << "Got Reply with id " << replyObject.id()
|
||||
<< " and errorString " << replyObject.translated();
|
||||
|
||||
m_receiverId = replyObject.id();
|
||||
|
||||
QTimer::singleShot(0, qApp, SLOT(quit()));
|
||||
}
|
||||
*/
|
||||
// ------------------------------------------------------------------------------
|
||||
void MvsTests::onError(const QString &reason)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Got Reply error: " << reason;
|
||||
failExit();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
void MvsTests::onReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
if (replyObject.error())
|
||||
{
|
||||
onError(replyObject.translated());
|
||||
return;
|
||||
}
|
||||
INFO_LOG(m_logger) << "Got Reply with id " << replyObject.id()
|
||||
<< " and errorString " << replyObject.translated();
|
||||
// QTimer::singleShot(0, qApp, SLOT(quit()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
class CmdLineParser : public LtsCommandLineParser::LtsCommandLineParser
|
||||
{
|
||||
public:
|
||||
CmdLineParser()
|
||||
: LtsCommandLineParser()
|
||||
{
|
||||
addOption( { QStringList() << QLatin1String("t") << QLatin1String("testId")
|
||||
, QLatin1String("TestId.")
|
||||
, QLatin1String("Default: 0 ")
|
||||
, QLatin1String("0")
|
||||
} );
|
||||
addOption( { QStringList() << QLatin1String("p") << QLatin1String("teamId")
|
||||
, QLatin1String("TeamId")
|
||||
, QLatin1String("Default: 0 ")
|
||||
, QLatin1String("0")
|
||||
} );
|
||||
addOption( { QStringList() << QLatin1String("r") << QLatin1String("receiverId")
|
||||
, QLatin1String("ReceiverId")
|
||||
, QLatin1String("Default: 0 ")
|
||||
, QLatin1String("0")
|
||||
} );
|
||||
addOption( { QStringList() << QLatin1String("s") << QLatin1String("stationId")
|
||||
, QLatin1String("StationId")
|
||||
, QLatin1String("Default: 200 ")
|
||||
, QLatin1String("0")
|
||||
} );
|
||||
}
|
||||
|
||||
int testId() const { return isSet(QLatin1String("t")) ? value(QLatin1String("t")).toInt() : 0; }
|
||||
int teamId() const { return isSet(QLatin1String("p")) ? value(QLatin1String("p")).toInt() : 0; }
|
||||
int receiverId() const { return isSet(QLatin1String("r")) ? value(QLatin1String("r")).toInt() : 0; }
|
||||
int stationId() const { return isSet(QLatin1String("s")) ? value(QLatin1String("s")).toInt() : 200; }
|
||||
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int iRet = -1;
|
||||
|
||||
NGLCoreApplication app(argc, argv);
|
||||
app.createLogger("AVM", 0);
|
||||
|
||||
CmdLineParser options;
|
||||
if (!options.init())
|
||||
return iRet;
|
||||
|
||||
std::unique_ptr<AudioVideoManagement::MvsTests> MvsTests(new AudioVideoManagement::MvsTests);
|
||||
|
||||
if (!MvsTests->init(options.domainId(), options.testId(), options.teamId(), options.receiverId(), options.stationId(), options.exerciseId()))
|
||||
return iRet;
|
||||
|
||||
QTimer::singleShot(0, MvsTests.get(), &AudioVideoManagement::MvsTests::startTest);
|
||||
|
||||
STARTUP_LOG(app.baseLogger());
|
||||
|
||||
app.exec();
|
||||
|
||||
iRet = MvsTests->testsSuccessful() ? 0 : 1;
|
||||
fprintf(stderr, "\n%d\n\n", iRet);
|
||||
|
||||
INFO_LOG(app.baseLogger()) << "** TEST result = " << iRet;
|
||||
|
||||
SHUTDOWN_LOG(app.baseLogger());
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
*
|
||||
* EXM Function Topic test executable
|
||||
*
|
||||
* ModuleTests for create/modify/remove exercise
|
||||
* ---------------------------------------------------
|
||||
* Client FTC is implemented
|
||||
*
|
||||
* => (!) Preconditon:
|
||||
* - Service sExeMgmt running
|
||||
*
|
||||
* -------------------------------------------------
|
||||
*
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*
|
||||
* Created by Hanna E. Rathje, SLSE, 2015-09-10
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AudioVideoManagement/avm_ftc.h>
|
||||
#include <AudioVideoManagement/logger.h>
|
||||
|
||||
#include <DDS/DDSConnector/dds_connector.h>
|
||||
#include <QObject>
|
||||
|
||||
namespace AudioVideoManagement
|
||||
{
|
||||
class MvsTests : public QObject
|
||||
, protected AudioVideoManagement::Interface::Ftc::VideoTeamModifyReplyHandler
|
||||
, protected AudioVideoManagement::Interface::Ftc::VideoReceiverModifyReplyHandler
|
||||
, protected AudioVideoManagement::Interface::Ftc::VideoReceiverModifyActiveReplyHandler
|
||||
, protected AudioVideoManagement::Interface::Ftc::VideoReceiverModifyAvsReplyHandler
|
||||
, protected AudioVideoManagement::Interface::Ftc::VideoReceiverRemoveReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MvsTests(QObject *parent = nullptr);
|
||||
~MvsTests();
|
||||
|
||||
bool init(int domainId, int testId, int teamId, int receiverId, int stationId, int exerciseId);
|
||||
bool testsSuccessful() const { return m_bTestsSuccessful; }
|
||||
|
||||
public Q_SLOTS:
|
||||
void startTest();
|
||||
protected Q_SLOTS:
|
||||
// void tryCreateVideoTeam();
|
||||
void tryModifyVideoTeam();
|
||||
// void tryDeleteVideoTeam();
|
||||
void tryCreateVideoReceiver();
|
||||
void tryModifyVideoReceiver();
|
||||
void tryDeleteVideoReceiver();
|
||||
void tryModifyActiveVideoReceiver();
|
||||
void tryModifyAvsVideoReceiver();
|
||||
|
||||
protected:
|
||||
void onVideoTeamModifyReply(const Core::FunctionReplyObject &replyObject) override final { onReply(replyObject); }
|
||||
|
||||
void onVideoReceiverModifyReply(const Core::FunctionReplyObject &replyObject) override final { onReply(replyObject); }
|
||||
void onVideoReceiverModifyActiveReply(const Core::FunctionReplyObject &replyObject) override final { onReply(replyObject); }
|
||||
void onVideoReceiverModifyAvsReply(const Core::FunctionReplyObject &replyObject) override final { onReply(replyObject); }
|
||||
void onVideoReceiverRemoveReply(const Core::FunctionReplyObject &replyObject) override final { onReply(replyObject); }
|
||||
|
||||
void failExit();
|
||||
void successExit();
|
||||
void onError(const QString &reason);
|
||||
void onReply(const Core::FunctionReplyObject &replyObject);
|
||||
|
||||
private:
|
||||
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
|
||||
std::shared_ptr<AudioVideoManagement::Interface::Ftc> m_ftc;
|
||||
|
||||
int m_testId;
|
||||
int m_teamId;
|
||||
int m_receiverId;
|
||||
int m_radioStationId;
|
||||
int m_exerciseId;
|
||||
bool m_bTestsSuccessful;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user