264 lines
12 KiB
C++
Executable File
264 lines
12 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* ModuleTest
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <DDS/DDSConnector/dds_connector.h>
|
|
#include <LtsCommandLineParser/LtsCommandLineParser.h>
|
|
|
|
#include <AreaEffectSimulation/aes_ftc.h>
|
|
#include <AreaEffectSimulation/aes_dtc.h>
|
|
#include <AreaEffectSimulation/logger.h>
|
|
|
|
#include <Plugins/InfrastructureManagement/ism_data_plugin_interface.h>
|
|
|
|
#include <ExerciseManagement/exm_dtc.h>
|
|
#include <InfrastructureManagement/ism_dtc.h>
|
|
#include <ParticipantManagement/ppm_dtc.h>
|
|
#include <ProjectDataManagement/pdm_dtc.h>
|
|
#include <ParticipantManagement/ppm_ftc.h>
|
|
|
|
|
|
#include <QCoreApplication>
|
|
#include <QtTest/QTest>
|
|
|
|
#include <memory>
|
|
|
|
using namespace AreaEffectSimulation; // JUST FOR LOGGER_T
|
|
|
|
|
|
class CmdLineParser : public LtsCommandLineParser::LtsCommandLineParser
|
|
{
|
|
public:
|
|
CmdLineParser()
|
|
: LtsCommandLineParser(ProvideCommandLineParameterOptions(DomainId | ExerciseId | NoVersion))
|
|
{
|
|
}
|
|
};
|
|
|
|
|
|
class ModuleTestLimits : public QObject
|
|
, protected AreaEffectSimulation::Interface::Ftc::ExplosionClusterModifyReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::ExplosionClusterRemoveReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::ExplosionAreaModifyReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::ExplosionSingleModifyReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::MineAreaModifyReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::MineAreaRemoveReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::NContaminationModifyReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::NContaminationRemoveReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::OffRouteMineModifyReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::OffRouteMineRemoveReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::BoobyTrapModifyReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::BoobyTrapRemoveReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::BCContaminationModifyReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::BCContaminationRemoveReplyHandler
|
|
, protected ParticipantManagement::Interface::Ftc::SetSimulatedPositionReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::ChargeAdministrationModifyReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::TechnicalAreaModifyReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::FunctionalAreaModifyReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::FunctionalAreaRemoveReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::TechnicalAreaRemoveReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::ExplosionSingleRemoveReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::ExplosionAreaRemoveReplyHandler
|
|
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
ModuleTestLimits(int domainId, int exerciseId);
|
|
|
|
protected:
|
|
void onExplosionClusterModifyReply(const Core::FunctionReplyObject &replyObject) override;
|
|
|
|
|
|
|
|
// helper
|
|
bool waitForData(const std::function<bool()> &func, int retryCount = 10);
|
|
|
|
ExplosionClusterModifyRequest getEc(const Core::GeoPosition2D& cornerBottomLeft);
|
|
ExplosionClusterModifyRequest getAs(); //AirSupport
|
|
ExplosionAreaModifyRequest getEa();
|
|
ExplosionSingleModifyRequest getEs();
|
|
MineAreaModifyRequest getMa();
|
|
NContaminationModifyRequest getNBC();
|
|
OffRouteMineModifyRequest getORM();
|
|
BoobyTrapModifyRequest getBT();
|
|
BCContaminationModifyRequest getBCC();
|
|
FunctionalAreaModifyRequest getFA();
|
|
TechnicalAreaModifyRequest getTA();
|
|
|
|
private Q_SLOTS:
|
|
|
|
//
|
|
// TestCases
|
|
//
|
|
|
|
// void initTestCase_data(); // will be called to create a global test data table.
|
|
void initTestCase(); // will be called before the first test function is executed.
|
|
|
|
void init(); // will be called before each test function is executed.
|
|
// void cleanup(); // will be called before each test function is executed.
|
|
void cleanup();
|
|
|
|
//ExplosionArea and Single is currently not used in GÜZ
|
|
|
|
// void testExplosionAreaCentral();
|
|
// void testExplosionAreaDecentral();
|
|
// void testExplosionSingleCentral();
|
|
// void testExplosionSingleDecentral();
|
|
|
|
void testExplosionClusterCentral();
|
|
void testExplosionClusterDecentral();
|
|
void testAirSupports(); //Always central
|
|
void testMineAreaCentral();
|
|
void testMineAreaDecentral();
|
|
void testNBCCentral();
|
|
void testNBCDecentral();
|
|
void testOffRouteMines(); //Always central
|
|
void testBoobyTraps(); //Always central
|
|
void testBCCCentral();
|
|
void testBCCDecentral();
|
|
void testFADecentral();
|
|
void testFACentral();
|
|
// void testTADecentral(); //Only in AHTC
|
|
// void testTACentral();
|
|
|
|
|
|
void cleanupTestCase(); // will be called after the last test function was executed.
|
|
|
|
private:
|
|
void setupParticipant();
|
|
void setupCharges();
|
|
void deleteAesAreas();
|
|
|
|
public:
|
|
static bool m_noDelete;
|
|
|
|
private:
|
|
int m_domainId{-1};
|
|
int m_exerciseId{-1};
|
|
int m_traingAreaId{-1};
|
|
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
|
|
int s_counter{0};
|
|
|
|
std::shared_ptr<AreaEffectSimulation::Interface::Ftc> m_aesFtc;
|
|
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_aesDtc;
|
|
|
|
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
|
std::shared_ptr<ParticipantManagement::Interface::Ftc> m_ppmFtc;
|
|
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_pdmDtc;
|
|
|
|
std::shared_ptr<InfrastructureManagement::Interface::Dtc> m_ismDtc;
|
|
|
|
|
|
std::shared_ptr<ExerciseManagement::Interface::Dtc> m_exmDtc;
|
|
|
|
ExplosionCluster m_data;
|
|
long m_objectRequestedTimePointMsec{-1};
|
|
AesItemView m_aesItemViewSingleExplosions;
|
|
bool m_replyError{false};
|
|
|
|
QMap<int, QString> m_bldgIdToName;
|
|
int m_maxExplosionsCentral = 200;
|
|
int m_maxExplosionsDecentral = 50;
|
|
int m_maxMineAreasCentral = 100;
|
|
int m_maxMineAreasDecentral = 50;
|
|
int m_maxNBCCentral = 100;
|
|
int m_maxNBCDecentral = 10;
|
|
int m_maxOffRouteMines = 100;
|
|
int m_maxBoobyTraps = 150;
|
|
int m_maxSafePzAbwSafe = 10;
|
|
int m_maxFunctionalAreaCentral = 50;
|
|
int m_maxFunctionalAreaDec = 10;
|
|
int m_maxTechnicalAreaCentral = 100;
|
|
int m_maxTechnicalAreaDecentral = 10;
|
|
int m_maxAirSupports = 100;
|
|
|
|
|
|
InfrastructureManagement::SpecialArea m_specialArea;
|
|
Core::GeoPosition2D m_centralPoint;
|
|
Core::GeoPosition2D m_decentralPoint;
|
|
std::vector<Core::GeoPosition2D> m_segmentsCentral;
|
|
std::vector<Core::GeoPosition2D> m_segmentsDecentral;
|
|
Core::GeoPosition2D m_partPos;
|
|
|
|
const Core::GeoPosition2D m_centralBremen = Core::GeoPosition2D(0.154634, 0.926053);
|
|
const Core::GeoPosition2D m_centralAltmark = Core::GeoPosition2D(0.201526, 0.914231);
|
|
const Core::GeoPosition2D m_decentralBremen = Core::GeoPosition2D(0.156305, 0.92683);
|
|
const Core::GeoPosition2D m_decentralAltmark = Core::GeoPosition2D(0.202014, 0.915328);
|
|
const std::vector<Core::GeoPosition2D> m_segmentsCentralBremen = {{0.154634, 0.926053}, {0.154635, 0.926055} };
|
|
const std::vector<Core::GeoPosition2D> m_segmentsDecentralBremen = {{0.15609399, 0.92610527}, {0.15580772, 0.92628852}};
|
|
const std::vector<Core::GeoPosition2D> m_segmentsCentralAltmark = {{0.201412, 0.914215}, {0.201757, 0.914225} };
|
|
const std::vector<Core::GeoPosition2D> m_segmentsDecentralAltmark = {{0.201799, 0.914842}, {0.201965, 0.914806} };
|
|
const Core::GeoPosition2D m_partPosAltmark = Core::GeoPosition2D(0.202168, 0.914311);
|
|
const Core::GeoPosition2D m_partPosBremen = Core::GeoPosition2D(0.156482, 0.925844);
|
|
|
|
struct counterDds
|
|
{
|
|
// ExplosionCluster
|
|
int cntExplosionCluster{0};
|
|
|
|
// AesItemView
|
|
int cntAtExplosionCluster{0};
|
|
int cntAtExplosionClusterGunToTargetLine{0};
|
|
|
|
// Effects
|
|
int cntExplosionClusterEffects{0};
|
|
|
|
// Trajectory
|
|
int cntTrajectory{0};
|
|
|
|
|
|
void reset()
|
|
{
|
|
cntExplosionCluster = 0;
|
|
cntAtExplosionCluster = 0;
|
|
cntAtExplosionClusterGunToTargetLine = 0;
|
|
cntExplosionClusterEffects = 0;
|
|
cntTrajectory = 0;
|
|
}
|
|
}
|
|
m_counterDds;
|
|
|
|
LOGGER_T m_logger;
|
|
|
|
public:
|
|
void onMineAreaModifyReply(const Core::FunctionReplyObject &reply) override { Q_UNUSED(reply);}
|
|
void onExplosionAreaModifyReply(const Core::FunctionReplyObject &reply) override { Q_UNUSED(reply);}
|
|
void onExplosionClusterRemoveReply(const Core::FunctionReplyObject &reply) override { Q_UNUSED(reply);}
|
|
void onNContaminationModifyReply(const Core::FunctionReplyObject &reply) override { Q_UNUSED(reply);}
|
|
void onOffRouteMineModifyReply(const Core::FunctionReplyObject &reply) override { Q_UNUSED(reply);}
|
|
void onBoobyTrapModifyReply(const Core::FunctionReplyObject &reply) override { Q_UNUSED(reply);}
|
|
void onNContaminationRemoveReply(const Core::FunctionReplyObject &reply) override { Q_UNUSED(reply);}
|
|
void onOffRouteMineRemoveReply(const Core::FunctionReplyObject &reply) override { Q_UNUSED(reply);}
|
|
void onBoobyTrapRemoveReply(const Core::FunctionReplyObject &reply) override { Q_UNUSED(reply);}
|
|
void onMineAreaRemoveReply(const Core::FunctionReplyObject &reply) override { Q_UNUSED(reply);}
|
|
void onBCContaminationModifyReply(const Core::FunctionReplyObject &reply) override { Q_UNUSED(reply);}
|
|
void onBCContaminationRemoveReply(const Core::FunctionReplyObject &reply) override { Q_UNUSED(reply);}
|
|
|
|
// SetSimulatedPositionReplyHandler interface
|
|
void onSetSimulatedPositionReply(const Core::FunctionReplyObject &reply) override
|
|
{
|
|
m_replyError = reply.error();
|
|
DEBUG_LOG(m_logger) << " got reply - onSetSimulatedPositionReply : " << m_replyError;
|
|
if (!reply.str().empty())
|
|
ERROR_LOG(m_logger) << " got reply - onExplosionClusterModifyReply: " << reply.translated();
|
|
}
|
|
|
|
// ChargeAdministrationModifyReplyHandler interface
|
|
void onChargeAdministrationModifyReply(const Core::FunctionReplyObject &reply) override { Q_UNUSED(reply);}
|
|
|
|
void onTechnicalAreaModifyReply(const Core::FunctionReplyObject &reply) override { Q_UNUSED(reply);}
|
|
void onFunctionalAreaModifyReply(const Core::FunctionReplyObject &reply) override { Q_UNUSED(reply);}
|
|
void onTechnicalAreaRemoveReply(const Core::FunctionReplyObject &reply) override { Q_UNUSED(reply);}
|
|
void onFunctionalAreaRemoveReply(const Core::FunctionReplyObject &reply) override { Q_UNUSED(reply);}
|
|
void onExplosionSingleModifyReply(const Core::FunctionReplyObject &reply) override { Q_UNUSED(reply);}
|
|
void onExplosionAreaRemoveReply(const Core::FunctionReplyObject &reply) override { Q_UNUSED(reply);}
|
|
void onExplosionSingleRemoveReply(const Core::FunctionReplyObject &reply) override { Q_UNUSED(reply);}
|
|
};
|