Files
qt5-legatus-legacy/Lts/Services/InfrastructureManagement/ModuleTests/ism_tests.h
T
2026-08-13 18:33:10 +02:00

130 lines
5.6 KiB
C++
Executable File

/**
* @RDE_HEADER@
* ISM Function Topic test executable
* $Id$
* $HeadURL$
* $Author$
* Created by Iuliana Ojog, SLSE, 2016-11-28
*/
#pragma once
#include <InfrastructureManagement/ism_ftc.h>
#include <InfrastructureManagement/ism_dtc.h>
#include <InfrastructureManagement/ism_ftc_types.h>
#include <InfrastructureManagement/ism_db.h>
#include <InfrastructureManagement/ism_db_impl_custom.h>
#include <InfrastructureManagement/logger.h>
#include <DDS/DDSConnector/dds_connector.h>
#include <ngldb/db_service_handler.h>
#include <ngldb/dbconnection.h>
namespace InfrastructureManagement
{
using DbHandler = NGLDB::DbServiceHandler<DatabaseInterface>;
class IsmTests : public QObject
, protected InfrastructureManagement::Interface::Ftc::InstrumentationAssetModifyReplyHandler
, protected InfrastructureManagement::Interface::Ftc::InstrumentationAssetRemoveReplyHandler
, protected InfrastructureManagement::Interface::Ftc::MountingPointAssetModifyReplyHandler
, protected InfrastructureManagement::Interface::Ftc::MountingPointAssetRemoveReplyHandler
, protected InfrastructureManagement::Interface::Ftc::MainScheduleModifyReplyHandler
, protected InfrastructureManagement::Interface::Ftc::MainScheduleRemoveReplyHandler
, protected InfrastructureManagement::Interface::Ftc::MountingPointPlanModifyReplyHandler
, protected InfrastructureManagement::Interface::Ftc::MainStructureElementModifyReplyHandler
, protected InfrastructureManagement::Interface::Ftc::MainStructureElementModifyBridgeStatusReplyHandler
, protected InfrastructureManagement::Interface::Ftc::MainStructureElementRemoveReplyHandler
, protected InfrastructureManagement::Interface::Ftc::StructureElementModifyReplyHandler
, protected InfrastructureManagement::Interface::Ftc::InstrumentationAssetSetStateReplyHandler
{
Q_OBJECT
public:
explicit IsmTests(QObject *parent = nullptr);
~IsmTests();
bool init(int domainId, int testId, int assetId, int mainStructureElementId, int structureElementId, int indexNo);
bool testsSuccessful() const { return m_bTestsSuccessful; }
public Q_SLOTS:
void startTest();
protected Q_SLOTS:
// assets
void tryCreateAsset();
void tryModifyAsset();
void tryRemoveAsset();
void tryUnmountAsset();
// main structure elements
void tryCreateMainStructureElement();
void tryModifyMainStructureElement();
void tryRemoveMainStructureElement();
void tryCreateBridge();
void tryChangeBridgeStatus();
// mounting point assets
void tryCreateMountingPointAsset();
void tryRemoveMountingPointAsset();
// mounting point schedule
void tryCreateMainSchedule();
void tryModifyMainSchedule();
void tryRemoveMainSchedule();
void tryChangeStatusSchedule();
void tryCopySchedule();
void checkSchedule();
// mounting point plan
void tryCreateMountingPointPlan();
protected:
// assets
void onInstrumentationAssetModifyReply(const Core::FunctionReplyObject &replyObject) override final { onModifyReply(replyObject); }
void onInstrumentationAssetRemoveReply(const Core::FunctionReplyObject &replyObject) override final { onRemoveReply(replyObject); }
void onInstrumentationAssetSetStateReply(const Core::FunctionReplyObject &replyObject) override final { onRemoveReply(replyObject); }
// main structure elements
void onMainStructureElementModifyReply(const Core::FunctionReplyObject &replyObject) override final { onModifyReply(replyObject); }
void onMainStructureElementRemoveReply(const Core::FunctionReplyObject &replyObject) override final { onRemoveReply(replyObject); }
void onMainStructureElementModifyBridgeStatusReply(const Core::FunctionReplyObject &replyObject) override final { onRemoveReply(replyObject); }
// structure elements
void onStructureElementModifyReply(const Core::FunctionReplyObject &replyObject) override final { onModifyReply(replyObject); }
// mounting point assets
void onMountingPointAssetModifyReply(const Core::FunctionReplyObject &replyObject) override final { onModifyReply(replyObject); }
void onMountingPointAssetRemoveReply(const Core::FunctionReplyObject &replyObject) override final { onRemoveReply(replyObject); }
// mounting point schedule
void onMainScheduleModifyReply(const Core::FunctionReplyObject &replyObject) override final { onModifyReply(replyObject); }
void onMainScheduleRemoveReply(const Core::FunctionReplyObject &replyObject) override final { onRemoveReply(replyObject); }
// mounting point plan
void onMountingPointPlanModifyReply(const Core::FunctionReplyObject &replyObject) override final { onModifyReply(replyObject); }
// general
void onError(const QString &reason);
void onCreateReply(const Core::FunctionReplyObject &replyObject);
void onModifyReply(const Core::FunctionReplyObject &replyObject);
void onRemoveReply(const Core::FunctionReplyObject &replyObject);
void failExit();
private:
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
std::shared_ptr<InfrastructureManagement::Interface::Ftc> m_ftc;
std::shared_ptr<InfrastructureManagement::Interface::Dtc> m_dtc;
std::shared_ptr<InfrastructureManagement::DatabaseInterface> m_db;
std::shared_ptr<InfrastructureManagement::DbHandler> m_dbHandler;
// given
int m_testId;
int m_assetId; // used for mounting point schedule id as well
int m_mainStructureElementId;
int m_structureElementId;
int m_indexNo;
// found per custom dtc methods
int m_mountingPointAssetId;
int m_mountingPointPlanId;
bool m_bTestsSuccessful;
bool m_replyFinished;
LOGGER_T m_logger;
};
} // namespace InfrastructureManagement