245 lines
8.9 KiB
C++
Executable File
245 lines
8.9 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* ModuleTest
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <DDS/DDSConnector/dds_connector.h>
|
|
#include <LtsCommandLineParser/LtsCommandLineParser.h>
|
|
#include <LtsCoordinate/lts_coordinate.h>
|
|
|
|
#include <AreaEffectSimulation/aes_ftc.h>
|
|
#include <AreaEffectSimulation/aes_dtc.h>
|
|
#include <AreaEffectSimulation/logger.h>
|
|
|
|
#include <Plugins/Buildings/bld_data_plugin_interface.h>
|
|
#include <Plugins/InfrastructureManagement/ism_data_plugin_interface.h>
|
|
|
|
#include <Plugins/ProjectDataManagement/pdm_data_plugin_interface.h>
|
|
#include <ExerciseManagement/exm_dtc.h>
|
|
#include <ParticipantManagement/ppm_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 ModuleTestExplosionCluster : public QObject
|
|
, protected ParticipantManagement::Interface::Ftc::SetSimulatedPositionReplyHandler
|
|
, protected ParticipantManagement::Interface::Ftc::SetSimulatedParticipantFormationReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::ExplosionClusterModifyReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::ExplosionClusterOcModifyReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::ExplosionClusterSingleEffectOnlyModifyReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::ExplosionClusterPauseResumeReplyHandler
|
|
, protected AreaEffectSimulation::Interface::Ftc::TargetPositionsModifyReplyHandler
|
|
, protected Buildings::Interface::Ftc::SetBuildingStatesReplyHandler
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
ModuleTestExplosionCluster(int domainId, int exerciseId);
|
|
|
|
protected:
|
|
void onSetSimulatedPositionReply(const Core::FunctionReplyObject &replyObject) override;
|
|
void onSetSimulatedParticipantFormationReply(const Core::FunctionReplyObject &replyObject) override;
|
|
void onExplosionClusterModifyReply(const Core::FunctionReplyObject &replyObject) override;
|
|
void onExplosionClusterSingleEffectOnlyModifyReply(const Core::FunctionReplyObject &replyObject) override;
|
|
void onExplosionClusterOcModifyReply(const Core::FunctionReplyObject &replyObject) override;
|
|
void onExplosionClusterPauseResumeReply(const Core::FunctionReplyObject &replyObject) override;
|
|
void onTargetPositionsModifyReply(const Core::FunctionReplyObject &replyObject) override;
|
|
void onSetBuildingStatesReply(const Core::FunctionReplyObject &replyObject) override;
|
|
|
|
|
|
void onExplosionClusterChanged(const AreaEffectSimulation::ExplosionCluster &data, DataModification modType);
|
|
void onBuildingStateChanged(const Buildings::BuildingState &bldgState, DataModification modType);
|
|
void onAesItemViewChanged(const AreaEffectSimulation::AesItemView &aesItemView, DataModification modType);
|
|
void onEffectsChanged(const AreaEffectSimulation::Effects &effects, DataModification modType);
|
|
void onTrajectoryTimeAwareChanged(const AreaEffectSimulation::TrajectoryTimeAware &data, DataModification modType);
|
|
|
|
// pre-condition
|
|
void setupParticipants();
|
|
bool checkParticipant_5();
|
|
bool checkParticipant_6();
|
|
bool checkParticipant_89();
|
|
bool checkParticipant_99();
|
|
|
|
void resetBldgs();
|
|
int getBldgId(const QString &bldgName) const;
|
|
|
|
|
|
// helper
|
|
bool waitForData(const std::function<bool()> &func, int retryCount = 10);
|
|
|
|
ExplosionCluster getEcForTneVerification(const QString &eaName = QStringLiteral("ModuleTest_TneVerification__"), double rotation = 0);
|
|
|
|
ExplosionCluster getEcFor1104(const QString &eaName = QStringLiteral("ModuleTest_ec__"));
|
|
ExplosionCluster getEcFor1106(const QString &eaName = QStringLiteral("ModuleTest_ec__"));
|
|
ExplosionCluster getEcForUBAHN(const QString &eaName = QStringLiteral("ModuleTest_ec__"));
|
|
|
|
ExplosionCluster getEcFor3101(const QString &eaName = QStringLiteral("ModuleTest_ec__"));
|
|
|
|
|
|
int doExplosionClusterModifyRequest(const ExplosionCluster &eaData);
|
|
int doExplosionClusterSingleEffectOnlyModifyRequest(const ExplosionClusterSingleEffectOnlyRequest &request);
|
|
int doExplosionClusterOcModifyRequest(const ExplosionClusterOcModifyRequest &request);
|
|
|
|
int doExplosionClusterTargetPositionsModify(const TargetPositionsModifyRequest &request);
|
|
void waitForEffectStates(int lineNumber, int durPrep = 5, int durAct = 60, int durExp = 30);
|
|
|
|
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 after each test function is executed.
|
|
|
|
void dumpCnt();
|
|
void dumpBldgStates();
|
|
bool setFilterForBldgState(const QString &bldgName);
|
|
bool checkSingleEffects(uint idx, const LtsCoordTrans::LtsCoordinate &coord, const AreaEffectSimulation::AesZPlacement zPlace
|
|
, const QString &context, double maxDist3D = 1);
|
|
bool checkBldgStates(const QVector<int> &damagePercent, const QString &context);
|
|
bool isKanaeleAssigned();
|
|
|
|
void test_justSetupParticipants();
|
|
|
|
void test_TneVerificationBremen_00();
|
|
void test_TneVerificationBremen_01();
|
|
void test_TneVerificationBremen_02();
|
|
|
|
// !!! assume ONE elevationMap: Altmark_dt1.tif !!!
|
|
// !!! assume ONE elevationMap: Altmark_dt1.tif !!!
|
|
// !!! assume ONE elevationMap: Altmark_dt1.tif !!!
|
|
|
|
void test_bldg_1104_Proximity();
|
|
void test_bldg_1104_Impact();
|
|
void test_bldg_1104_Delay();
|
|
|
|
void test_bldg_1106_Proximity();
|
|
void test_bldg_1106_Impact();
|
|
void test_bldg_1106_Delay();
|
|
|
|
|
|
void test_bldg_UBAHN_Proximity();
|
|
void test_bldg_UBAHN_Impact();
|
|
void test_bldg_UBAHN_Delay();
|
|
|
|
void test_bldg_3101_Proximity();
|
|
void test_bldg_3101_Impact();
|
|
void test_bldg_3101_Delay();
|
|
|
|
|
|
|
|
void test_remove_effect_start();
|
|
|
|
void test_create_bulk(); // has to be call explicitly called by user
|
|
|
|
void test_point_geometry_bldg_1104();
|
|
void test_point_geometry_bldg_1104_SMArt_Proximity(); // NT, Jan 2025: since SMArt seems to be 'not implememented yet', test case fails
|
|
|
|
|
|
// ExplosionCluster 'OC' / 'ABT'
|
|
void test_bldg_1104_OC();
|
|
|
|
// ExplosionCluster 'Light' (without trajectory)
|
|
void test_point_geometry_bldg_1104_light();
|
|
void test_point_geometry_bldg_1104_single_effect_only(); // Von HLA
|
|
void test_bldg_1104_effects_only(); // Von ABT
|
|
|
|
// VULCANO
|
|
void test_vulcano_bldg_1104();
|
|
void test_vulcano_bldg_1104_withTargetModify();
|
|
void test_vulcano_bldg_1104_withTargetModify2();
|
|
|
|
|
|
// will be called after the last test function was executed:
|
|
void cleanupTestCase(); // will be called after the last test function was executed.
|
|
|
|
public:
|
|
static bool m_enable_create_bulk;
|
|
|
|
private:
|
|
int m_domainId{-1};
|
|
int m_exerciseId{-1};
|
|
int m_traingAreaId{-1};
|
|
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
|
|
|
|
std::shared_ptr<AreaEffectSimulation::Interface::Ftc> m_aesFtc;
|
|
std::shared_ptr<AreaEffectSimulation::Interface::Dtc> m_aesDtc;
|
|
|
|
std::shared_ptr<ProjectDataManagement::Interface::Dtc> m_pdmDtc;
|
|
|
|
std::shared_ptr<Buildings::Interface::Ftc> m_bldFtc;
|
|
std::shared_ptr<Buildings::Interface::Dtc> m_bldDtc;
|
|
// std::shared_ptr<InfrastructureManagement::Interface::Ftc> m_ismFtc;
|
|
std::shared_ptr<InfrastructureManagement::Interface::Dtc> m_ismDtc;
|
|
|
|
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
|
std::shared_ptr<ParticipantManagement::Interface::Ftc> m_ppmFtc;
|
|
|
|
std::shared_ptr<ExerciseManagement::Interface::Dtc> m_exmDtc;
|
|
|
|
ExplosionCluster m_data;
|
|
Effects m_effects;
|
|
long m_objectRequestedTimePointMsec{-1};
|
|
AesItemView m_aesItemViewSingleExplosions;
|
|
bool m_replyError{false};
|
|
|
|
QMap<int, QString> m_bldgIdToName;
|
|
int m_bldgIdToFilter{-1};
|
|
std::vector<Buildings::BuildingState> m_buildingStateVec;
|
|
|
|
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;
|
|
};
|