Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
+64
-64
@@ -50,7 +50,7 @@ ExmTests::~ExmTests()
|
||||
//--------------------------------------------------------------------------
|
||||
bool ExmTests::init(int domainId, int exerciseId, int testId, int trainingAreaId, int phaseId)
|
||||
{
|
||||
INFO_LOG() << "init begin";
|
||||
INFO_LOG(m_logger) << "init begin";
|
||||
|
||||
m_testId = testId;
|
||||
m_exerciseId = exerciseId; // overwritten when new exercise created
|
||||
@@ -64,32 +64,32 @@ bool ExmTests::init(int domainId, int exerciseId, int testId, int trainingAreaId
|
||||
return false;
|
||||
m_ddsConnector->initPublisherSubscriber();
|
||||
|
||||
DEBUG_LOG() << "Create dtc EXM";
|
||||
DEBUG_LOG(m_logger) << "Create dtc EXM";
|
||||
m_dtc = ExerciseManagement::Interface::Dtc::create(m_ddsConnector);
|
||||
DEBUG_LOG() << "Init dtc";
|
||||
DEBUG_LOG(m_logger) << "Init dtc";
|
||||
bool bRet = m_dtc->enableAll();
|
||||
DEBUG_LOG() << "init DTC EXM end - bRet = " << bRet;
|
||||
DEBUG_LOG(m_logger) << "init DTC EXM end - bRet = " << bRet;
|
||||
|
||||
connect(m_dtc.get(), &ExerciseManagement::Interface::Dtc::exerciseChanged,
|
||||
this, &ExmTests::onExerciseChanged);
|
||||
|
||||
DEBUG_LOG() << "create ftc EXM";
|
||||
DEBUG_LOG(m_logger) << "create ftc EXM";
|
||||
m_ftc = ExerciseManagement::Interface::Ftc::create(m_ddsConnector);
|
||||
DEBUG_LOG() << "init ftc EXM";
|
||||
DEBUG_LOG(m_logger) << "init ftc EXM";
|
||||
bRet &= m_ftc->enableAll();
|
||||
DEBUG_LOG() << "init FTC EXM end - bRet = " << bRet;
|
||||
DEBUG_LOG(m_logger) << "init FTC EXM end - bRet = " << bRet;
|
||||
|
||||
DEBUG_LOG() << "create ftc ASM";
|
||||
DEBUG_LOG(m_logger) << "create ftc ASM";
|
||||
m_ftc_asm = AssetManagement::Interface::Ftc::create(m_ddsConnector);
|
||||
DEBUG_LOG() << "init ftc ASM";
|
||||
DEBUG_LOG(m_logger) << "init ftc ASM";
|
||||
bRet &= m_ftc_asm->enableAll();
|
||||
DEBUG_LOG() << "init end EXM - bRet = " << bRet;
|
||||
DEBUG_LOG(m_logger) << "init end EXM - bRet = " << bRet;
|
||||
|
||||
DEBUG_LOG() << "Domain Id = " << domainId;
|
||||
DEBUG_LOG() << "Exercise Id = " << exerciseId;
|
||||
DEBUG_LOG() << "Test Id = " << testId;
|
||||
DEBUG_LOG() << "Training Area Id = " << trainingAreaId;
|
||||
DEBUG_LOG() << "Phase Id = " << phaseId;
|
||||
DEBUG_LOG(m_logger) << "Domain Id = " << domainId;
|
||||
DEBUG_LOG(m_logger) << "Exercise Id = " << exerciseId;
|
||||
DEBUG_LOG(m_logger) << "Test Id = " << testId;
|
||||
DEBUG_LOG(m_logger) << "Training Area Id = " << trainingAreaId;
|
||||
DEBUG_LOG(m_logger) << "Phase Id = " << phaseId;
|
||||
|
||||
//TODO: add connects
|
||||
|
||||
@@ -99,7 +99,7 @@ bool ExmTests::init(int domainId, int exerciseId, int testId, int trainingAreaId
|
||||
//--------------------------------------------------------------------------
|
||||
void ExmTests::startTest()
|
||||
{
|
||||
INFO_LOG() << "startTest";
|
||||
INFO_LOG(m_logger) << "startTest";
|
||||
if (m_testId <= 1)
|
||||
QTimer::singleShot(0, this, &ExmTests::tryCreate);
|
||||
else if (m_testId == 2)
|
||||
@@ -125,7 +125,7 @@ void ExmTests::startTest()
|
||||
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
||||
else
|
||||
{
|
||||
ERROR_LOG() << "Unknown test id: " << m_testId;
|
||||
ERROR_LOG(m_logger) << "Unknown test id: " << m_testId;
|
||||
failExit();
|
||||
}
|
||||
}
|
||||
@@ -133,7 +133,7 @@ void ExmTests::startTest()
|
||||
//--------------------------------------------------------------------------
|
||||
void ExmTests::tryCreateTrainingArea()
|
||||
{
|
||||
INFO_LOG() << "trying to send modifyRequest TrainingArea (create)";
|
||||
INFO_LOG(m_logger) << "trying to send modifyRequest TrainingArea (create)";
|
||||
AssetManagement::TrainingAreaModifyRequest request;
|
||||
request.id(0);
|
||||
request.name("TestTrainingAreaCreate");
|
||||
@@ -144,10 +144,10 @@ void ExmTests::tryCreateTrainingArea()
|
||||
if (!m_ftc_asm->trainingAreaModifyRequest(request, this))
|
||||
|
||||
{
|
||||
ERROR_LOG() << "Error requesting create data";
|
||||
ERROR_LOG(m_logger) << "Error requesting create data";
|
||||
failExit();
|
||||
}
|
||||
INFO_LOG() << "Training Area Id = " << m_trainingAreaId;
|
||||
INFO_LOG(m_logger) << "Training Area Id = " << m_trainingAreaId;
|
||||
|
||||
QTest::qWait(1000);
|
||||
}
|
||||
@@ -155,10 +155,10 @@ void ExmTests::tryCreateTrainingArea()
|
||||
//--------------------------------------------------------------------------
|
||||
void ExmTests::tryCreateExercisePhase()
|
||||
{
|
||||
INFO_LOG() << "trying to send createrequest Exercise Phase";
|
||||
INFO_LOG(m_logger) << "trying to send createrequest Exercise Phase";
|
||||
if(!m_ftc->exercisePhaseCreateRequest(ExercisePhaseCreateRequest(std::string("Test Phase"), std::string("Test Phase description"), 10, 20, m_exerciseId), this))
|
||||
{
|
||||
ERROR_LOG() << "Error requesting create Exercise Phase";
|
||||
ERROR_LOG(m_logger) << "Error requesting create Exercise Phase";
|
||||
failExit();
|
||||
}
|
||||
QTest::qWait(1000);
|
||||
@@ -171,9 +171,9 @@ void ExmTests::tryCreate()
|
||||
int symbolFillType = 1;
|
||||
int radioGroupId = 1;
|
||||
|
||||
INFO_LOG() << "Training Area Id = " << m_trainingAreaId;
|
||||
INFO_LOG(m_logger) << "Training Area Id = " << m_trainingAreaId;
|
||||
|
||||
INFO_LOG() << "trying to send createRequest Exercise";
|
||||
INFO_LOG(m_logger) << "trying to send createRequest Exercise";
|
||||
ExerciseCreateRequest req;
|
||||
req.name(std::string("TestExerciseCreate"));
|
||||
req.beginTime(10);
|
||||
@@ -186,7 +186,7 @@ void ExmTests::tryCreate()
|
||||
|
||||
if (!m_ftc->exerciseCreateRequest(req, this))
|
||||
{
|
||||
ERROR_LOG() << "Error requesting create data";
|
||||
ERROR_LOG(m_logger) << "Error requesting create data";
|
||||
failExit();
|
||||
}
|
||||
QTest::qWait(10000);
|
||||
@@ -195,7 +195,7 @@ void ExmTests::tryCreate()
|
||||
//--------------------------------------------------------------------------
|
||||
void ExmTests::tryModify()
|
||||
{
|
||||
INFO_LOG() << "trying to send modify request for exercise Id = " << m_exerciseId;
|
||||
INFO_LOG(m_logger) << "trying to send modify request for exercise Id = " << m_exerciseId;
|
||||
ExerciseModifyRequest req;
|
||||
req.id(m_exerciseId);
|
||||
req.name(std::string("ExerciseModifyTest"));
|
||||
@@ -210,7 +210,7 @@ void ExmTests::tryModify()
|
||||
req.newState(ExerciseState::Created);
|
||||
if (!m_ftc->exerciseModifyRequest(req, this))
|
||||
{
|
||||
ERROR_LOG() << "Error requesting modify data";
|
||||
ERROR_LOG(m_logger) << "Error requesting modify data";
|
||||
failExit();
|
||||
}
|
||||
QTest::qWait(1000);
|
||||
@@ -219,10 +219,10 @@ void ExmTests::tryModify()
|
||||
//--------------------------------------------------------------------------
|
||||
void ExmTests::tryModifyExercisePhase()
|
||||
{
|
||||
INFO_LOG() << "trying to send modify exercise phase request for exercise phase Id = " << m_phaseId;
|
||||
INFO_LOG(m_logger) << "trying to send modify exercise phase request for exercise phase Id = " << m_phaseId;
|
||||
if (!m_ftc->exercisePhaseModifyRequest(ExercisePhaseModifyRequest(std::string("Modified Exercise Phase"), std::string("Exercise Phase has been modified"), 20, 30, m_exerciseId, m_phaseId), this))
|
||||
{
|
||||
ERROR_LOG() << "Error requesting modify exercise phase";
|
||||
ERROR_LOG(m_logger) << "Error requesting modify exercise phase";
|
||||
failExit();
|
||||
}
|
||||
QTest::qWait(1000);
|
||||
@@ -231,10 +231,10 @@ void ExmTests::tryModifyExercisePhase()
|
||||
//--------------------------------------------------------------------------
|
||||
void ExmTests::tryDelete()
|
||||
{
|
||||
INFO_LOG() << "trying to send delete request for exercise Id = " << m_exerciseId;
|
||||
INFO_LOG(m_logger) << "trying to send delete request for exercise Id = " << m_exerciseId;
|
||||
if (!m_ftc->exerciseRemoveRequest(ExerciseRemoveRequest(m_exerciseId, false), this))
|
||||
{
|
||||
ERROR_LOG() << "Error requesting delete data";
|
||||
ERROR_LOG(m_logger) << "Error requesting delete data";
|
||||
failExit();
|
||||
}
|
||||
QTest::qWait(5000);
|
||||
@@ -245,15 +245,15 @@ void ExmTests::tryDeleteExercisePhase()
|
||||
{
|
||||
if (m_phaseId == 0)
|
||||
{
|
||||
ERROR_LOG() << "No phase available for deleting";
|
||||
ERROR_LOG(m_logger) << "No phase available for deleting";
|
||||
failExit();
|
||||
}
|
||||
|
||||
INFO_LOG() << "trying to send delete request for exercise phase Id = " << m_phaseId;
|
||||
INFO_LOG(m_logger) << "trying to send delete request for exercise phase Id = " << m_phaseId;
|
||||
m_ftc->enableExercisePhaseRemove();
|
||||
if (!m_ftc->exercisePhaseRemoveRequest(ExercisePhaseRemoveRequest(m_phaseId), this))
|
||||
{
|
||||
ERROR_LOG() << "Error requesting delete exercise phase";
|
||||
ERROR_LOG(m_logger) << "Error requesting delete exercise phase";
|
||||
failExit();
|
||||
}
|
||||
QTest::qWait(1000);
|
||||
@@ -262,12 +262,12 @@ void ExmTests::tryDeleteExercisePhase()
|
||||
//--------------------------------------------------------------------------
|
||||
void ExmTests::tryStartExercise()
|
||||
{
|
||||
INFO_LOG() << "trying to start exercise Id = " << m_exerciseId;
|
||||
INFO_LOG(m_logger) << "trying to start exercise Id = " << m_exerciseId;
|
||||
|
||||
m_dtc->waitForHistoricalDataExercise();
|
||||
ExerciseManagement::Exercise ex = m_dtc->exercise(m_exerciseId);
|
||||
|
||||
DEBUG_LOG() << "Training area id = " << ex.trainingAreaId();
|
||||
DEBUG_LOG(m_logger) << "Training area id = " << ex.trainingAreaId();
|
||||
|
||||
ExerciseModifyRequest req;
|
||||
req.id(m_exerciseId);
|
||||
@@ -283,7 +283,7 @@ void ExmTests::tryStartExercise()
|
||||
req.newState(ExerciseState::Started);
|
||||
if (!m_ftc->exerciseModifyRequest(req, this))
|
||||
{
|
||||
ERROR_LOG() << "Error requesting modify data";
|
||||
ERROR_LOG(m_logger) << "Error requesting modify data";
|
||||
failExit();
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ void ExmTests::tryStartExercise()
|
||||
|
||||
// if (!m_ftc->exerciseChangeStateRequest(req, this))
|
||||
// {
|
||||
// ERROR_LOG() << "Error requesting change state";
|
||||
// ERROR_LOG(m_logger) << "Error requesting change state";
|
||||
// failExit();
|
||||
// }
|
||||
|
||||
@@ -304,19 +304,19 @@ void ExmTests::tryStartExercise()
|
||||
//-------------------------------------------------------------------------------
|
||||
void ExmTests::tryGetAllExercises()
|
||||
{
|
||||
INFO_LOG() << "trying to get all exercises";
|
||||
INFO_LOG(m_logger) << "trying to get all exercises";
|
||||
m_dtc->waitForHistoricalDataExercise();
|
||||
|
||||
bool bAtLeastOneFound = false;
|
||||
auto cb = [this, &bAtLeastOneFound](const ExerciseManagement::Exercise &ex)
|
||||
{
|
||||
INFO_LOG() << "Exe(" << ex.id() << ") : " << ex.name();
|
||||
INFO_LOG(m_logger) << "Exe(" << ex.id() << ") : " << ex.name();
|
||||
bAtLeastOneFound = true;
|
||||
};
|
||||
m_dtc->exercises(cb);
|
||||
if (!bAtLeastOneFound)
|
||||
{
|
||||
ERROR_LOG() << "Error receiving data for exercises";
|
||||
ERROR_LOG(m_logger) << "Error receiving data for exercises";
|
||||
failExit();
|
||||
}
|
||||
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
||||
@@ -325,19 +325,19 @@ void ExmTests::tryGetAllExercises()
|
||||
//-------------------------------------------------------------------------------
|
||||
void ExmTests::tryGetExercise()
|
||||
{
|
||||
INFO_LOG() << "trying get itemData for exercise " << m_exerciseId;
|
||||
INFO_LOG(m_logger) << "trying get itemData for exercise " << m_exerciseId;
|
||||
m_dtc->waitForHistoricalDataExercise();
|
||||
ExerciseManagement::Exercise data = m_dtc->exercise(m_exerciseId);
|
||||
|
||||
if (data.id() <= 0)
|
||||
{
|
||||
ERROR_LOG() << "Error receiving data for exercise " << m_exerciseId;
|
||||
DEBUG_LOG() << "data.id() = " << data.id();
|
||||
ERROR_LOG(m_logger) << "Error receiving data for exercise " << m_exerciseId;
|
||||
DEBUG_LOG(m_logger) << "data.id() = " << data.id();
|
||||
failExit();
|
||||
}
|
||||
else
|
||||
{
|
||||
INFO_LOG() << "## Exe(" << data.id() << ") : name = " << data.name()
|
||||
INFO_LOG(m_logger) << "## Exe(" << data.id() << ") : name = " << data.name()
|
||||
<< ", begin = " << data.beginTime() << ", end = " << data.endTime()
|
||||
<< ", state = " << data.state();
|
||||
}
|
||||
@@ -349,10 +349,10 @@ void ExmTests::onExerciseChanged(const ExerciseManagement::Exercise &data,
|
||||
DataModification modType)
|
||||
{
|
||||
const int id = data.id();
|
||||
DEBUG_LOG() << "onExerciseChanged for exercise " << id
|
||||
DEBUG_LOG(m_logger) << "onExerciseChanged for exercise " << id
|
||||
<< " - modType: " << (int)modType;
|
||||
if (m_exerciseId == id)
|
||||
INFO_LOG() << "##################### Data for id = " << id << " received";
|
||||
INFO_LOG(m_logger) << "##################### Data for id = " << id << " received";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -360,11 +360,11 @@ void ExmTests::onExerciseCreateReply(const Core::FunctionReplyObject &replyObjec
|
||||
{
|
||||
if (replyObject.error())
|
||||
{
|
||||
ERROR_LOG() << "Got onExerciseCreateReply error: " << replyObject();
|
||||
ERROR_LOG(m_logger) << "Got onExerciseCreateReply error: " << replyObject();
|
||||
failExit();
|
||||
return;
|
||||
}
|
||||
INFO_LOG() << "Got createReply with id " << replyObject.id()
|
||||
INFO_LOG(m_logger) << "Got createReply with id " << replyObject.id()
|
||||
<< " and errorString " << replyObject.translated();
|
||||
m_exerciseId = replyObject.id();
|
||||
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
||||
@@ -375,11 +375,11 @@ void ExmTests::onExerciseModifyReply(const Core::FunctionReplyObject &replyObjec
|
||||
{
|
||||
if (replyObject.error())
|
||||
{
|
||||
ERROR_LOG() << "Got onExerciseModifyReply error: " << replyObject();
|
||||
ERROR_LOG(m_logger) << "Got onExerciseModifyReply error: " << replyObject();
|
||||
failExit();
|
||||
return;
|
||||
}
|
||||
INFO_LOG() << "Got modifyRequest with id " << replyObject.id()
|
||||
INFO_LOG(m_logger) << "Got modifyRequest with id " << replyObject.id()
|
||||
<< " and errorString " << replyObject.translated();
|
||||
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
||||
}
|
||||
@@ -389,11 +389,11 @@ void ExmTests::onExerciseModifyReply(const Core::FunctionReplyObject &replyObjec
|
||||
//{
|
||||
// if (replyObject.error())
|
||||
// {
|
||||
// ERROR_LOG() << "Got onExerciseChangeStateReply error: " << replyObject();
|
||||
// ERROR_LOG(m_logger) << "Got onExerciseChangeStateReply error: " << replyObject();
|
||||
// failExit();
|
||||
// return;
|
||||
// }
|
||||
// INFO_LOG() << "Got changeStateRequest with id " << replyObject.id()
|
||||
// INFO_LOG(m_logger) << "Got changeStateRequest with id " << replyObject.id()
|
||||
// << " and errorString " << replyObject.translated();
|
||||
// QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
||||
//}
|
||||
@@ -403,11 +403,11 @@ void ExmTests::onExerciseRemoveReply(const Core::FunctionReplyObject &replyObjec
|
||||
{
|
||||
if (replyObject.error())
|
||||
{
|
||||
ERROR_LOG() << "Got onExerciseRemoveReply error: " << replyObject();
|
||||
ERROR_LOG(m_logger) << "Got onExerciseRemoveReply error: " << replyObject();
|
||||
failExit();
|
||||
return;
|
||||
}
|
||||
INFO_LOG() << "Got removeReply with id " << replyObject.id()
|
||||
INFO_LOG(m_logger) << "Got removeReply with id " << replyObject.id()
|
||||
<< " and errorString " << replyObject.translated();
|
||||
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
||||
}
|
||||
@@ -417,11 +417,11 @@ void ExmTests::onExercisePhaseCreateReply(const Core::FunctionReplyObject &reply
|
||||
{
|
||||
if (replyObject.error())
|
||||
{
|
||||
ERROR_LOG() << "Got onExercisePhaseCreateReply error: " << replyObject();
|
||||
ERROR_LOG(m_logger) << "Got onExercisePhaseCreateReply error: " << replyObject();
|
||||
failExit();
|
||||
return;
|
||||
}
|
||||
INFO_LOG() << "Got createExercisePhaseReply with id " << replyObject.id()
|
||||
INFO_LOG(m_logger) << "Got createExercisePhaseReply with id " << replyObject.id()
|
||||
<< " and errorString " << replyObject.translated();
|
||||
|
||||
m_phaseId = replyObject.id();
|
||||
@@ -433,11 +433,11 @@ void ExmTests::onExercisePhaseModifyReply(const Core::FunctionReplyObject &reply
|
||||
{
|
||||
if (replyObject.error())
|
||||
{
|
||||
ERROR_LOG() << "Got onExercisePhaseModifyReply error: " << replyObject();
|
||||
ERROR_LOG(m_logger) << "Got onExercisePhaseModifyReply error: " << replyObject();
|
||||
failExit();
|
||||
return;
|
||||
}
|
||||
INFO_LOG() << "Got modifyExercisePhaseReply with id " << replyObject.id()
|
||||
INFO_LOG(m_logger) << "Got modifyExercisePhaseReply with id " << replyObject.id()
|
||||
<< " and errorString " << replyObject.translated();
|
||||
|
||||
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
||||
@@ -448,11 +448,11 @@ void ExmTests::onExercisePhaseRemoveReply(const Core::FunctionReplyObject &reply
|
||||
{
|
||||
if (replyObject.error())
|
||||
{
|
||||
ERROR_LOG() << "Got onExercisePhaseRemoveReply error: " << replyObject();
|
||||
ERROR_LOG(m_logger) << "Got onExercisePhaseRemoveReply error: " << replyObject();
|
||||
failExit();
|
||||
return;
|
||||
}
|
||||
INFO_LOG() << "Got removeExercisePhaseReply with id " << replyObject.id()
|
||||
INFO_LOG(m_logger) << "Got removeExercisePhaseReply with id " << replyObject.id()
|
||||
<< " and errorString " << replyObject.translated();
|
||||
|
||||
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
||||
@@ -463,11 +463,11 @@ void ExmTests::onTrainingAreaModifyReply(const Core::FunctionReplyObject &replyO
|
||||
{
|
||||
if (replyObject.error())
|
||||
{
|
||||
ERROR_LOG() << "Got onTrainingAreaModifyReply error: " << replyObject();
|
||||
ERROR_LOG(m_logger) << "Got onTrainingAreaModifyReply error: " << replyObject();
|
||||
failExit();
|
||||
return;
|
||||
}
|
||||
INFO_LOG() << "Got createReply with id " << replyObject.id()
|
||||
INFO_LOG(m_logger) << "Got createReply with id " << replyObject.id()
|
||||
<< " and errorString " << replyObject.translated();
|
||||
m_trainingAreaId = replyObject.id();
|
||||
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
||||
@@ -476,7 +476,7 @@ void ExmTests::onTrainingAreaModifyReply(const Core::FunctionReplyObject &replyO
|
||||
// ------------------------------------------------------------------------------
|
||||
void ExmTests::failExit()
|
||||
{
|
||||
ERROR_LOG() << "FAIL EXIT !";
|
||||
ERROR_LOG(m_logger) << "FAIL EXIT !";
|
||||
m_bTestsSuccessful = false;
|
||||
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
||||
}
|
||||
|
||||
+14
-15
@@ -22,8 +22,7 @@
|
||||
|
||||
|
||||
|
||||
DataTopicTests::DataTopicTests()
|
||||
: m_domainParticipantPub(nullptr)
|
||||
DataTopicTests::DataTopicTests() : m_domainParticipantPub(nullptr)
|
||||
, m_domainParticipantSub(nullptr)
|
||||
, m_domainId(0)
|
||||
, m_ddsPublisher(nullptr)
|
||||
@@ -33,12 +32,12 @@ DataTopicTests::DataTopicTests()
|
||||
, m_subscriberListenerBinder(nullptr)
|
||||
, m_dtcExercise(nullptr)
|
||||
, m_mainThreadId(QThread::currentThreadId())
|
||||
.getNGLLogger("UnitTests.DataTopicTests"))
|
||||
{
|
||||
.getNGLLogger("UnitTests.DataTopicTests")),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
if (!DDS::QosProfile::setDefault())
|
||||
ERROR_LOG() << "Error setting default QoS from xml-file ";
|
||||
ERROR_LOG(m_logger) << "Error setting default QoS from xml-file ";
|
||||
|
||||
DEBUG_LOG() << "Main thread ID is " << m_mainThreadId;
|
||||
DEBUG_LOG(m_logger) << "Main thread ID is " << m_mainThreadId;
|
||||
}
|
||||
|
||||
DataTopicTests::~DataTopicTests()
|
||||
@@ -79,7 +78,7 @@ bool DataTopicTests::initPublisher()
|
||||
partitionQos.name( { partition } );
|
||||
publisherQos << partitionQos;
|
||||
|
||||
DEBUG_LOG() << "Publish on partition " << partition;
|
||||
DEBUG_LOG(m_logger) << "Publish on partition " << partition;
|
||||
|
||||
m_ddsPublisher = dds::pub::Publisher(m_domainParticipantPub, publisherQos);
|
||||
|
||||
@@ -91,8 +90,8 @@ bool DataTopicTests::initPublisher()
|
||||
|
||||
bool DataTopicTests::write(const ExerciseManagement::Exercise &data)
|
||||
{
|
||||
INFO_LOG() << "Publish topic Exercise ";
|
||||
DEBUG_LOG() << "ExeId: " << data.id() << ", state: " << data.state()
|
||||
INFO_LOG(m_logger) << "Publish topic Exercise ";
|
||||
DEBUG_LOG(m_logger) << "ExeId: " << data.id() << ", state: " << data.state()
|
||||
<< ", partitionName: " << data.partitionName();
|
||||
|
||||
return m_dtsExercise->write(data);
|
||||
@@ -105,7 +104,7 @@ bool DataTopicTests::write(const ExerciseManagement::Exercise &data)
|
||||
|
||||
bool DataTopicTests::initSubscriber()
|
||||
{
|
||||
DEBUG_LOG() << "Initialisation DDS (Subscriber/Reader)";
|
||||
DEBUG_LOG(m_logger) << "Initialisation DDS (Subscriber/Reader)";
|
||||
|
||||
m_domainParticipantSub =
|
||||
dds::domain::DomainParticipant(m_domainId,
|
||||
@@ -126,7 +125,7 @@ bool DataTopicTests::initSubscriber()
|
||||
partitionQos.name( partitions );
|
||||
subscriberQos << partitionQos;
|
||||
|
||||
DEBUG_LOG() << "Initialise DTC::SubscriberListener";
|
||||
DEBUG_LOG(m_logger) << "Initialise DTC::SubscriberListener";
|
||||
m_subscriberListener = new DDSGeneric::SubscriberListener();
|
||||
|
||||
m_ddsSubscriber = dds::sub::Subscriber(m_domainParticipantSub,
|
||||
@@ -145,11 +144,11 @@ bool DataTopicTests::initSubscriber()
|
||||
void DataTopicTests::processData(const ExerciseManagement::Exercise &instance, DataModification modType)
|
||||
{
|
||||
Q_UNUSED(modType);
|
||||
INFO_LOG() << "process Lts_Exercise";
|
||||
INFO_LOG(m_logger) << "process Lts_Exercise";
|
||||
|
||||
DEBUG_LOG() << "exerciseId: " << instance.id();
|
||||
DEBUG_LOG() << "name: " << instance.name();
|
||||
DEBUG_LOG() << "state: " << instance.state();
|
||||
DEBUG_LOG(m_logger) << "exerciseId: " << instance.id();
|
||||
DEBUG_LOG(m_logger) << "name: " << instance.name();
|
||||
DEBUG_LOG(m_logger) << "state: " << instance.state();
|
||||
|
||||
m_receivedExerciseData = instance;
|
||||
|
||||
|
||||
+1
@@ -42,6 +42,7 @@ public:
|
||||
ExerciseManagement::Exercise getReceivedExerciseData() const { return m_receivedExerciseData; }
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
// Subscriber Methods
|
||||
void processData(const ExerciseManagement::Exercise& instance, DataModification modType);
|
||||
|
||||
|
||||
+4
-4
@@ -40,7 +40,7 @@ DataTopicTestsMain::DataTopicTestsMain()
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
void DataTopicTestsMain::initTestCase()
|
||||
{
|
||||
DEBUG_LOG() <<"DataTopicTestsMain: initTestCase";
|
||||
DEBUG_LOG(m_logger) <<"DataTopicTestsMain: initTestCase";
|
||||
|
||||
m_dtTest = new DataTopicTests();
|
||||
QVERIFY2(m_dtTest, "Initialisation of DataTopicTest failed");
|
||||
@@ -53,7 +53,7 @@ void DataTopicTestsMain::initTestCase()
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
void DataTopicTestsMain::publishTestCase()
|
||||
{
|
||||
DEBUG_LOG() <<"DataTopicTestsMain: publish data";
|
||||
DEBUG_LOG(m_logger) <<"DataTopicTestsMain: publish data";
|
||||
|
||||
// Topic Exercise
|
||||
m_sentExerciseData.id(222);
|
||||
@@ -68,7 +68,7 @@ void DataTopicTestsMain::publishTestCase()
|
||||
|
||||
void DataTopicTestsMain::subscribeTestCase()
|
||||
{
|
||||
DEBUG_LOG() << "IN subscribeTestCase";
|
||||
DEBUG_LOG(m_logger) << "IN subscribeTestCase";
|
||||
QTRY_COMPARE(m_exerciseDataArrivedSpy->count(), 1);
|
||||
|
||||
ExerciseManagement::Exercise recvExercise = m_dtTest->getReceivedExerciseData();
|
||||
@@ -82,7 +82,7 @@ void DataTopicTestsMain::subscribeTestCase()
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
void DataTopicTestsMain::cleanupTestCase()
|
||||
{
|
||||
DEBUG_LOG() <<"DataTopicTestsMain: cleanupTestCase";
|
||||
DEBUG_LOG(m_logger) <<"DataTopicTestsMain: cleanupTestCase";
|
||||
delete m_dtTest; m_dtTest = nullptr;
|
||||
delete m_exerciseDataArrivedSpy; m_exerciseDataArrivedSpy = nullptr;
|
||||
}
|
||||
|
||||
+1
@@ -35,6 +35,7 @@ private Q_SLOTS:
|
||||
|
||||
protected:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
private:
|
||||
ExerciseManagement::Exercise m_sentExerciseData;
|
||||
QSignalSpy *m_exerciseDataArrivedSpy = nullptr;
|
||||
|
||||
+6
-8
@@ -14,22 +14,20 @@
|
||||
#include <Lts/Common/ProjectConfig/project_defines.h>
|
||||
|
||||
|
||||
Initialisation::Initialisation()
|
||||
: m_domainParticipant(nullptr)
|
||||
Initialisation::Initialisation() : m_domainParticipant(nullptr)
|
||||
, m_domainParticipantSub(nullptr)
|
||||
, m_domainId(0)
|
||||
, m_partitionId(-1)
|
||||
, m_ddsPublisher(nullptr)
|
||||
, m_ddsSubscriber(nullptr)
|
||||
, m_subListener(new DTC::SubscriberListener)
|
||||
.getNGLLogger("UnitTests.Initialisation"))
|
||||
|
||||
{
|
||||
.getNGLLogger("UnitTests.Initialisation")),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
DDS::DefaultQos defaultQos;
|
||||
|
||||
//if (!defaultQos.setDefaultQos(QStringList("/shd/CTC/SV/.default_dds_profile.xml")))
|
||||
if (!defaultQos.setDefaultQos())
|
||||
ERROR_LOG() << "Error setting default QoS from xml-file ";
|
||||
ERROR_LOG(m_logger) << "Error setting default QoS from xml-file ";
|
||||
|
||||
}
|
||||
|
||||
@@ -62,7 +60,7 @@ bool Initialisation::initDDS(int domainId, int partitionId, PubSub pubsub)
|
||||
{
|
||||
dds::pub::qos::PublisherQos publisherQos = m_domainParticipant.default_publisher_qos();
|
||||
|
||||
DEBUG_LOG() << "Publish on partition " << IDL::getPartitionString(partitionId);
|
||||
DEBUG_LOG(m_logger) << "Publish on partition " << IDL::getPartitionString(partitionId);
|
||||
|
||||
// use only selected partition
|
||||
dds::core::policy::Partition partitionQos;
|
||||
@@ -84,7 +82,7 @@ bool Initialisation::initDDS(int domainId, int partitionId, PubSub pubsub)
|
||||
|
||||
dds::sub::qos::SubscriberQos subscriberQos = domainPart.default_subscriber_qos();
|
||||
|
||||
DEBUG_LOG() << "Subsribing on partition " << IDL::getPartitionString(partitionId);
|
||||
DEBUG_LOG(m_logger) << "Subsribing on partition " << IDL::getPartitionString(partitionId);
|
||||
|
||||
// use only selected partition
|
||||
dds::core::policy::Partition partitionQos;
|
||||
|
||||
+1
@@ -38,6 +38,7 @@ public:
|
||||
DTC::SubscriberListener *getSubscriberListener() { return m_subListener; }
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
dds::domain::DomainParticipant m_domainParticipant;
|
||||
dds::domain::DomainParticipant m_domainParticipantSub;
|
||||
int m_domainId;
|
||||
|
||||
+5
-5
@@ -36,7 +36,7 @@ bool WebSocketInterfaceHandler::init()
|
||||
{
|
||||
cleanup();
|
||||
|
||||
DEBUG_LOG() << "... ok";
|
||||
DEBUG_LOG(m_logger) << "... ok";
|
||||
|
||||
m_dataManager = new DataManager(m_mainHandler->db(), m_mainHandler->exerciseHandler());
|
||||
|
||||
@@ -44,15 +44,15 @@ bool WebSocketInterfaceHandler::init()
|
||||
|
||||
m_webSocketServer = new LtsWebSocket::LtsWebSocketServer(m_messageFactory, this);
|
||||
|
||||
DEBUG_LOG() << "Initialising LtsWebSocketServer";
|
||||
DEBUG_LOG(m_logger) << "Initialising LtsWebSocketServer";
|
||||
if (!m_webSocketServer->init(QStringLiteral("EXM"), Settings::getWebSocketServerPortRange(1)))
|
||||
{
|
||||
ERROR_LOG() << "Failed to initialise LtsWebSocketServer";
|
||||
ERROR_LOG(m_logger) << "Failed to initialise LtsWebSocketServer";
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG() << "... ok";
|
||||
DEBUG_LOG(m_logger) << "... ok";
|
||||
|
||||
DEBUG_LOG() << "Connection signals and slots";
|
||||
DEBUG_LOG(m_logger) << "Connection signals and slots";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -16,14 +16,14 @@ namespace ExerciseManagement
|
||||
DdsHandler::DdsHandler(int domainId)
|
||||
: m_ddsConnector(std::make_shared<DDSConnector::DdsConnector>(domainId, IDL::PartitionType::Any))
|
||||
{
|
||||
DEBUG_LOG() << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
DEBUG_LOG(m_logger) << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
}
|
||||
|
||||
bool DdsHandler::init(const QStringList &qosFileList)
|
||||
{
|
||||
if(!m_ddsConnector->init(qosFileList))
|
||||
{
|
||||
ERROR_LOG() << "Error initializing dds connections - aborting";
|
||||
ERROR_LOG(m_logger) << "Error initializing dds connections - aborting";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -38,23 +38,23 @@ bool DdsHandler::init(const QStringList &qosFileList)
|
||||
m_ddsFts = ExerciseManagement::Interface::Fts::create(m_ddsConnector);
|
||||
|
||||
bool bRet = m_ddsDts->enableAll();
|
||||
INFO_LOG() << "Dts initialised";
|
||||
INFO_LOG(m_logger) << "Dts initialised";
|
||||
|
||||
bRet &= m_ddsFts->enableAll();
|
||||
INFO_LOG() << "Fts initialised";
|
||||
INFO_LOG(m_logger) << "Fts initialised";
|
||||
|
||||
m_scmFtc = ServiceManagement::Interface::Ftc::create(m_ddsConnector);
|
||||
bRet &= m_scmFtc->enableAll();
|
||||
INFO_LOG() << "ScmFtc Initialised";
|
||||
INFO_LOG(m_logger) << "ScmFtc Initialised";
|
||||
|
||||
m_ppmDtc = ParticipantManagement::Interface::Dtc::create(m_ddsConnector);
|
||||
bRet &= m_ppmDtc->enableEquipmentExerciseMapping();
|
||||
INFO_LOG() << "m_ppmDtc Initialised";
|
||||
INFO_LOG(m_logger) << "m_ppmDtc Initialised";
|
||||
|
||||
m_avmDtc = AudioVideoManagement::Interface::Dtc::create(m_ddsConnector);
|
||||
bRet &= m_avmDtc->enableCnrConfig();
|
||||
bRet &= m_avmDtc->enableCnrChannel();
|
||||
INFO_LOG() << "m_avmDtc Initialised";
|
||||
INFO_LOG(m_logger) << "m_avmDtc Initialised";
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ public:
|
||||
std::shared_ptr<DDSConnector::DdsConnector> ddsConnector() const { return m_ddsConnector; }
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
|
||||
std::shared_ptr<Core::Pacemaker> m_pacemaker;
|
||||
std::shared_ptr<Core::TopicLockMaster> m_topicLockMaster;
|
||||
|
||||
+3
-3
@@ -30,7 +30,7 @@ void ExerciseStateBase::onEntry(QEvent *event)
|
||||
{
|
||||
QState::onEntry(event);
|
||||
|
||||
DEBUG_LOG() << "Ex " << exerciseId() << ": onEntry Base: write exerciseState: " << m_exerciseState;
|
||||
DEBUG_LOG(m_logger) << "Ex " << exerciseId() << ": onEntry Base: write exerciseState: " << m_exerciseState;
|
||||
// write exerciseState to db
|
||||
m_exercise->setExerciseState(m_exerciseState);
|
||||
|
||||
@@ -61,7 +61,7 @@ void Creation::onEntry(QEvent *event)
|
||||
// fill durchgef_uebungen, before base because
|
||||
// we need a filled durchgef_uebungen there
|
||||
|
||||
DEBUG_LOG() << "Ex " << exerciseId() << ": onEntry Creation ";
|
||||
DEBUG_LOG(m_logger) << "Ex " << exerciseId() << ": onEntry Creation ";
|
||||
ExerciseStateBase::onEntry(event);
|
||||
|
||||
// TODO
|
||||
@@ -80,7 +80,7 @@ Start::Start(ObjectExercise *objExe)
|
||||
|
||||
void Start::onEntry(QEvent *event)
|
||||
{
|
||||
DEBUG_LOG() << "Ex " << exerciseId() << ": onEntry Start: write exerciseState: started";
|
||||
DEBUG_LOG(m_logger) << "Ex " << exerciseId() << ": onEntry Start: write exerciseState: started";
|
||||
ExerciseStateBase::onEntry(event);
|
||||
|
||||
// TODO:
|
||||
|
||||
@@ -24,12 +24,14 @@ namespace ExerciseManagement
|
||||
ExerciseManagement::ExerciseState exerciseState() const { return m_exerciseState; }
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
ExerciseStateBase(const QString &objectName, const ExerciseState &exerciseState, ObjectExercise* objExe);
|
||||
void onEntry(QEvent *event);
|
||||
|
||||
int exerciseId() const { return m_exercise ? m_exercise->id() : -1; }
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
ObjectExercise *m_exercise;
|
||||
private:
|
||||
const ExerciseManagement::ExerciseState m_exerciseState;
|
||||
@@ -48,6 +50,7 @@ namespace ExerciseManagement
|
||||
public:
|
||||
explicit Creation(ObjectExercise *objExe);
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onEntry(QEvent *event);
|
||||
};
|
||||
|
||||
@@ -57,6 +60,7 @@ namespace ExerciseManagement
|
||||
public:
|
||||
explicit Start(ObjectExercise *objExe);
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onEntry(QEvent *event);
|
||||
void onExit(QEvent *event);
|
||||
};
|
||||
@@ -74,6 +78,7 @@ namespace ExerciseManagement
|
||||
public:
|
||||
explicit Stop(ObjectExercise *objExe);
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onEntry(QEvent *event);
|
||||
};
|
||||
|
||||
|
||||
+7
-7
@@ -79,12 +79,12 @@ ExerciseStateMachine::ExerciseStateMachine(ObjectExercise* objExe, QObject *pare
|
||||
//States zur StateMachine hinzufügen
|
||||
for (ExerciseStateBase *state : std::as_const(m_exerciseStates))
|
||||
{
|
||||
DEBUG_LOG() << "Ex " << exerciseId() << ": state: " << state->exerciseState();
|
||||
DEBUG_LOG(m_logger) << "Ex " << exerciseId() << ": state: " << state->exerciseState();
|
||||
m_stateMachine->addState(state);
|
||||
connect(state, &ExerciseStateBase::entered, this, &ExerciseStateMachine::onEnteredState);
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "Ex " << exerciseId() << ": Constructor ExerciseStateMachine: size m_exerciseStates = " << m_exerciseStates.size();
|
||||
DEBUG_LOG(m_logger) << "Ex " << exerciseId() << ": Constructor ExerciseStateMachine: size m_exerciseStates = " << m_exerciseStates.size();
|
||||
}
|
||||
|
||||
ExerciseStateMachine::~ExerciseStateMachine()
|
||||
@@ -99,11 +99,11 @@ bool ExerciseStateMachine::init()
|
||||
if (m_stateMachine->isRunning())
|
||||
return false;
|
||||
|
||||
DEBUG_LOG() << "Ex " << exerciseId() << ": Init ExerciseStateMachine ";
|
||||
DEBUG_LOG(m_logger) << "Ex " << exerciseId() << ": Init ExerciseStateMachine ";
|
||||
// initialise current exerciseState
|
||||
ExerciseStateBase *currentExerciseState = getStateFromId(m_exercise->exerciseState());
|
||||
|
||||
DEBUG_LOG() << "Ex " << exerciseId() << ": State = "
|
||||
DEBUG_LOG(m_logger) << "Ex " << exerciseId() << ": State = "
|
||||
<< ExerciseStateManager::toString(m_exercise->exerciseState());
|
||||
|
||||
m_stateMachine->setInitialState(currentExerciseState);
|
||||
@@ -111,7 +111,7 @@ bool ExerciseStateMachine::init()
|
||||
|
||||
m_stateManager->setInitial(m_exercise->exerciseState());
|
||||
|
||||
DEBUG_LOG() << "Ex " << exerciseId() << ": ==> Done Init ExerciseStateMachine ";
|
||||
DEBUG_LOG(m_logger) << "Ex " << exerciseId() << ": ==> Done Init ExerciseStateMachine ";
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -128,13 +128,13 @@ bool ExerciseStateMachine::switchToState(ExerciseState newExerciseState)
|
||||
|
||||
void ExerciseStateMachine::onEnteredState()
|
||||
{
|
||||
DEBUG_LOG() << "Ex " << exerciseId() << ": ExerciseStateMachine - onEnteredState";
|
||||
DEBUG_LOG(m_logger) << "Ex " << exerciseId() << ": ExerciseStateMachine - onEnteredState";
|
||||
|
||||
ExerciseStateBase *s = qobject_cast<ExerciseStateBase*>(sender());
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
DEBUG_LOG() << "Ex " << exerciseId() << ": ExerciseStateBase : " << s->exerciseState();
|
||||
DEBUG_LOG(m_logger) << "Ex " << exerciseId() << ": ExerciseStateBase : " << s->exerciseState();
|
||||
|
||||
m_stateManager->setCurrent(s->exerciseState());
|
||||
|
||||
|
||||
+1
@@ -45,6 +45,7 @@ namespace ExerciseManagement
|
||||
void onEnteredState();
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
ExerciseStateBase *getStateFromId(ExerciseManagement::ExerciseState exerciseState);
|
||||
int exerciseId() const;
|
||||
|
||||
|
||||
+4
-4
@@ -30,11 +30,11 @@ namespace ExerciseManagement
|
||||
|
||||
bool ExerciseStateManager::triggerSwitchState(ExerciseManagement::ExerciseState state)
|
||||
{
|
||||
INFO_LOG() << "Ex " << exerciseId() << ": Trying to switch to state " << toString(state);
|
||||
INFO_LOG(m_logger) << "Ex " << exerciseId() << ": Trying to switch to state " << toString(state);
|
||||
std::function<void()> f = m_stateSignals.value(state);
|
||||
if (f)
|
||||
{
|
||||
//DEBUG_LOG() << "function: emit signal";
|
||||
//DEBUG_LOG(m_logger) << "function: emit signal";
|
||||
emit f();
|
||||
}
|
||||
return (f != nullptr);
|
||||
@@ -78,7 +78,7 @@ namespace ExerciseManagement
|
||||
|
||||
void ExerciseStateManager::setStateInternal(ExerciseManagement::ExerciseState state)
|
||||
{
|
||||
INFO_LOG() << "Ex " << exerciseId() << ": In setStateInternal: new state " << toString(state);
|
||||
INFO_LOG(m_logger) << "Ex " << exerciseId() << ": In setStateInternal: new state " << toString(state);
|
||||
if(m_exerciseState == state)
|
||||
return;
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace ExerciseManagement
|
||||
// or separate object (because we've to check the a/v state periodically etc)
|
||||
*/
|
||||
|
||||
INFO_LOG() << "Ex " << exerciseId() << ": Changed exercise state to " << toString(state);
|
||||
INFO_LOG(m_logger) << "Ex " << exerciseId() << ": Changed exercise state to " << toString(state);
|
||||
}
|
||||
|
||||
int ExerciseStateManager::exerciseId() const
|
||||
|
||||
+2
@@ -46,6 +46,8 @@ namespace ExerciseManagement
|
||||
void stateFalse();
|
||||
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void setStateInternal(ExerciseManagement::ExerciseState state);
|
||||
int exerciseId() const;
|
||||
|
||||
|
||||
+31
-31
@@ -56,14 +56,14 @@ HandlerExercise::~HandlerExercise()
|
||||
|
||||
bool HandlerExercise::init()
|
||||
{
|
||||
DEBUG_LOG() << "Finish Initialise DbAdministration (dba) ";
|
||||
INFO_LOG() << "Data available for services: " << m_exTblGen->getAvailableServices().join(QLatin1Char(','));
|
||||
DEBUG_LOG(m_logger) << "Finish Initialise DbAdministration (dba) ";
|
||||
INFO_LOG(m_logger) << "Data available for services: " << m_exTblGen->getAvailableServices().join(QLatin1Char(','));
|
||||
|
||||
QVector<Database::ExmExercise> dataVec;
|
||||
// read all exercises from database
|
||||
if (!m_db->select(dataVec))
|
||||
{
|
||||
ERROR_LOG() << "Error reading data from database!";
|
||||
ERROR_LOG(m_logger) << "Error reading data from database!";
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -77,13 +77,13 @@ bool HandlerExercise::init()
|
||||
if (ret.error())
|
||||
{
|
||||
delete ifs;
|
||||
ERROR_LOG() << ret();
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
return false;
|
||||
}
|
||||
m_exeObjMap.insert(ifs->id(), ifs);
|
||||
exerciseStates.push_back({ifs->id(), ifs->data().exerciseStateId});
|
||||
}
|
||||
DEBUG_LOG() << "m_exeObjMap.size() = " << m_exeObjMap.size();
|
||||
DEBUG_LOG(m_logger) << "m_exeObjMap.size() = " << m_exeObjMap.size();
|
||||
|
||||
// make sure to start the important exercises first
|
||||
std::sort(exerciseStates.begin(), exerciseStates.end(),
|
||||
@@ -140,7 +140,7 @@ void HandlerExercise::onStartNextExercise()
|
||||
auto *objEx = m_exeObjMap.value(exId);
|
||||
if (!objEx)
|
||||
{
|
||||
WARNING_LOG() << "Trying to start exercise with id " << exId << " but could not find a handler !?";
|
||||
WARNING_LOG(m_logger) << "Trying to start exercise with id " << exId << " but could not find a handler !?";
|
||||
continue;
|
||||
}
|
||||
NOTICE_LOG(m_logger) << "Init state machine for exercise " << exId << " (" << objEx->data().name << ")";
|
||||
@@ -155,7 +155,7 @@ bool HandlerExercise::hasError(const Core::FunctionReplyObject &replyObject, Obj
|
||||
if (replyObject.error())
|
||||
{
|
||||
delete ifs;
|
||||
ERROR_LOG() << replyObject();
|
||||
ERROR_LOG(m_logger) << replyObject();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -194,7 +194,7 @@ void HandlerExercise::onExerciseCreateRequest(const rti::core::SampleIdentity &c
|
||||
auto ret = exerciseCreateRequest(request);
|
||||
if (ret.error())
|
||||
{
|
||||
WARNING_LOG() << ret();
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
|
||||
}
|
||||
m_ddsHandler->fts()->exerciseCreateReply(cookie, ret);
|
||||
@@ -202,7 +202,7 @@ void HandlerExercise::onExerciseCreateRequest(const rti::core::SampleIdentity &c
|
||||
|
||||
Core::FunctionReplyObject HandlerExercise::exerciseCreateRequest(const ExerciseCreateRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "onExerciseCreateRequest: " << request;
|
||||
DEBUG_LOG(m_logger) << "onExerciseCreateRequest: " << request;
|
||||
|
||||
Database::ExmExercise newData(copyBaseData(request));
|
||||
newData.linkedExerciseId = 0;
|
||||
@@ -234,7 +234,7 @@ Core::FunctionReplyObject HandlerExercise::exerciseCreateRequest(const ExerciseC
|
||||
if (hasError(ret, ifs))
|
||||
{
|
||||
// remove failed create exercise request from DDS bus (id = 0)
|
||||
ERROR_LOG() << "CreateExercise failed, removing request from dds";
|
||||
ERROR_LOG(m_logger) << "CreateExercise failed, removing request from dds";
|
||||
m_ddsHandler->dts()->removeExerciseByKey(0);
|
||||
return ret;
|
||||
}
|
||||
@@ -250,7 +250,7 @@ Core::FunctionReplyObject HandlerExercise::exerciseCreateRequest(const ExerciseC
|
||||
|
||||
if (hasError(ret, ifs))
|
||||
{
|
||||
ERROR_LOG() << "CreateExercisePhase failed, removing requests from dds";
|
||||
ERROR_LOG(m_logger) << "CreateExercisePhase failed, removing requests from dds";
|
||||
m_ddsHandler->dts()->removeExercisePhaseByKey(0);
|
||||
m_ddsHandler->dts()->removeExerciseByKey(0);
|
||||
return ret;
|
||||
@@ -263,7 +263,7 @@ Core::FunctionReplyObject HandlerExercise::exerciseCreateRequest(const ExerciseC
|
||||
|
||||
if (hasError(ret, ifs))
|
||||
{
|
||||
ERROR_LOG() << "Set active phase failed, removing requests from dds";
|
||||
ERROR_LOG(m_logger) << "Set active phase failed, removing requests from dds";
|
||||
m_ddsHandler->dts()->removeExercisePhaseByKey(0);
|
||||
m_ddsHandler->dts()->removeExerciseByKey(0);
|
||||
return ret;
|
||||
@@ -283,13 +283,13 @@ void HandlerExercise::onExerciseModifyRequest(const rti::core::SampleIdentity &c
|
||||
{
|
||||
auto ret = exerciseModifyRequest(request);
|
||||
if (ret.error())
|
||||
WARNING_LOG() << ret();
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
m_ddsHandler->fts()->exerciseModifyReply(cookie, ret);
|
||||
}
|
||||
|
||||
Core::FunctionReplyObject HandlerExercise::exerciseModifyRequest(const ExerciseModifyRequest &request)
|
||||
{
|
||||
INFO_LOG() << "onExerciseModifyRequest: " << request;
|
||||
INFO_LOG(m_logger) << "onExerciseModifyRequest: " << request;
|
||||
|
||||
ObjectExercise *ifs = m_exeObjMap.value(request.id());
|
||||
if (ifs == nullptr)
|
||||
@@ -430,7 +430,7 @@ Core::FunctionReplyObject HandlerExercise::exerciseModifyRequest(const ExerciseM
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "Linked exercise: " << request.linkedExerciseId()
|
||||
DEBUG_LOG(m_logger) << "Linked exercise: " << request.linkedExerciseId()
|
||||
<< ", state: " << ifs->exerciseState()
|
||||
<< ", new: " << request.newState();
|
||||
if (request.linkedExerciseId() != 0 && ifs->exerciseState() != request.newState())
|
||||
@@ -440,7 +440,7 @@ Core::FunctionReplyObject HandlerExercise::exerciseModifyRequest(const ExerciseM
|
||||
{
|
||||
ObjectExercise *ifsLinked = m_exeObjMap.value(request.linkedExerciseId());
|
||||
if (!ifsLinked)
|
||||
WARNING_LOG() << "Linked exercise with id " << request.linkedExerciseId() << " not found!";
|
||||
WARNING_LOG(m_logger) << "Linked exercise with id " << request.linkedExerciseId() << " not found!";
|
||||
else
|
||||
{
|
||||
if (ifsLinked->exerciseState() != ExerciseManagement::ExerciseState::Paused ||
|
||||
@@ -478,7 +478,7 @@ Core::FunctionReplyObject HandlerExercise::exerciseModifyRequest(const ExerciseM
|
||||
//{
|
||||
// Core::FunctionReplyObject ret;
|
||||
|
||||
// INFO_LOG() << "onExerciseChangeStateRequest id = " << request.id();
|
||||
// INFO_LOG(m_logger) << "onExerciseChangeStateRequest id = " << request.id();
|
||||
|
||||
// ObjectExercise *ifs = m_exeObjMap.value(request.id());
|
||||
// if (ifs == nullptr)
|
||||
@@ -488,7 +488,7 @@ Core::FunctionReplyObject HandlerExercise::exerciseModifyRequest(const ExerciseM
|
||||
// return;
|
||||
// }
|
||||
|
||||
// DEBUG_LOG() << "request.newState() = " << request.newState();
|
||||
// DEBUG_LOG(m_logger) << "request.newState() = " << request.newState();
|
||||
|
||||
// ret = ifs->switchToState(request.newState());
|
||||
// if (!ret.error() && ifs->linkedExerciseId() != 0)
|
||||
@@ -498,7 +498,7 @@ Core::FunctionReplyObject HandlerExercise::exerciseModifyRequest(const ExerciseM
|
||||
// {
|
||||
// ObjectExercise *ifsLinked = m_exeObjMap.value(ifs->linkedExerciseId());
|
||||
// if (!ifsLinked)
|
||||
// WARNING_LOG() << "Linked exercise with id " << ifs->linkedExerciseId() << " not found!";
|
||||
// WARNING_LOG(m_logger) << "Linked exercise with id " << ifs->linkedExerciseId() << " not found!";
|
||||
// else
|
||||
// {
|
||||
// if (ifsLinked->exerciseState() != ExerciseManagement::ExerciseState::Paused ||
|
||||
@@ -509,7 +509,7 @@ Core::FunctionReplyObject HandlerExercise::exerciseModifyRequest(const ExerciseM
|
||||
// }
|
||||
|
||||
// if (ret.error())
|
||||
// ERROR_LOG() << ret();
|
||||
// ERROR_LOG(m_logger) << ret();
|
||||
|
||||
// m_ddsHandler->fts()->exerciseChangeStateReply(cookie, ret);
|
||||
//}
|
||||
@@ -530,7 +530,7 @@ void HandlerExercise::onGetExerciseImageRequest(const rti::core::SampleIdentity
|
||||
int32_t exerciseId = request.exerciseId();
|
||||
reply.id(exerciseId);
|
||||
|
||||
DEBUG_LOG() << "onGetExerciseImageRequest id = " << exerciseId;
|
||||
DEBUG_LOG(m_logger) << "onGetExerciseImageRequest id = " << exerciseId;
|
||||
|
||||
Database::ExmExerciseImage exmImg;
|
||||
if (!m_db->selectExmExerciseImage(exerciseId, exmImg))
|
||||
@@ -566,7 +566,7 @@ void HandlerExercise::onGetExerciseImageRequest(const rti::core::SampleIdentity
|
||||
// reply.imageData(LtsUtils::fromPixmap(excPx));
|
||||
// }
|
||||
// else
|
||||
// ERROR_LOG() << "image isNull for exercise " << exerciseId;
|
||||
// ERROR_LOG(m_logger) << "image isNull for exercise " << exerciseId;
|
||||
}
|
||||
|
||||
/* test behaviour on bad network speeds
|
||||
@@ -582,7 +582,7 @@ void HandlerExercise::onExerciseImageModifyRequest(const rti::core::SampleIdenti
|
||||
{
|
||||
qint32 exerciseId = request.id();
|
||||
|
||||
DEBUG_LOG() << "onExerciseImageModifyRequest id = " << exerciseId << ", image size = " << request.image().size();
|
||||
DEBUG_LOG(m_logger) << "onExerciseImageModifyRequest id = " << exerciseId << ", image size = " << request.image().size();
|
||||
|
||||
Database::ExmExerciseImage exImg;
|
||||
exImg.exerciseId = exerciseId;
|
||||
@@ -639,7 +639,7 @@ void HandlerExercise::onExerciseRemoveRequest(const rti::core::SampleIdentity &c
|
||||
|
||||
if (ret.error())
|
||||
{
|
||||
ERROR_LOG() << ret();
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -657,13 +657,13 @@ void HandlerExercise::onExerciseRemoveRequest(const rti::core::SampleIdentity &c
|
||||
void HandlerExercise::onStartGroupReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
if (replyObject.error())
|
||||
WARNING_LOG() << "Error starting group: " << replyObject();
|
||||
WARNING_LOG(m_logger) << "Error starting group: " << replyObject();
|
||||
}
|
||||
|
||||
|
||||
bool HandlerExercise::checkEquipmentNumbersOnAllExercises(int exerciseIdToBeStarted, QString &mesgOut)
|
||||
{
|
||||
INFO_LOG() << Q_FUNC_INFO <<" START, exerciseIdTobeStarted: " << exerciseIdToBeStarted;
|
||||
INFO_LOG(m_logger) << Q_FUNC_INFO <<" START, exerciseIdTobeStarted: " << exerciseIdToBeStarted;
|
||||
|
||||
// only one exercise, about to start
|
||||
if (m_exeObjMap.size() <= 1)
|
||||
@@ -684,7 +684,7 @@ bool HandlerExercise::checkEquipmentNumbersOnAllExercises(int exerciseIdToBeStar
|
||||
|
||||
if (!ppmDtcForEx)
|
||||
{
|
||||
WARNING_LOG() << Q_FUNC_INFO << " no ppmDtcForEx (" << exerciseIdToBeStarted << ")";
|
||||
WARNING_LOG(m_logger) << Q_FUNC_INFO << " no ppmDtcForEx (" << exerciseIdToBeStarted << ")";
|
||||
return true;
|
||||
}
|
||||
ppmDtcForEx->enableParticipant();
|
||||
@@ -704,7 +704,7 @@ bool HandlerExercise::checkEquipmentNumbersOnAllExercises(int exerciseIdToBeStar
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> ppmDtc = m_ddsHandler->ppmDtc();
|
||||
if (!ppmDtc)
|
||||
{
|
||||
WARNING_LOG() << Q_FUNC_INFO << " no ppmDtc";
|
||||
WARNING_LOG(m_logger) << Q_FUNC_INFO << " no ppmDtc";
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -723,7 +723,7 @@ bool HandlerExercise::checkEquipmentNumbersOnAllExercises(int exerciseIdToBeStar
|
||||
ObjectExercise *ifs = m_exeObjMap.value(exerciseId);
|
||||
if (!ifs)
|
||||
{
|
||||
ERROR_LOG() << Q_FUNC_INFO << " Exercise not found, exId = " << exerciseId;
|
||||
ERROR_LOG(m_logger) << Q_FUNC_INFO << " Exercise not found, exId = " << exerciseId;
|
||||
return;
|
||||
}
|
||||
if ((ifs->exerciseState() == ExerciseState::Started) ||
|
||||
@@ -733,7 +733,7 @@ bool HandlerExercise::checkEquipmentNumbersOnAllExercises(int exerciseIdToBeStar
|
||||
for (const auto &eq2p : std::as_const(mapping))
|
||||
if (eqNoForEx.contains(eq2p.equipmentNumber()))
|
||||
{
|
||||
DEBUG_LOG() << Q_FUNC_INFO << " !!! eq = " << eq2p.equipmentNumber() << " is already used in exercise =" << exerciseId;
|
||||
DEBUG_LOG(m_logger) << Q_FUNC_INFO << " !!! eq = " << eq2p.equipmentNumber() << " is already used in exercise =" << exerciseId;
|
||||
usedEqNumbers[exerciseId].insert(eq2p.equipmentNumber());
|
||||
}
|
||||
}
|
||||
@@ -767,7 +767,7 @@ bool HandlerExercise::checkEquipmentNumbersOnAllExercises(int exerciseIdToBeStar
|
||||
}
|
||||
} // while
|
||||
|
||||
WARNING_LOG() << Q_FUNC_INFO << " state change request not allowed: mesgOut:" << mesgOut;
|
||||
WARNING_LOG(m_logger) << Q_FUNC_INFO << " state change request not allowed: mesgOut:" << mesgOut;
|
||||
|
||||
// limit length:
|
||||
if (mesgOut.size()>200)
|
||||
|
||||
@@ -73,8 +73,10 @@ public:
|
||||
// }
|
||||
// };
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onStartNextExercise();
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
/**
|
||||
* @brief HandlerExercise::hasError
|
||||
* checks if there is an error in the replyObject and, if given, deletes
|
||||
@@ -107,6 +109,7 @@ private:
|
||||
QStringList doubleChannels(int exerciseAId, int exerciseBId) const;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
QHash<int, ObjectExercise*> m_exeObjMap;
|
||||
MainHandler *m_mainHandler;
|
||||
std::shared_ptr<DdsHandler> m_ddsHandler;
|
||||
|
||||
+9
-9
@@ -47,7 +47,7 @@ bool HandlerExercisePhase::init()
|
||||
if (ret.error())
|
||||
{
|
||||
delete ifs;
|
||||
ERROR_LOG() << ret();
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
bRet = false;
|
||||
return;
|
||||
}
|
||||
@@ -55,11 +55,11 @@ bool HandlerExercisePhase::init()
|
||||
};
|
||||
if (!m_db->select(cbPhase) || !bRet)
|
||||
{
|
||||
ERROR_LOG() << "Error reading data from database!";
|
||||
ERROR_LOG(m_logger) << "Error reading data from database!";
|
||||
return true;
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "m_exercisePhaseObjMap.size() = " << m_exercisePhaseObjMap.size();
|
||||
DEBUG_LOG(m_logger) << "m_exercisePhaseObjMap.size() = " << m_exercisePhaseObjMap.size();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -108,17 +108,17 @@ Core::FunctionReplyObject HandlerExercisePhase::removeAllPhasesByExerciseId(qint
|
||||
void HandlerExercisePhase::onExercisePhaseCreateRequest(const rti::core::SampleIdentity &cookie,
|
||||
const ExercisePhaseCreateRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "onExercisePhaseCreateRequest " << request;
|
||||
DEBUG_LOG(m_logger) << "onExercisePhaseCreateRequest " << request;
|
||||
Core::FunctionReplyObject ret = exercisePhaseCreateRequest(request);
|
||||
if (ret.error())
|
||||
ERROR_LOG() << ret();
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
|
||||
m_ddsHandler->fts()->exercisePhaseCreateReply(cookie, ret);
|
||||
}
|
||||
|
||||
void HandlerExercisePhase::onExercisePhaseModifyRequest(const rti::core::SampleIdentity &cookie, const ExercisePhaseModifyRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "onExercisePhaseModifyRequest " << request;
|
||||
DEBUG_LOG(m_logger) << "onExercisePhaseModifyRequest " << request;
|
||||
Core::FunctionReplyObject ret;
|
||||
|
||||
ObjectExercisePhase *ifs = m_exercisePhaseObjMap.value(request.id());
|
||||
@@ -139,13 +139,13 @@ void HandlerExercisePhase::onExercisePhaseModifyRequest(const rti::core::SampleI
|
||||
|
||||
ret = ifs->updateObject(data);
|
||||
if (ret.error())
|
||||
ERROR_LOG() << ret();
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
m_ddsHandler->fts()->exercisePhaseModifyReply(cookie, ret);
|
||||
}
|
||||
|
||||
void HandlerExercisePhase::onExercisePhaseRemoveRequest(const rti::core::SampleIdentity &cookie, const Core::RemoveElementRequest &request)
|
||||
{
|
||||
DEBUG_LOG() << "onExercisePhaseRemoveRequest " << request;
|
||||
DEBUG_LOG(m_logger) << "onExercisePhaseRemoveRequest " << request;
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectExercisePhase *ifs = m_exercisePhaseObjMap.value(request.id());
|
||||
|
||||
@@ -178,7 +178,7 @@ void HandlerExercisePhase::onExercisePhaseRemoveRequest(const rti::core::SampleI
|
||||
ret = ifs->removeObject();
|
||||
|
||||
if (ret.error())
|
||||
ERROR_LOG() << ret();
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
else
|
||||
{
|
||||
// delete ObjectExercise (including ExerciseStateMachine)
|
||||
|
||||
+2
@@ -36,6 +36,7 @@ public:
|
||||
Core::FunctionReplyObject removeAllPhasesByExerciseId(qint64 exerciseId);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onExercisePhaseCreateRequest(const rti::core::SampleIdentity &cookie,
|
||||
const ExercisePhaseCreateRequest &request) override final;
|
||||
void onExercisePhaseModifyRequest(const rti::core::SampleIdentity &cookie,
|
||||
@@ -44,6 +45,7 @@ private:
|
||||
const Core::RemoveElementRequest &request) override final;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
QMap<int, ObjectExercisePhase *> m_exercisePhaseObjMap;
|
||||
MainHandler *m_mainHandler;
|
||||
std::shared_ptr<DdsHandler> m_ddsHandler;
|
||||
|
||||
@@ -19,9 +19,8 @@
|
||||
namespace ExerciseManagement
|
||||
{
|
||||
|
||||
MainHandler::MainHandler(QObject *parent)
|
||||
: QObject(parent)
|
||||
{}
|
||||
MainHandler::MainHandler(QObject *parent) : QObject(parent),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
|
||||
|
||||
MainHandler::~MainHandler()
|
||||
{
|
||||
@@ -39,7 +38,7 @@ bool MainHandler::init(int domainId)
|
||||
m_ddsHandler = std::make_shared<DdsHandler>(domainId);
|
||||
if (!m_ddsHandler->init())
|
||||
{
|
||||
ERROR_LOG() << "Initialisation ddsHandler failed.";
|
||||
ERROR_LOG(m_logger) << "Initialisation ddsHandler failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -47,14 +46,14 @@ bool MainHandler::init(int domainId)
|
||||
m_dbHandler = std::make_shared<DbHandler>();
|
||||
if (!m_dbHandler->init(0, Settings::settings()))
|
||||
{
|
||||
ERROR_LOG() << "Initialisation dbHandler failed.";
|
||||
ERROR_LOG(m_logger) << "Initialisation dbHandler failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
// initialize DbAdministration
|
||||
if (!initDbAdminstration())
|
||||
{
|
||||
ERROR_LOG() << "Initialisation dbAdministration failed.";
|
||||
ERROR_LOG(m_logger) << "Initialisation dbAdministration failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -86,11 +85,11 @@ bool MainHandler::initDbAdminstration()
|
||||
connect(m_exTblGen.get(), &DBAdministration::ExerciseTableGenerator::aliveSignal,
|
||||
this, &MainHandler::sendKeepAlive);
|
||||
|
||||
DEBUG_LOG() << "Initialise DbAdmin ";
|
||||
DEBUG_LOG(m_logger) << "Initialise DbAdmin ";
|
||||
if (!m_exTblGen->init(m_dbHandler->db()->database(),
|
||||
m_dbHandler->db()->schemaName()))
|
||||
{
|
||||
ERROR_LOG() << "Initialisation dbAdminHandler failed.";
|
||||
ERROR_LOG(m_logger) << "Initialisation dbAdminHandler failed.";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -100,10 +99,10 @@ bool MainHandler::initExerciseHandler()
|
||||
{
|
||||
m_handlerExercise.reset(new HandlerExercise(this, m_ddsHandler, m_dbHandler->db(), m_exTblGen));
|
||||
|
||||
DEBUG_LOG() << "Initialise ExerciseHandler ";
|
||||
DEBUG_LOG(m_logger) << "Initialise ExerciseHandler ";
|
||||
if (!m_handlerExercise->init())
|
||||
{
|
||||
ERROR_LOG() << "Initialisation ExerciseHandler failed.";
|
||||
ERROR_LOG(m_logger) << "Initialisation ExerciseHandler failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -114,10 +113,10 @@ bool MainHandler::initExercisePhaseHandler()
|
||||
{
|
||||
m_handlerExercisePhases.reset(new HandlerExercisePhase(this, m_ddsHandler, m_dbHandler->db()));
|
||||
|
||||
DEBUG_LOG() << "Initialise ExercisePhaseHandler ";
|
||||
DEBUG_LOG(m_logger) << "Initialise ExercisePhaseHandler ";
|
||||
if (!m_handlerExercisePhases->init())
|
||||
{
|
||||
ERROR_LOG() << "Initialisation ExercisePhaseHandler failed.";
|
||||
ERROR_LOG(m_logger) << "Initialisation ExercisePhaseHandler failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -127,10 +126,10 @@ bool MainHandler::initExercisePhaseHandler()
|
||||
bool MainHandler::initWebSocketHandler()
|
||||
{
|
||||
m_websocketHandler = std::make_shared<WebSocketInterface::WebSocketInterfaceHandler>(this);
|
||||
DEBUG_LOG() << "Initialise WebSocketInterfaceHandler";
|
||||
DEBUG_LOG(m_logger) << "Initialise WebSocketInterfaceHandler";
|
||||
if (!m_websocketHandler->init())
|
||||
{
|
||||
ERROR_LOG() << "Initialisation WebSocketInterfaceHandler failed.";
|
||||
ERROR_LOG(m_logger) << "Initialisation WebSocketInterfaceHandler failed.";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ public:
|
||||
std::shared_ptr<DdsHandler> dds() const { return m_ddsHandler; }
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
bool initDbAdminstration();
|
||||
bool initExerciseHandler();
|
||||
bool initExercisePhaseHandler();
|
||||
@@ -46,6 +47,7 @@ private:
|
||||
void sendKeepAlive();
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<HandlerExercise> m_handlerExercise;
|
||||
std::shared_ptr<HandlerExercisePhase> m_handlerExercisePhases;
|
||||
std::shared_ptr<DdsHandler> m_ddsHandler;
|
||||
|
||||
+27
-27
@@ -70,12 +70,12 @@ Core::FunctionReplyObject ObjectExercise::createObject(const Database::ExmExerci
|
||||
if (!m_db->insert(m_data))
|
||||
{
|
||||
QString errText = m_db->getLastError().databaseText();
|
||||
ERROR_LOG() << "Error inserting exercise into database: " << errText;
|
||||
ERROR_LOG(m_logger) << "Error inserting exercise into database: " << errText;
|
||||
return Core::FunctionReplyObject(0, tr_lts("dds", "Error inserting ExmExercise-data into database: %1")).arg(errText);
|
||||
}
|
||||
|
||||
// Id is serial -> will be generated by db => inside m_data after db-insert
|
||||
DEBUG_LOG() << "New exerciseId: " << m_data.id;
|
||||
DEBUG_LOG(m_logger) << "New exerciseId: " << m_data.id;
|
||||
|
||||
// Create exercise-schema
|
||||
if (!m_exTblGen->createExerciseSchema(m_data.id))
|
||||
@@ -94,7 +94,7 @@ Core::FunctionReplyObject ObjectExercise::createObject(const Database::ExmExerci
|
||||
if (m_logger.isDebugEnabled())
|
||||
m_exTblGen->writeExerciseServicesSql(m_data.id);
|
||||
|
||||
INFO_LOG() << "Exercise created sucessfully.";
|
||||
INFO_LOG(m_logger) << "Exercise created sucessfully.";
|
||||
|
||||
// Publish Data via DTS
|
||||
onPublishData();
|
||||
@@ -106,7 +106,7 @@ void ObjectExercise::initStateMachine()
|
||||
{
|
||||
// Start ExerciseStateMachine
|
||||
m_stateMachine->init();
|
||||
INFO_LOG() << "StateMachine: currentState" << m_stateMachine->getCurrentState();
|
||||
INFO_LOG(m_logger) << "StateMachine: currentState" << m_stateMachine->getCurrentState();
|
||||
}
|
||||
|
||||
Core::FunctionReplyObject ObjectExercise::updateObject(const Database::ExmExercise &data)
|
||||
@@ -136,12 +136,12 @@ Core::FunctionReplyObject ObjectExercise::updateObject(const Database::ExmExerci
|
||||
|
||||
fixupTimeZone();
|
||||
|
||||
INFO_LOG() << "Trying to updateObject ExerciseData with id = " << data.id;
|
||||
INFO_LOG(m_logger) << "Trying to updateObject ExerciseData with id = " << data.id;
|
||||
|
||||
if (!m_db->update(m_data))
|
||||
{
|
||||
QString errText = m_db->getLastError().databaseText();
|
||||
ERROR_LOG() << "Failed to update ExerciseData with id = " << data.id << ": " << m_db->getLastError().databaseText();
|
||||
ERROR_LOG(m_logger) << "Failed to update ExerciseData with id = " << data.id << ": " << m_db->getLastError().databaseText();
|
||||
return Core::FunctionReplyObject(m_data.id, tr_lts("dds", "Error updating ExmExercise-data in database: %1")).arg(errText);
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ Core::FunctionReplyObject ObjectExercise::updateObject(const Database::ExmExerci
|
||||
return retOb;
|
||||
}
|
||||
|
||||
INFO_LOG() << "ExerciseData changed sucessfully.";
|
||||
INFO_LOG(m_logger) << "ExerciseData changed sucessfully.";
|
||||
|
||||
onPublishData();
|
||||
|
||||
@@ -175,14 +175,14 @@ Core::FunctionReplyObject ObjectExercise::removeObject(bool force)
|
||||
if (!m_db->removeExmExercise(m_data.id))
|
||||
{
|
||||
QString errText = m_db->getLastError().databaseText();
|
||||
ERROR_LOG() << "Cannot remove exercise id = " << m_data.id << "from database: " << errText;
|
||||
ERROR_LOG(m_logger) << "Cannot remove exercise id = " << m_data.id << "from database: " << errText;
|
||||
return Core::FunctionReplyObject(m_data.id, tr_lts("dds", "Exercise %1 (%2) can not be removed: %3")).arg(m_data.name).arg(m_data.id).arg(errText);
|
||||
}
|
||||
|
||||
m_ddsHandler->dts()->removeExerciseByKey(m_data.id);
|
||||
sendStateToServiceManagement(m_data.exerciseStateId); // terminated
|
||||
|
||||
INFO_LOG() << "Exercise dropped sucessfully.";
|
||||
INFO_LOG(m_logger) << "Exercise dropped sucessfully.";
|
||||
|
||||
return Core::FunctionReplyObject(m_data.id);
|
||||
}
|
||||
@@ -192,7 +192,7 @@ bool ObjectExercise::setLinkedExerciseId(int newLinkedExerciseId)
|
||||
m_data.linkedExerciseId = newLinkedExerciseId;
|
||||
if (!m_db->update(m_data))
|
||||
{
|
||||
ERROR_LOG() << "Failed to update ExerciseData with id = " << m_data.id << " : " << m_db->getLastError().text();
|
||||
ERROR_LOG(m_logger) << "Failed to update ExerciseData with id = " << m_data.id << " : " << m_db->getLastError().text();
|
||||
return false;
|
||||
}
|
||||
onPublishData();
|
||||
@@ -204,7 +204,7 @@ bool ObjectExercise::setSendToWms(bool bSend)
|
||||
m_data.sendToWms = bSend;
|
||||
if (!m_db->update(m_data))
|
||||
{
|
||||
ERROR_LOG() << "Failed to update ExerciseData with id = " << m_data.id << " : " << m_db->getLastError().text();
|
||||
ERROR_LOG(m_logger) << "Failed to update ExerciseData with id = " << m_data.id << " : " << m_db->getLastError().text();
|
||||
return false;
|
||||
}
|
||||
onPublishData();
|
||||
@@ -219,12 +219,12 @@ bool ObjectExercise::setExerciseState(const ExerciseState &exerciseState)
|
||||
|
||||
if (!isValid() || !isEditable())
|
||||
{
|
||||
WARNING_LOG() << "Trying to update an already removed ExmExercise object";
|
||||
WARNING_LOG(m_logger) << "Trying to update an already removed ExmExercise object";
|
||||
return false;
|
||||
}
|
||||
|
||||
DEBUG_LOG() << "## m_data.exerciseStateId = " << m_data.exerciseStateId;
|
||||
DEBUG_LOG() << "## exerciseState = " << exerciseState;
|
||||
DEBUG_LOG(m_logger) << "## m_data.exerciseStateId = " << m_data.exerciseStateId;
|
||||
DEBUG_LOG(m_logger) << "## exerciseState = " << exerciseState;
|
||||
|
||||
m_data.exerciseStateId = exerciseState;
|
||||
if (m_data.exerciseStateId == ExerciseManagement::ExerciseState::Stopped ||
|
||||
@@ -242,7 +242,7 @@ bool ObjectExercise::setExerciseState(const ExerciseState &exerciseState)
|
||||
|
||||
if (!m_db->update(m_data))
|
||||
{
|
||||
ERROR_LOG() << "Error updating ExmExercise-data in database (exerciseState) for exercise id = " << m_data.id << " : " << m_db->getLastError().text();;
|
||||
ERROR_LOG(m_logger) << "Error updating ExmExercise-data in database (exerciseState) for exercise id = " << m_data.id << " : " << m_db->getLastError().text();;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ bool ObjectExercise::setExerciseState(const ExerciseState &exerciseState)
|
||||
|
||||
// record exerciseStateChange
|
||||
if (!m_db->insert(stateChange))
|
||||
WARNING_LOG() << "Recording change of exerciseState failed: " << m_db->getLastError().text();;
|
||||
WARNING_LOG(m_logger) << "Recording change of exerciseState failed: " << m_db->getLastError().text();;
|
||||
|
||||
// Publish Data via DTS
|
||||
onPublishData();
|
||||
@@ -265,10 +265,10 @@ bool ObjectExercise::setExerciseState(const ExerciseState &exerciseState)
|
||||
|
||||
void ObjectExercise::onPublishData()
|
||||
{
|
||||
INFO_LOG() << "Publish ExmExercise-data to dds (" << m_data.id << ", " << m_data.name << ") ...";
|
||||
INFO_LOG(m_logger) << "Publish ExmExercise-data to dds (" << m_data.id << ", " << m_data.name << ") ...";
|
||||
|
||||
if (!m_ddsHandler->dts()->publish(convert(m_data)))
|
||||
ERROR_LOG() << "Error publishing ExmExercise-data to dds";
|
||||
ERROR_LOG(m_logger) << "Error publishing ExmExercise-data to dds";
|
||||
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ void ObjectExercise::fixupTimeZone()
|
||||
Core::FunctionReplyObject ObjectExercise::switchToState(const ExerciseState &newExerciseState, int operatorId, int workstationId)
|
||||
{
|
||||
Core::FunctionReplyObject ret;
|
||||
INFO_LOG() << "-------------- switchToState: " << newExerciseState
|
||||
INFO_LOG(m_logger) << "-------------- switchToState: " << newExerciseState
|
||||
<< ", currentState = " << m_stateMachine->getCurrentState();
|
||||
m_data.operatorId = operatorId;
|
||||
m_data.workstationId = workstationId;
|
||||
@@ -327,9 +327,9 @@ bool ObjectExercise::sendStateToServiceManagement(ExerciseState state)
|
||||
return false;
|
||||
|
||||
if (sgt != Core::ServiceGroupType::Master)
|
||||
DEBUG_LOG() << "Ex " << m_data.id << " - Trying to enable service group " << sgt;
|
||||
DEBUG_LOG(m_logger) << "Ex " << m_data.id << " - Trying to enable service group " << sgt;
|
||||
else
|
||||
DEBUG_LOG() << "Ex " << m_data.id << " - Trying to stop all services";
|
||||
DEBUG_LOG(m_logger) << "Ex " << m_data.id << " - Trying to stop all services";
|
||||
|
||||
// if there is an old group, stop them
|
||||
ServiceManagement::GroupRequest request(sgt,
|
||||
@@ -341,14 +341,14 @@ bool ObjectExercise::sendStateToServiceManagement(ExerciseState state)
|
||||
#ifndef EXM_OBJECT_EXERCISE_NO_HANDLER
|
||||
if (!m_exerciseHandler || !m_exerciseHandler->startGroupRequest(request))
|
||||
{
|
||||
ERROR_LOG() << "Ex " << m_data.id << " - Failed to start group " << sgt;
|
||||
ERROR_LOG(m_logger) << "Ex " << m_data.id << " - Failed to start group " << sgt;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
if (sgt != Core::ServiceGroupType::Master)
|
||||
DEBUG_LOG() << "Ex " << m_data.id << " - Sent start group " << sgt;
|
||||
DEBUG_LOG(m_logger) << "Ex " << m_data.id << " - Sent start group " << sgt;
|
||||
else
|
||||
DEBUG_LOG() << "Ex " << m_data.id << " - Sent stop all services";
|
||||
DEBUG_LOG(m_logger) << "Ex " << m_data.id << " - Sent stop all services";
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -374,7 +374,7 @@ bool ObjectExercise::transferExerciseToEvaluationDb()
|
||||
Settings::evaluationDatabaseName()) ||
|
||||
!m_copyExercise->doCopy())
|
||||
{
|
||||
WARNING_LOG() << "Could not backup exercise database to evaluation server";
|
||||
WARNING_LOG(m_logger) << "Could not backup exercise database to evaluation server";
|
||||
return false;
|
||||
}
|
||||
NOTICE_LOG(m_logger) << "Ex " << m_data.id << " - Started copying exercise from "
|
||||
@@ -391,7 +391,7 @@ void ObjectExercise::onTransferDbFinished()
|
||||
|
||||
m_data.transferred = true;
|
||||
if (!m_db->update(m_data))
|
||||
ERROR_LOG() << "Error updating ExmExercise-data (transferred) in database (exerciseState) for exercise id = " << m_data.id << " : " << m_db->getLastError().text();;
|
||||
ERROR_LOG(m_logger) << "Error updating ExmExercise-data (transferred) in database (exerciseState) for exercise id = " << m_data.id << " : " << m_db->getLastError().text();;
|
||||
|
||||
delete m_copyExercise;
|
||||
m_copyExercise = nullptr;
|
||||
@@ -402,7 +402,7 @@ void ObjectExercise::onTransferDbFinished()
|
||||
|
||||
void ObjectExercise::onErrorOccured()
|
||||
{
|
||||
WARNING_LOG() << "Ex " << m_data.id << " - Copying exercise from "
|
||||
WARNING_LOG(m_logger) << "Ex " << m_data.id << " - Copying exercise from "
|
||||
<< Settings::serverDatabaseHost() << ":" << Settings::serverDatabaseName()
|
||||
<< " to " << Settings::evaluationDatabaseHost() << ":" << Settings::evaluationDatabaseName();
|
||||
delete m_copyExercise;
|
||||
|
||||
@@ -68,12 +68,14 @@ namespace ExerciseManagement
|
||||
bool transferExerciseToEvaluationDb();
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onPublishData();
|
||||
void fixupTimeZone();
|
||||
void onErrorOccured();
|
||||
void onTransferDbFinished();
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<DdsHandler> m_ddsHandler;
|
||||
std::shared_ptr<DatabaseInterface> m_db;
|
||||
const std::shared_ptr<DBAdministration::ExerciseTableGenerator> m_exTblGen;
|
||||
|
||||
+10
-11
@@ -16,10 +16,9 @@ namespace ExerciseManagement
|
||||
{
|
||||
|
||||
ObjectExercisePhase::ObjectExercisePhase(const std::shared_ptr<DdsHandler> &ddsHandler,
|
||||
const std::shared_ptr<DatabaseInterface> &db)
|
||||
: m_ddsHandler(ddsHandler)
|
||||
, m_db(db)
|
||||
{}
|
||||
const std::shared_ptr<DatabaseInterface> &db) : m_ddsHandler(ddsHandler)
|
||||
, m_db(db),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {}
|
||||
|
||||
ObjectExercisePhase::~ObjectExercisePhase ()
|
||||
{}
|
||||
@@ -36,10 +35,10 @@ Core::FunctionReplyObject ObjectExercisePhase::createObject(const Database::ExmE
|
||||
}
|
||||
|
||||
// Id is serial -> will be generated by db => inside m_data after db-insert
|
||||
DEBUG_LOG() << "New exercisePhaseId: " << m_data.id;
|
||||
DEBUG_LOG(m_logger) << "New exercisePhaseId: " << m_data.id;
|
||||
}
|
||||
|
||||
INFO_LOG() << "ExercisePhase created sucessfully.";
|
||||
INFO_LOG(m_logger) << "ExercisePhase created sucessfully.";
|
||||
|
||||
// Publish Data via DTS
|
||||
onPublishData();
|
||||
@@ -54,15 +53,15 @@ Core::FunctionReplyObject ObjectExercisePhase::updateObject(const Database::ExmE
|
||||
|
||||
m_data = data;
|
||||
|
||||
INFO_LOG() << "Trying to updateObject ExercisePhaseData with id = " << data.id;
|
||||
INFO_LOG(m_logger) << "Trying to updateObject ExercisePhaseData with id = " << data.id;
|
||||
|
||||
if (!m_db->update(m_data))
|
||||
{
|
||||
ERROR_LOG() << "Failed to update ExercisePhaseData with id = " << data.id;
|
||||
ERROR_LOG(m_logger) << "Failed to update ExercisePhaseData with id = " << data.id;
|
||||
return Core::FunctionReplyObject(m_data.id, tr_lts("dds", "Error updating ExmExercisePhase-data with id %1 in database")).arg(data.id);
|
||||
}
|
||||
|
||||
INFO_LOG() << "ExercisePhaseData changed sucessfully.";
|
||||
INFO_LOG(m_logger) << "ExercisePhaseData changed sucessfully.";
|
||||
|
||||
// Publish Data via DTS
|
||||
onPublishData();
|
||||
@@ -88,10 +87,10 @@ bool ObjectExercisePhase::isValid() const
|
||||
|
||||
void ObjectExercisePhase::onPublishData()
|
||||
{
|
||||
INFO_LOG() << "Publish ExmExercisePhase-data to dds (" << m_data.id << ", " << m_data.name << ") ...";
|
||||
INFO_LOG(m_logger) << "Publish ExmExercisePhase-data to dds (" << m_data.id << ", " << m_data.name << ") ...";
|
||||
|
||||
if (!m_ddsHandler->dts()->publish(convert(m_data)))
|
||||
ERROR_LOG() << "Error publishing ExmExercisePhase-data to dds";
|
||||
ERROR_LOG(m_logger) << "Error publishing ExmExercisePhase-data to dds";
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ public:
|
||||
bool isValid() const;
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onPublishData();
|
||||
|
||||
private:
|
||||
|
||||
Reference in new issue
Block a user