Files
qt5-legatus-legacy/Lts/Services/AreaEffectSimulation/ModuleTest_others/aes_others_module_test.h
T
2026-08-13 18:33:10 +02:00

175 lines
5.3 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/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 ModuleTestAesOthers : public QObject
, protected ParticipantManagement::Interface::Ftc::SetSimulatedPositionReplyHandler
, protected AreaEffectSimulation::Interface::Ftc::BoobyTrapModifyReplyHandler
, protected AreaEffectSimulation::Interface::Ftc::BoobyTrapRemoveReplyHandler
, protected AreaEffectSimulation::Interface::Ftc::OffRouteMineModifyReplyHandler
, protected AreaEffectSimulation::Interface::Ftc::OffRouteMineRemoveReplyHandler
{
Q_OBJECT
public:
ModuleTestAesOthers(int domainId, int exerciseId);
protected:
void onSetSimulatedPositionReply(const Core::FunctionReplyObject &replyObject) override;
void onBoobyTrapModifyReply(const Core::FunctionReplyObject &replyObject) override;
void onBoobyTrapRemoveReply(const Core::FunctionReplyObject &replyObject) override;
void onOffRouteMineModifyReply(const Core::FunctionReplyObject &replyObject) override;
void onOffRouteMineRemoveReply(const Core::FunctionReplyObject &replyObject) override;
void boobyTrapChanged(const AreaEffectSimulation::BoobyTrap &data, DataModification modType);
void offRouteMineChanged(const AreaEffectSimulation::OffRouteMine &data, DataModification modType);
void onAesItemViewChanged(const AreaEffectSimulation::AesItemView &aesItemView, DataModification modType);
// pre-condition
void setupParticipants();
bool checkParticipant_18();
bool tryRemoveOldBoobyTraps();
// helper
bool waitForData(const std::function<bool()> &func, int retryCount = 10);
void waitForEffectStatesBT(int lineNumber, int durPrep = 5, int durAct = 60, int durExp = 30);
void waitForEffectStatesORM(int lineNumber, int durPrep = 5, int durAct = 60, int durExp = 30);
int doMoveParticipant(int participantId, const QString &newPositionMGRS);
int doBoobyTrapModifyRequest(const BoobyTrap &btData);
int doOffRouteMineModifyRequest(const OffRouteMine &offRouteMine);
void test_boobyTrap_02_IMPL(const QString &name,
const LtsCoordTrans::LtsCoordinate &impactCoord,
double rotationAngle,
const LtsCoordTrans::LtsCoordinate &particpantCoord);
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 test_justSetupParticipants();
// !!! assume ONE elevationMap: Altmark_dt1.tif !!!
// !!! assume ONE elevationMap: Altmark_dt1.tif !!!
// !!! assume ONE elevationMap: Altmark_dt1.tif !!!
// boobyTrap: VLad1, VLad2
void test_boobyTrap_01();
void test_boobyTrap_02_Q1();
void test_boobyTrap_02_Q2();
void test_boobyTrap_02_Q3();
void test_boobyTrap_02_Q4();
// offRoute: SchAbwMi, SchAbwRiMi
// // void test_offRouteMine_01(); // not implemeneted yet
void test_offRouteMine_02();
// 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<ParticipantManagement::Interface::Dtc> m_ppmDtc;
std::shared_ptr<ParticipantManagement::Interface::Ftc> m_ppmFtc;
std::shared_ptr<ExerciseManagement::Interface::Dtc> m_exmDtc;
BoobyTrap m_dataBoobyTrap;
OffRouteMine m_dataOffRouteMine;
bool m_replyError{false};
struct counterDds
{
// AesItem
int cntBoobyTrap{0};
int cntOffRouteMine{0};
// AesItemView
int cntItemView{0};
void reset()
{
cntBoobyTrap = 0;
cntOffRouteMine = 0;
cntItemView = 0;
}
}
m_counterDds;
LOGGER_T m_logger;
};