Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+192
@@ -0,0 +1,192 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* ModuleTest
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
// Aufruf: ./aesModuleTestEffectCluster -e42
|
||||
|
||||
// Mehr Debug-Ausgaben:
|
||||
// Aufruf: ./aesModuleTestEffectCluster -v2 -e42
|
||||
|
||||
#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/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 <TrainingAreaBase/tab_dts.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include <QtTest/QTest>
|
||||
|
||||
#include <memory>
|
||||
|
||||
using namespace AreaEffectSimulation; // JUST FOR LOGGER_T
|
||||
using namespace ParticipantManagement;
|
||||
|
||||
class CmdLineParser : public LtsCommandLineParser::LtsCommandLineParser
|
||||
{
|
||||
public:
|
||||
CmdLineParser()
|
||||
: LtsCommandLineParser(ProvideCommandLineParameterOptions(DomainId|ExerciseId|NoVersion))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class ModuleTestEffectCluster : public QObject
|
||||
, protected AreaEffectSimulation::Interface::Ftc::EffectClusterModifyReplyHandler
|
||||
, protected AreaEffectSimulation::Interface::Ftc::AcknowledgeExternalAesItemReplyHandler
|
||||
, protected ParticipantManagement::Interface::Ftc::ModifyPartyDataReplyHandler
|
||||
, protected ParticipantManagement::Interface::Ftc::ModifyParticipantDataReplyHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ModuleTestEffectCluster(int domainId, int exerciseId);
|
||||
|
||||
protected:
|
||||
void onEffectClusterModifyReply(const Core::FunctionReplyObject &replyObject) override;
|
||||
void onAcknowledgeExternalAesItemReply(const Core::FunctionReplyObject &replyObject) override;
|
||||
void onModifyPartyDataReply(const Core::FunctionReplyObject &replyObject) override;
|
||||
void onModifyParticipantDataReply(const Core::FunctionReplyObject &replyObject) override;
|
||||
|
||||
void onAesItemViewChanged(const AreaEffectSimulation::AesItemView &aesItemView, DataModification modType);
|
||||
void onEffectsChanged(const AreaEffectSimulation::Effects &effects, DataModification modType);
|
||||
void onChargeEffectChanged(const ChargeEffect &chargeEffect, DataModification modType);
|
||||
void onTrajectoryTimeAwareChanged(const AreaEffectSimulation::TrajectoryTimeAware &data, DataModification modType);
|
||||
|
||||
// pre-condition
|
||||
void disconnectFromParty();
|
||||
void connectToParty();
|
||||
void participantChangeRequest();
|
||||
void participantDeleteRequest();
|
||||
void setParticipantPos(int participantId);
|
||||
void setEquipmentGearCharge(int participantId);
|
||||
|
||||
|
||||
|
||||
// helper
|
||||
bool waitForData(const std::function<bool()> &func, int retryCount = 10);
|
||||
|
||||
EffectCluster getEcForTneVerification(const QString &eaName = QStringLiteral("ModuleTest_TneVerification__"), double rotation = 0);
|
||||
|
||||
|
||||
int doEffectClusterModifyRequest();
|
||||
int doExplosionClusterSingleEffectOnlyModifyRequest(const ExplosionClusterSingleEffectOnlyRequest &request);
|
||||
std::vector< Core::RelativePositionRelativeTime > parseTrajectory(const QString &filePath);
|
||||
|
||||
int sendAcknowledgeExternalAesItemRequest(int aesItemId);
|
||||
void sendTabExFire();
|
||||
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 cleanupTestCase();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
void onPartyChanged(const ParticipantManagement::Party &data, DataModification modType);
|
||||
void dumpCnt();
|
||||
|
||||
private:
|
||||
int m_domainId{-1};
|
||||
int m_exerciseId{-1};
|
||||
int m_traingAreaId{-1};
|
||||
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
|
||||
int32_t m_partyId{4};
|
||||
ParticipantManagement::ParticipantData m_participant0; // Unit
|
||||
ParticipantManagement::ParticipantData m_participant1; // Participant
|
||||
const ProjectDataManagement::L27_EffectorId m_effectorId{ProjectDataManagement::L27_EffectorId::C3};
|
||||
QString m_reference;
|
||||
const QString m_identifier{QStringLiteral("451200")};
|
||||
int m_aesItemId{-1};
|
||||
|
||||
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<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;
|
||||
|
||||
std::shared_ptr<TrainingAreaBase::Interface::Dts> m_tabDts;
|
||||
|
||||
EffectCluster m_data;
|
||||
Effects m_effects;
|
||||
long m_objectRequestedTimePointMsec{-1};
|
||||
bool m_replyError{false};
|
||||
QTimer *m_timer;
|
||||
bool m_participantChangeRequestDone{false};
|
||||
|
||||
const QVector<AreaEffectSimulation::AesEffectState> m_effectStates = {AesEffectState::EsReceived,
|
||||
AesEffectState::EsCreated,
|
||||
AesEffectState::EsActivated,
|
||||
AesEffectState::EsExpired};
|
||||
int m_effectStateCounter = 0;
|
||||
|
||||
|
||||
struct counterDds
|
||||
{
|
||||
// ExplosionCluster
|
||||
int cntEffectCluster{0};
|
||||
|
||||
// AesItemView
|
||||
int cntAtEffectCluster{0};
|
||||
int cntAtEffectClusterGunToTargetLine{0};
|
||||
|
||||
// Effects
|
||||
int cntEffectClusterEffects{0};
|
||||
|
||||
// Trajectory
|
||||
int cntTrajectory{0};
|
||||
|
||||
|
||||
void reset()
|
||||
{
|
||||
cntEffectCluster = 0;
|
||||
cntAtEffectCluster = 0;
|
||||
cntAtEffectClusterGunToTargetLine = 0;
|
||||
cntEffectClusterEffects = 0;
|
||||
cntTrajectory = 0;
|
||||
}
|
||||
}
|
||||
m_counterDds;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user