692 lines
20 KiB
C++
Executable File
692 lines
20 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
*
|
|
* PPM Function Topic test executable
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*
|
|
* Created by Hannes Baeuerle, SLSE, 2015-07-18
|
|
*/
|
|
|
|
#include "ppm_tests.h"
|
|
|
|
#include <nglapplication/nglcoreapplication.h>
|
|
#include <LtsCommandLineParser/LtsCommandLineParser.h>
|
|
|
|
#include <QTest>
|
|
#include <QTimer>
|
|
|
|
//--------------------------------------------------------------------------------
|
|
ParticipantManagement::PpmTests::PpmTests(QObject *parent)
|
|
: QObject(parent)
|
|
, m_testId(-1)
|
|
, m_partyId(-1)
|
|
, m_typeId(-1)
|
|
, m_equipmentId(-1)
|
|
, m_participantId(1)
|
|
, m_bTestsSuccessful(true)
|
|
, m_logger(getLogger("Test"))
|
|
{
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------
|
|
ParticipantManagement::PpmTests::~PpmTests()
|
|
{
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------
|
|
void ParticipantManagement::PpmTests::startTest()
|
|
{
|
|
INFO_LOG(m_logger) << "********* startTest **************";
|
|
switch (m_testId)
|
|
{
|
|
case 1:
|
|
tryCreateEquipmentType();
|
|
break;
|
|
case 2:
|
|
tryCreateType();
|
|
break;
|
|
case 3:
|
|
tryModifyType();
|
|
break;
|
|
case 4:
|
|
tryRemoveType();
|
|
break;
|
|
case 5:
|
|
tryCreateParticipant();
|
|
break;
|
|
case 6:
|
|
tryCreateTemplate();
|
|
break;
|
|
case 7:
|
|
tryUpdateInfoParticipant();
|
|
break;
|
|
case 8:
|
|
tryRegisterParticipant();
|
|
break;
|
|
case 10:
|
|
tryCreateParty();
|
|
break;
|
|
case 11:
|
|
tryModifyParty();
|
|
break;
|
|
case 12:
|
|
tryRemoveParty();
|
|
break;
|
|
case 13:
|
|
trySyncParties();
|
|
break;
|
|
case 14:
|
|
tryChangeUsed();
|
|
break;
|
|
default:
|
|
failExit();
|
|
break;
|
|
}
|
|
INFO_LOG(m_logger) << "********* endTest **************";
|
|
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------
|
|
bool ParticipantManagement::PpmTests::init(int domainId, int exerciseId, int testId, int partyId, int typeId, int equipmentId, int participantId)
|
|
{
|
|
INFO_LOG(m_logger) << "init begin";
|
|
|
|
m_testId = testId;
|
|
m_partyId = partyId;
|
|
m_typeId = typeId;
|
|
m_equipmentId = equipmentId;
|
|
m_participantId = participantId;
|
|
|
|
if (exerciseId > 0)
|
|
m_ddsConnector.reset(new DDSConnector::DdsConnector(domainId, IDL::PartitionType::Exercise, exerciseId));
|
|
else
|
|
m_ddsConnector.reset(new DDSConnector::DdsConnector(domainId, IDL::PartitionType::Global));
|
|
|
|
if (!m_ddsConnector->init())
|
|
return false;
|
|
m_ddsConnector->initPublisherSubscriber();
|
|
|
|
DEBUG_LOG(m_logger) << "create DTC PPM";
|
|
m_dtc = ParticipantManagement::Interface::Dtc::create(m_ddsConnector);
|
|
DEBUG_LOG(m_logger) << "init DTC PPM";
|
|
bool bRet = m_dtc->enableAll();
|
|
|
|
DEBUG_LOG(m_logger) << "create FTC PPM";
|
|
m_ftc = ParticipantManagement::Interface::Ftc::create(m_ddsConnector);
|
|
DEBUG_LOG(m_logger) << "init FTC PPM";
|
|
bRet &= m_ftc->enableAll();
|
|
DEBUG_LOG(m_logger) << "init end PPM - bRet = " << bRet;
|
|
|
|
DEBUG_LOG(m_logger) << "Domain Id = " << domainId;
|
|
DEBUG_LOG(m_logger) << "Test Id = " << testId;
|
|
DEBUG_LOG(m_logger) << "Party Id = " << partyId;
|
|
DEBUG_LOG(m_logger) << "Type Id = " << typeId;
|
|
DEBUG_LOG(m_logger) << "Equipment Id = " << equipmentId;
|
|
|
|
return bRet;
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------
|
|
void ParticipantManagement::PpmTests::tryCreateTemplate()
|
|
{
|
|
INFO_LOG(m_logger) << "Trying to send Create Template";
|
|
|
|
std::vector<ParticipantManagement::TemplateData> data;
|
|
|
|
ParticipantManagement::TemplateData td;
|
|
td.modId(100);
|
|
td.name("Test Template 100");
|
|
td.designator("100");
|
|
td.hierarchyNumber(100);
|
|
td.typeId(19);
|
|
td.superiorModId(1);
|
|
td.tacticalIdentifier("100");
|
|
|
|
data.push_back(td);
|
|
|
|
m_dtc->waitForHistoricalDataTemplateParticipant();
|
|
ParticipantManagement::TemplateParticipant tp = m_dtc->templateParticipant(1);
|
|
const ParticipantManagement::TemplateData tdSup(m_dtc->convertFromParticipantTemplateToTemplateData(tp));
|
|
DEBUG_LOG(m_logger) << "SuperiorModId: " << tdSup.modId();
|
|
|
|
data.push_back(tdSup);
|
|
|
|
if (!m_ftc->modifyTemplateDataRequest(ModifyTemplateDataRequest(data),this))
|
|
{
|
|
ERROR_LOG(m_logger) << "Error creating template data";
|
|
failExit();
|
|
}
|
|
QTest::qWait(1000);
|
|
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------
|
|
void ParticipantManagement::PpmTests::tryCreateParticipant()
|
|
{
|
|
INFO_LOG(m_logger) << "Trying to send Create ParticipantData per ModifyParticipantData";
|
|
|
|
ParticipantManagement::ParticipantData ptd;
|
|
ptd.modId(1);
|
|
ptd.name("Test Participant 1");
|
|
ptd.typeId(m_typeId);
|
|
ptd.partyId(m_partyId);
|
|
ptd.equipmentNumber(m_equipmentId);
|
|
ptd.hierarchyNumber(1);
|
|
ptd.assignState(ParticipantManagement::ParticipantAssignState_def::HandoutExcon);
|
|
|
|
std::vector<ParticipantManagement::ParticipantData> data;
|
|
data.push_back(ptd);
|
|
ModifyParticipantDataRequest req;
|
|
req.data(data);
|
|
|
|
if (!m_ftc->modifyParticipantDataRequest(req,this))
|
|
{
|
|
ERROR_LOG(m_logger) << "Error creating participant data";
|
|
failExit();
|
|
}
|
|
QTest::qWait(1000);
|
|
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------
|
|
void ParticipantManagement::PpmTests::tryUpdateInfoParticipant()
|
|
{
|
|
INFO_LOG(m_logger) << "Trying to send update info per registerForParticantRequest";
|
|
|
|
ParticipantManagement::RegisterParticipantRequest rpr;
|
|
rpr.participantId(m_participantId);
|
|
rpr.equipmentNumber(m_equipmentId);
|
|
rpr.assignState(ParticipantManagement::ParticipantAssignState_def::HandoutExcon);
|
|
rpr.identification("Test Indentification");
|
|
rpr.info("Test Info2");
|
|
|
|
if (!m_ftc->registerParticipantRequest(rpr,this))
|
|
{
|
|
ERROR_LOG(m_logger) << "Error updating info/identification for participant";
|
|
failExit();
|
|
}
|
|
QTest::qWait(1000);
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------
|
|
void ParticipantManagement::PpmTests::tryRegisterParticipant()
|
|
{
|
|
INFO_LOG(m_logger) << "Trying to send registerForParticantRequest";
|
|
|
|
ParticipantManagement::RegisterParticipantRequest rpr;
|
|
rpr.participantId(m_participantId);
|
|
rpr.equipmentNumber(m_equipmentId);
|
|
rpr.assignState(ParticipantManagement::ParticipantAssignState_def::HandoutExcon);
|
|
rpr.identification("Test");
|
|
rpr.info("Test Info");
|
|
|
|
if (!m_ftc->registerParticipantRequest(rpr,this))
|
|
{
|
|
ERROR_LOG(m_logger) << "Error updating info/identification for participant";
|
|
failExit();
|
|
}
|
|
QTest::qWait(1000);
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------
|
|
void ParticipantManagement::PpmTests::tryCreateParty()
|
|
{
|
|
INFO_LOG(m_logger) << "Trying to Create Party per ModifyPartyData";
|
|
|
|
ParticipantManagement::Party party;
|
|
|
|
party.name("Test Party AAA");
|
|
party.role(ParticipantManagement::Role::Friend);
|
|
party.color(-65536);
|
|
party.fadingColor(-65536);
|
|
|
|
ModifyPartyDataRequest req;
|
|
req.id(-1);
|
|
req.name(party.name());
|
|
req.color(party.color());
|
|
req.fadingColor(party.fadingColor());
|
|
req.role(party.role());
|
|
req.isUsedBy(false);
|
|
|
|
if (!m_ftc->modifyPartyDataRequest(req, this))
|
|
{
|
|
ERROR_LOG(m_logger) << "Error creating party data";
|
|
failExit();
|
|
}
|
|
|
|
party.name("Test Party BBB");
|
|
party.role(ParticipantManagement::Role::Friend);
|
|
party.color(-16711936);
|
|
party.fadingColor(-16711936);
|
|
|
|
req.id(-1);
|
|
req.name(party.name());
|
|
req.color(party.color());
|
|
req.fadingColor(party.fadingColor());
|
|
req.role(party.role());
|
|
req.isUsedBy(false);
|
|
|
|
if (!m_ftc->modifyPartyDataRequest(req, this))
|
|
{
|
|
ERROR_LOG(m_logger) << "Error creating party data";
|
|
failExit();
|
|
}
|
|
|
|
party.name("Test Party CCC");
|
|
party.role(ParticipantManagement::Role::Enemy);
|
|
party.color(-16711936);
|
|
party.fadingColor(-16711936);
|
|
|
|
req.id(-1);
|
|
req.name(party.name());
|
|
req.color(party.color());
|
|
req.fadingColor(party.fadingColor());
|
|
req.role(party.role());
|
|
req.isUsedBy(false);
|
|
|
|
if (!m_ftc->modifyPartyDataRequest(req, this))
|
|
{
|
|
ERROR_LOG(m_logger) << "Error creating party data";
|
|
failExit();
|
|
}
|
|
|
|
party.name("Test Party DDD");
|
|
party.role(ParticipantManagement::Role::Enemy);
|
|
party.color(-16711936);
|
|
party.fadingColor(-16711936);
|
|
|
|
req.id(-1);
|
|
req.name(party.name());
|
|
req.color(party.color());
|
|
req.fadingColor(party.fadingColor());
|
|
req.role(party.role());
|
|
req.isUsedBy(false);
|
|
|
|
if (!m_ftc->modifyPartyDataRequest(req, this))
|
|
{
|
|
ERROR_LOG(m_logger) << "Error creating party data";
|
|
failExit();
|
|
}
|
|
|
|
QTest::qWait(1000);
|
|
}
|
|
|
|
|
|
//--------------------------------------------------------------------------------
|
|
void ParticipantManagement::PpmTests::tryModifyParty()
|
|
{
|
|
INFO_LOG(m_logger) << "Trying to send Modify PartyData per ModifyPartyData";
|
|
|
|
ParticipantManagement::Party party;
|
|
|
|
m_dtc->waitForHistoricalDataParty();
|
|
party = m_dtc->party(m_partyId);
|
|
if (party.id() < 0)
|
|
{
|
|
ERROR_LOG(m_logger) << "Party not found: id = " << m_partyId;
|
|
failExit();
|
|
}
|
|
|
|
ModifyPartyDataRequest req;
|
|
req.id(m_partyId);
|
|
req.name(std::string("Test Party ")+QString::number(m_partyId).toStdString()); // updating name
|
|
req.color(party.color());
|
|
req.fadingColor(party.fadingColor());
|
|
req.role(party.role());
|
|
req.isUsedBy(true); // updating isUsed
|
|
|
|
if (!m_ftc->modifyPartyDataRequest(req, this))
|
|
{
|
|
ERROR_LOG(m_logger) << "Error modifying party data";
|
|
failExit();
|
|
}
|
|
|
|
QTest::qWait(1000);
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------
|
|
void ParticipantManagement::PpmTests::tryRemoveParty()
|
|
{
|
|
INFO_LOG(m_logger) << "Trying to send RemoveParty";
|
|
|
|
ParticipantManagement::Party party;
|
|
|
|
m_dtc->waitForHistoricalDataParty();
|
|
party = m_dtc->party(m_partyId);
|
|
if (party.id() < 0)
|
|
{
|
|
ERROR_LOG(m_logger) << "Party not found: id = " << m_partyId;
|
|
failExit();
|
|
}
|
|
|
|
RemovePartyRequest req;
|
|
req.partyId(m_partyId);
|
|
|
|
if (!m_ftc->removePartyRequest(req,this))
|
|
{
|
|
if (party.isUsedBy())
|
|
{
|
|
INFO_LOG(m_logger) << "Not possible to delete used party!" ;
|
|
successExit();
|
|
}
|
|
else
|
|
{
|
|
ERROR_LOG(m_logger) << "Failed to delete not used party with id " << m_partyId;
|
|
failExit();
|
|
}
|
|
}
|
|
|
|
QTest::qWait(1000);
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------
|
|
void ParticipantManagement::PpmTests::trySyncParties()
|
|
{
|
|
INFO_LOG(m_logger) << "Trying to sync parties with Ex 0";
|
|
|
|
SyncPartiesRequest req;
|
|
req.exerciseId(42);
|
|
|
|
if (!m_ftc->syncPartiesRequest(req, this))
|
|
{
|
|
ERROR_LOG(m_logger) << "Error sync parties";
|
|
failExit();
|
|
}
|
|
|
|
QTest::qWait(1000);
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------
|
|
void ParticipantManagement::PpmTests::tryChangeUsed()
|
|
{
|
|
INFO_LOG(m_logger) << "Trying to send change used";
|
|
|
|
ParticipantManagement::Party party;
|
|
|
|
m_dtc->waitForHistoricalDataParty();
|
|
party = m_dtc->party(m_partyId);
|
|
if (party.id() < 0)
|
|
{
|
|
ERROR_LOG(m_logger) << "Party not found: id = " << m_partyId;
|
|
failExit();
|
|
}
|
|
|
|
ChangePartyUsedStateRequest req;
|
|
req.partyId(m_partyId);
|
|
req.isUsedBy(false); // updating isUsed
|
|
|
|
if (!m_ftc->changePartyUsedStateRequest(req, this))
|
|
{
|
|
ERROR_LOG(m_logger) << "Error modifying used party";
|
|
failExit();
|
|
}
|
|
|
|
QTest::qWait(1000);
|
|
}
|
|
|
|
|
|
//--------------------------------------------------------------------------------
|
|
void ParticipantManagement::PpmTests::tryCreateEquipmentType()
|
|
{
|
|
INFO_LOG(m_logger) << "Trying to send Create EquipmentType per ModifyEquipmentTypeDataRequest";
|
|
|
|
ParticipantManagement::EquipmentType etd;
|
|
etd.id(1);
|
|
etd.name("Test Equipment Type 1");
|
|
etd.minEquipNo(1000);
|
|
etd.maxEquipNo(1999);
|
|
etd.traVulnerabilityModelId(1);
|
|
etd.traPlayerTypeId(110);
|
|
etd.wmsTypeClass(ParticipantManagement::WmsTypeClass::Human);
|
|
etd.deletedInWms(false);
|
|
|
|
std::vector<ParticipantManagement::EquipmentType> data;
|
|
data.push_back(etd);
|
|
|
|
if (!m_ftc->modifyEquipmentTypeDataRequest(ModifyEquipmentTypeDataRequest(data, false),this))
|
|
{
|
|
ERROR_LOG(m_logger) << "Error creating equipment type data";
|
|
failExit();
|
|
}
|
|
QTest::qWait(1000);
|
|
}
|
|
|
|
|
|
//--------------------------------------------------------------------------------
|
|
void ParticipantManagement::PpmTests::tryCreateType()
|
|
{
|
|
INFO_LOG(m_logger) << "Trying to send CreateTypeRequest";
|
|
|
|
if (!m_ftc->modifyTypeRequest(Type(0,
|
|
ParticipantManagement::TypeClass::SupportEntity,
|
|
20,
|
|
std::string("1"),
|
|
std::string("TestType"),
|
|
1,
|
|
0,
|
|
false,
|
|
{}, std::string()),
|
|
this))
|
|
{
|
|
ERROR_LOG(m_logger) << "Error creating type data";
|
|
failExit();
|
|
}
|
|
|
|
QTest::qWait(1000);
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------
|
|
void ParticipantManagement::PpmTests::tryModifyType()
|
|
{
|
|
INFO_LOG(m_logger) << "Trying to send ModifyTypeRequest";
|
|
|
|
if (!m_ftc->modifyTypeRequest(Type(m_typeId,
|
|
ParticipantManagement::TypeClass::SupportEntity,
|
|
20,
|
|
std::string("1"),
|
|
std::string("TestType Modified"),
|
|
1,
|
|
0,
|
|
false,
|
|
{}, std::string()),
|
|
this))
|
|
{
|
|
ERROR_LOG(m_logger) << "Error modifying type data";
|
|
failExit();
|
|
}
|
|
QTest::qWait(1000);
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------
|
|
void ParticipantManagement::PpmTests::tryRemoveType()
|
|
{
|
|
INFO_LOG(m_logger) << "Trying to send RemoveTypeRequest";
|
|
|
|
if (!m_ftc->removeTypeRequest(RemoveTypeRequest(m_typeId), this))
|
|
{
|
|
ERROR_LOG(m_logger) << "Error modifying type data";
|
|
failExit();
|
|
}
|
|
QTest::qWait(1000);
|
|
}
|
|
|
|
//********************* GENERAL *************************************************
|
|
// ------------------------------------------------------------------------------
|
|
void ParticipantManagement::PpmTests::onError(const QString &reason)
|
|
{
|
|
ERROR_LOG(m_logger) << "Got Reply error: " << reason;
|
|
failExit();
|
|
}
|
|
|
|
// ------------------------------------------------------------------------------
|
|
void ParticipantManagement::PpmTests::onCreateReply(const Core::FunctionReplyObject &replyObject)
|
|
{
|
|
if (replyObject.error())
|
|
{
|
|
onError(replyObject.translated());
|
|
return;
|
|
}
|
|
INFO_LOG(m_logger) << "Got createReply with id " << replyObject.id()
|
|
<< " and errorString " << replyObject.translated();
|
|
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
|
}
|
|
|
|
// ------------------------------------------------------------------------------
|
|
void ParticipantManagement::PpmTests::onModifyReply(const Core::FunctionReplyObject &replyObject)
|
|
{
|
|
if (replyObject.error())
|
|
{
|
|
onError(replyObject.translated());
|
|
return;
|
|
}
|
|
INFO_LOG(m_logger) << "Got modifyRequest with id " << replyObject.id()
|
|
<< " and errorString " << replyObject.translated();
|
|
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
|
}
|
|
|
|
// ------------------------------------------------------------------------------
|
|
void ParticipantManagement::PpmTests::onRemoveReply(const Core::FunctionReplyObject &replyObject)
|
|
{
|
|
if (replyObject.error())
|
|
{
|
|
onError(replyObject.translated());
|
|
return;
|
|
}
|
|
INFO_LOG(m_logger) << "Got removeReply with id " << replyObject.id()
|
|
<< " and errorString " << replyObject.translated();
|
|
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
|
}
|
|
|
|
// ------------------------------------------------------------------------------
|
|
void ParticipantManagement::PpmTests::onSyncPartiesReply(const Core::FunctionReplyObject &replyObject)
|
|
{
|
|
if (replyObject.error())
|
|
{
|
|
onError(replyObject.translated());
|
|
return;
|
|
}
|
|
INFO_LOG(m_logger) << "Got syncParties with id " << replyObject.id()
|
|
<< " and errorString " << replyObject.translated();
|
|
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------------------
|
|
void ParticipantManagement::PpmTests::onRemovePartyReply(const Core::FunctionReplyObject &replyObject)
|
|
{
|
|
ParticipantManagement::Party party;
|
|
|
|
m_dtc->waitForHistoricalDataParty();
|
|
party = m_dtc->party(m_partyId);
|
|
|
|
if (replyObject.error() && !party.isUsedBy())
|
|
{
|
|
onError(replyObject.translated());
|
|
return;
|
|
}
|
|
INFO_LOG(m_logger) << "Got removeReply with id " << replyObject.id()
|
|
<< " and errorString " << replyObject.translated();
|
|
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
|
}
|
|
|
|
void ParticipantManagement::PpmTests::onRegisterParticipantReply(const RegisterReply &reply)
|
|
{
|
|
ERROR_LOG(m_logger) << "onRegisterParticipantReply " << reply.errorString() << "exerciseId: " << reply.exerciseId();
|
|
for ( std::string str : reply.errorParams())
|
|
ERROR_LOG(m_logger) << "error params: " << str;
|
|
}
|
|
|
|
// ------------------------------------------------------------------------------
|
|
void ParticipantManagement::PpmTests::failExit()
|
|
{
|
|
ERROR_LOG(m_logger) << "FAIL EXIT !";
|
|
m_bTestsSuccessful = false;
|
|
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
|
}
|
|
|
|
// ------------------------------------------------------------------------------
|
|
void ParticipantManagement::PpmTests::successExit()
|
|
{
|
|
INFO_LOG(m_logger) << "SUCCESS EXIT !";
|
|
m_bTestsSuccessful = true;
|
|
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
|
}
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
class CmdLineParser : public LtsCommandLineParser::LtsCommandLineParser
|
|
{
|
|
public:
|
|
CmdLineParser()
|
|
: LtsCommandLineParser()
|
|
{
|
|
addOption( { QStringList() << QLatin1String("t") << QLatin1String("testId")
|
|
, QLatin1String("TestId.")
|
|
, QLatin1String("Default: -1")
|
|
, QLatin1String("0")
|
|
} );
|
|
addOption( { QStringList() << QLatin1String("p") << QLatin1String("partyId")
|
|
, QLatin1String("PartyId")
|
|
, QLatin1String("Default: -1")
|
|
, QLatin1String("0")
|
|
} );
|
|
addOption( { QStringList() << QLatin1String("y") << QLatin1String("typeId")
|
|
, QLatin1String("TypeId")
|
|
, QLatin1String("Default: -1")
|
|
, QLatin1String("0")
|
|
} );
|
|
addOption( { QStringList() << QLatin1String("q") << QLatin1String("equipmentId")
|
|
, QLatin1String("EquipmentId.")
|
|
, QLatin1String("Default: -1")
|
|
, QLatin1String("0")
|
|
} );
|
|
addOption( { QStringList() << QLatin1String("a") << QLatin1String("participantId")
|
|
, QLatin1String("ParticipantId.")
|
|
, QLatin1String("Default: 1")
|
|
, QLatin1String("0")
|
|
} );
|
|
|
|
}
|
|
int testId() const { return isSet(QLatin1String("t")) ? value(QLatin1String("t")).toInt() : -1; }
|
|
int partyId() const { return isSet(QLatin1String("p")) ? value(QLatin1String("p")).toInt() : -1; }
|
|
int typeId() const { return isSet(QLatin1String("y")) ? value(QLatin1String("y")).toInt() : -1; }
|
|
int equipmentId() const { return isSet(QLatin1String("q")) ? value(QLatin1String("q")).toInt() : -1; }
|
|
int participantId() const { return isSet(QLatin1String("a")) ? value(QLatin1String("a")).toInt() : 1; }
|
|
};
|
|
|
|
// ------------------------------------------------------------------
|
|
int main(int argc, char **argv)
|
|
{
|
|
int iRet = -1;
|
|
|
|
NGLCoreApplication app(argc, argv);
|
|
app.createLogger("PPM", 0 );
|
|
|
|
CmdLineParser options;
|
|
if (!options.init())
|
|
return iRet;
|
|
|
|
std::unique_ptr<ParticipantManagement::PpmTests> PpmTests(new ParticipantManagement::PpmTests);
|
|
|
|
if(!PpmTests->init(options.domainId(), options.exerciseId(), options.testId(), options.partyId(),
|
|
options.typeId(), options.equipmentId(), options.participantId()))
|
|
return iRet;
|
|
|
|
QTimer::singleShot(0, PpmTests.get(), &ParticipantManagement::PpmTests::startTest);
|
|
|
|
STARTUP_LOG(app.baseLogger());
|
|
|
|
app.exec();
|
|
|
|
iRet = PpmTests->testsSuccessful() ? 0 : 1;
|
|
fprintf(stderr, "\n%d\n\n", iRet);
|
|
|
|
INFO_LOG(app.baseLogger()) << "** TEST result = " << iRet;
|
|
|
|
SHUTDOWN_LOG(app.baseLogger());
|
|
|
|
return iRet;
|
|
}
|