Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
+41
-41
@@ -47,7 +47,7 @@ NomTests::~NomTests()
|
||||
//-----------------------------------------------------------------------------
|
||||
bool NomTests::init(int domainId, int exerciseId, int testId, int notificationId)
|
||||
{
|
||||
INFO_LOG() << "MrkTests::init() "
|
||||
INFO_LOG(m_logger) << "MrkTests::init() "
|
||||
<< " domainId:" << domainId
|
||||
<< " exerciseId:" << exerciseId
|
||||
<< " testId: " << testId
|
||||
@@ -65,22 +65,22 @@ bool NomTests::init(int domainId, int exerciseId, int testId, int notificationId
|
||||
m_ddsConnector->initPublisherSubscriber();
|
||||
|
||||
// Access to FTC
|
||||
TRACE_LOG() << "create ftc";
|
||||
TRACE_LOG(m_logger) << "create ftc";
|
||||
m_ftc = NotificationManagement::Interface::Ftc::create(m_ddsConnector);
|
||||
TRACE_LOG() << "init ftc";
|
||||
TRACE_LOG(m_logger) << "init ftc";
|
||||
bool bRet = m_ftc->enableAll();
|
||||
TRACE_LOG() << "init end - bRet = " << bRet;
|
||||
TRACE_LOG(m_logger) << "init end - bRet = " << bRet;
|
||||
|
||||
// Access to DTC
|
||||
TRACE_LOG() << "create dtc";
|
||||
TRACE_LOG(m_logger) << "create dtc";
|
||||
m_dtc = NotificationManagement::Interface::Dtc::create(m_ddsConnector);
|
||||
TRACE_LOG() << "init dtc";
|
||||
TRACE_LOG(m_logger) << "init dtc";
|
||||
bRet &= m_dtc->enableAll();
|
||||
TRACE_LOG() << "init end - bRet = " << bRet;
|
||||
TRACE_LOG(m_logger) << "init end - bRet = " << bRet;
|
||||
|
||||
|
||||
// Access to OPM DTC
|
||||
TRACE_LOG() << "create opmDtc";
|
||||
TRACE_LOG(m_logger) << "create opmDtc";
|
||||
m_opmDtc = OperatorManagement::Interface::Dtc::create(m_ddsConnector);
|
||||
m_opmDtc->enableUser();
|
||||
|
||||
@@ -90,7 +90,7 @@ bool NomTests::init(int domainId, int exerciseId, int testId, int notificationId
|
||||
//-----------------------------------------------------------------------------
|
||||
void NomTests::startTest()
|
||||
{
|
||||
INFO_LOG() << "startTest() exerciseId:" << m_exerciseId
|
||||
INFO_LOG(m_logger) << "startTest() exerciseId:" << m_exerciseId
|
||||
<< " testId:" << m_testId
|
||||
<< " notificationId:" << m_notificationId
|
||||
;
|
||||
@@ -129,10 +129,10 @@ void NomTests::tryCreate()
|
||||
CreateNotificationRequest data;
|
||||
getCreateNotificationRequestData(data);
|
||||
|
||||
INFO_LOG() << "trying to send CreateNotificationRequest";
|
||||
INFO_LOG(m_logger) << "trying to send CreateNotificationRequest";
|
||||
if (!m_ftc->createNotificationRequest(data, this))
|
||||
{
|
||||
ERROR_LOG() << "Error requesting create data";
|
||||
ERROR_LOG(m_logger) << "Error requesting create data";
|
||||
failExit();
|
||||
}
|
||||
}
|
||||
@@ -191,7 +191,7 @@ void NomTests::tryCreateHQ()
|
||||
notifReq.notification(notif);
|
||||
|
||||
if (!m_ftc->createNotificationRequest(notifReq, this))
|
||||
ERROR_LOG() << "Error requesting create Notification data";
|
||||
ERROR_LOG(m_logger) << "Error requesting create Notification data";
|
||||
|
||||
} // end of tryCreate()
|
||||
|
||||
@@ -213,10 +213,10 @@ void NomTests::tryReadReceipt()
|
||||
request.notificationIds({m_notificationId});
|
||||
request.processed(true);
|
||||
|
||||
INFO_LOG() << "trying to send CreateNotificationRequest";
|
||||
INFO_LOG(m_logger) << "trying to send CreateNotificationRequest";
|
||||
if (!m_ftc->readReceiptRequest(request, this))
|
||||
{
|
||||
ERROR_LOG() << "Error requesting readReceipt data";
|
||||
ERROR_LOG(m_logger) << "Error requesting readReceipt data";
|
||||
failExit();
|
||||
}
|
||||
} // end of tryReadReceipt
|
||||
@@ -230,10 +230,10 @@ void NomTests::tryRemove()
|
||||
|
||||
data.id(m_notificationId);
|
||||
|
||||
INFO_LOG() << "trying to send remove request for notificationId:" << data.id();
|
||||
INFO_LOG(m_logger) << "trying to send remove request for notificationId:" << data.id();
|
||||
if (!m_ftc->notificationRemoveRequest(data, this))
|
||||
{
|
||||
ERROR_LOG() << "Error requesting remove data for notificationId:" << data.id();
|
||||
ERROR_LOG(m_logger) << "Error requesting remove data for notificationId:" << data.id();
|
||||
failExit();
|
||||
}
|
||||
*/
|
||||
@@ -244,12 +244,12 @@ void NomTests::tryRemove()
|
||||
void NomTests::tryGetAllNotifications()
|
||||
{
|
||||
m_eTestStep = eGetAllNotifications;
|
||||
DEBUG_LOG() << "trying to get all notifications";
|
||||
DEBUG_LOG(m_logger) << "trying to get all notifications";
|
||||
|
||||
m_dtc->waitForHistoricalDataNomNotification();
|
||||
if (m_dtc->nomNotifications().isEmpty())
|
||||
{
|
||||
ERROR_LOG() << "Error requesting all notification data";
|
||||
ERROR_LOG(m_logger) << "Error requesting all notification data";
|
||||
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
||||
return;
|
||||
}
|
||||
@@ -259,7 +259,7 @@ void NomTests::tryGetAllNotifications()
|
||||
// needed for Test 11 tryGetNotification
|
||||
m_notificationId = notif.id();
|
||||
|
||||
INFO_LOG() << "Nom(" << notif.id() << ") :"
|
||||
INFO_LOG(m_logger) << "Nom(" << notif.id() << ") :"
|
||||
<< " title:" << notif.title()
|
||||
<< " content:" << notif.content()
|
||||
<< " timeStamp:" << notif.timeStamp()
|
||||
@@ -269,7 +269,7 @@ void NomTests::tryGetAllNotifications()
|
||||
<< " processPrio: " << notif.processedPriority()
|
||||
<< " recipient count:" << notif.recipientIds().size();
|
||||
|
||||
INFO_LOG() << "SenderAddress(" << notif.sender().id() << ") :"
|
||||
INFO_LOG(m_logger) << "SenderAddress(" << notif.sender().id() << ") :"
|
||||
<< " name: " << notif.sender().name()
|
||||
<< ", addressId: " << notif.sender().addressId()
|
||||
<< ", addressSubId: " << notif.sender().addressSubId()
|
||||
@@ -284,14 +284,14 @@ void NomTests::tryGetAllNotifications()
|
||||
//-----------------------------------------------------------------------------
|
||||
void NomTests::tryGetNotification()
|
||||
{
|
||||
DEBUG_LOG() << "trying to get notification with id:" << m_notificationId;
|
||||
DEBUG_LOG(m_logger) << "trying to get notification with id:" << m_notificationId;
|
||||
|
||||
if (m_testId > 1)
|
||||
m_eTestStep = eGetNotification;
|
||||
|
||||
if (m_notificationId <= 0)
|
||||
{
|
||||
ERROR_LOG() << "invalid notificationId - test aborted.";
|
||||
ERROR_LOG(m_logger) << "invalid notificationId - test aborted.";
|
||||
failExit();
|
||||
}
|
||||
|
||||
@@ -300,12 +300,12 @@ void NomTests::tryGetNotification()
|
||||
|
||||
if (notif.id() <= 0)
|
||||
{
|
||||
ERROR_LOG() << "Error receiving data for notificationId " << m_notificationId << " returnVal:" << notif.id();
|
||||
ERROR_LOG(m_logger) << "Error receiving data for notificationId " << m_notificationId << " returnVal:" << notif.id();
|
||||
failExit();
|
||||
}
|
||||
else
|
||||
{
|
||||
INFO_LOG() << "NomNotification(" << notif.id() << ") :"
|
||||
INFO_LOG(m_logger) << "NomNotification(" << notif.id() << ") :"
|
||||
<< " title:" << notif.title()
|
||||
<< " content:" << notif.content()
|
||||
<< " timeStamp:" << notif.timeStamp()
|
||||
@@ -317,7 +317,7 @@ void NomTests::tryGetNotification()
|
||||
|
||||
for (const NotificationManagement::Address &addr : notif.recipientIds())
|
||||
{
|
||||
INFO_LOG() << "Recipient(" << addr.id() << ") :"
|
||||
INFO_LOG(m_logger) << "Recipient(" << addr.id() << ") :"
|
||||
<< " name: " << addr.name()
|
||||
<< ", addressId: " << addr.addressId()
|
||||
<< ", addressSubId: " << addr.addressSubId()
|
||||
@@ -326,7 +326,7 @@ void NomTests::tryGetNotification()
|
||||
<< ", isRead: " << addr.isRead();
|
||||
}
|
||||
|
||||
INFO_LOG() << "SenderAddress(" << notif.sender().id() << ") :"
|
||||
INFO_LOG(m_logger) << "SenderAddress(" << notif.sender().id() << ") :"
|
||||
<< " name: " << notif.sender().name()
|
||||
<< ", addressId: " << notif.sender().addressId()
|
||||
<< ", addressSubId: " << notif.sender().addressSubId()
|
||||
@@ -340,7 +340,7 @@ void NomTests::tryGetNotification()
|
||||
{
|
||||
if (! onCompareCreatedData(notif))
|
||||
{
|
||||
ERROR_LOG() << "Compare created data failed!";
|
||||
ERROR_LOG(m_logger) << "Compare created data failed!";
|
||||
failExit();
|
||||
}
|
||||
else
|
||||
@@ -359,19 +359,19 @@ void NomTests::tryGetNotification()
|
||||
//-----------------------------------------------------------------------------
|
||||
void NomTests::onCreateNotificationReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
INFO_LOG() << "Got createReply with id " << replyObject.id()
|
||||
INFO_LOG(m_logger) << "Got createReply with id " << replyObject.id()
|
||||
<< " and errorString " << replyObject.translated();
|
||||
|
||||
m_notificationId = replyObject.id();
|
||||
|
||||
if (replyObject.error())
|
||||
{
|
||||
ERROR_LOG() << "Error requesting create data";
|
||||
ERROR_LOG(m_logger) << "Error requesting create data";
|
||||
failExit();
|
||||
return;
|
||||
}
|
||||
else
|
||||
DEBUG_LOG() << "Requesting create data ok. Got new id:" << replyObject.id() << " ... ok.";
|
||||
DEBUG_LOG(m_logger) << "Requesting create data ok. Got new id:" << replyObject.id() << " ... ok.";
|
||||
|
||||
if (m_testId == 0)
|
||||
// QTimer::singleShot(0, this, &NomTests::tryModify()));
|
||||
@@ -385,17 +385,17 @@ void NomTests::onCreateNotificationReply(const Core::FunctionReplyObject &replyO
|
||||
void NomTests::onReadReceiptReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
|
||||
INFO_LOG() << "Got onReadReceipt with id " << replyObject.id()
|
||||
INFO_LOG(m_logger) << "Got onReadReceipt with id " << replyObject.id()
|
||||
<< " and errorString " << replyObject.translated();
|
||||
|
||||
if (replyObject.error())
|
||||
{
|
||||
ERROR_LOG() << "Error requesting ReadReceipt data for id:" << replyObject.id();
|
||||
ERROR_LOG(m_logger) << "Error requesting ReadReceipt data for id:" << replyObject.id();
|
||||
failExit();
|
||||
return;
|
||||
}
|
||||
else
|
||||
DEBUG_LOG() << "Requesting ReadReceipt data for id:" << replyObject.id() << " ... ok.";
|
||||
DEBUG_LOG(m_logger) << "Requesting ReadReceipt data for id:" << replyObject.id() << " ... ok.";
|
||||
|
||||
if (m_testId == 0)
|
||||
// QTimer::singleShot(0, this, &MrkTests::tryDelete()));
|
||||
@@ -409,17 +409,17 @@ void NomTests::onReadReceiptReply(const Core::FunctionReplyObject &replyObject)
|
||||
/*
|
||||
void NomTests::onNotificationRemoveReply(const Core::FunctionReplyObject &replyObject)
|
||||
{
|
||||
INFO_LOG() << "Got removeReply with id " << replyObject.id()
|
||||
INFO_LOG(m_logger) << "Got removeReply with id " << replyObject.id()
|
||||
<< " and errorString " << replyObject.translated();
|
||||
|
||||
if (replyObject.error())
|
||||
{
|
||||
ERROR_LOG() << "Error requesting remove data for NotificationId:" << replyObject.id();
|
||||
ERROR_LOG(m_logger) << "Error requesting remove data for NotificationId:" << replyObject.id();
|
||||
failExit();
|
||||
return;
|
||||
}
|
||||
else
|
||||
DEBUG_LOG() << "Requesting remove data for NotificationId:" << replyObject.id() << " ... ok.";
|
||||
DEBUG_LOG(m_logger) << "Requesting remove data for NotificationId:" << replyObject.id() << " ... ok.";
|
||||
|
||||
if (m_testId == 0)
|
||||
{
|
||||
@@ -435,21 +435,21 @@ void NomTests::onNotificationRemoveReply(const Core::FunctionReplyObject &replyO
|
||||
//-----------------------------------------------------------------------------
|
||||
void NomTests::onReceiveNotificationChanged(const NomNotification &data, DataModification modType)
|
||||
{
|
||||
// INFO_LOG() << "onReceiveNotificationChanged() notificationId:" << data.id()
|
||||
// INFO_LOG(m_logger) << "onReceiveNotificationChanged() notificationId:" << data.id()
|
||||
// << " modificationType: = " << (int)modType<< " received";
|
||||
|
||||
switch (modType)
|
||||
{
|
||||
case DataModification::eAdded:
|
||||
INFO_LOG() << "*** NomNotification added received. notificationId:" << data.id();
|
||||
INFO_LOG(m_logger) << "*** NomNotification added received. notificationId:" << data.id();
|
||||
break;
|
||||
|
||||
case DataModification::eModified:
|
||||
INFO_LOG() << "*** NomNotification modified received. notificationId:" << data.id();
|
||||
INFO_LOG(m_logger) << "*** NomNotification modified received. notificationId:" << data.id();
|
||||
break;
|
||||
|
||||
case DataModification::eRemoved:
|
||||
INFO_LOG() << "*** NomNotification removed received. notificationId:" << data.id();
|
||||
INFO_LOG(m_logger) << "*** NomNotification removed received. notificationId:" << data.id();
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -505,7 +505,7 @@ void NomTests::getCreateNotificationRequestData(CreateNotificationRequest &data)
|
||||
//-----------------------------------------------------------------------------
|
||||
bool NomTests::onCompareCreatedData(NomNotification &data)
|
||||
{
|
||||
DEBUG_LOG() << "start onCompareCreatedData() for id :" << data.id();
|
||||
DEBUG_LOG(m_logger) << "start onCompareCreatedData() for id :" << data.id();
|
||||
|
||||
// Vergleicht die zurueckgelesen Datan mit den statischen create Daten
|
||||
|
||||
|
||||
+1
@@ -63,6 +63,7 @@ protected Q_SLOTS:
|
||||
void onReceiveNotificationChanged(const NomNotification &data, DataModification modType);
|
||||
|
||||
protected:
|
||||
NGL::INGLLogger &m_logger;
|
||||
// Callbackfunctions for FTC
|
||||
void onCreateNotificationReply(const Core::FunctionReplyObject &replyObject) override final;
|
||||
void onReadReceiptReply(const Core::FunctionReplyObject &reply) override final;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace NotificationManagement
|
||||
DdsHandler::DdsHandler(int domainId)
|
||||
: m_ddsConnector(std::make_shared<DDSConnector::DdsConnector>(domainId, IDL::PartitionType::AllExercises))
|
||||
{
|
||||
DEBUG_LOG() << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
DEBUG_LOG(m_logger) << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
} // end of ctor()DdsHandler
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,7 @@ 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;
|
||||
}
|
||||
|
||||
@@ -41,22 +41,22 @@ bool DdsHandler::init(const QStringList &qosFileList)
|
||||
// DTS
|
||||
m_ddsDts = NotificationManagement::Interface::Dts::create(m_ddsConnector);
|
||||
bool bRet = m_ddsDts->enableAll();
|
||||
INFO_LOG() << "Dts initialised";
|
||||
INFO_LOG(m_logger) << "Dts initialised";
|
||||
|
||||
// FTS
|
||||
m_ddsFts = NotificationManagement::Interface::Fts::create(m_ddsConnector);
|
||||
bRet &= m_ddsFts->enableAll();
|
||||
INFO_LOG() << "Fts initialised";
|
||||
INFO_LOG(m_logger) << "Fts initialised";
|
||||
|
||||
// DtcExm
|
||||
m_dtcExm = ExerciseManagement::Interface::Dtc::create(m_ddsConnector);
|
||||
bRet &= m_dtcExm->enableExercise();
|
||||
INFO_LOG() << "DtcExm initialised";
|
||||
INFO_LOG(m_logger) << "DtcExm initialised";
|
||||
|
||||
// DtcOpm
|
||||
m_dtcOpm = OperatorManagement::Interface::Dtc::create(m_ddsConnector);
|
||||
bRet &= m_dtcOpm->enableUser();
|
||||
INFO_LOG() << "DtcOpm initialised";
|
||||
INFO_LOG(m_logger) << "DtcOpm initialised";
|
||||
|
||||
return bRet;
|
||||
} // end of init()
|
||||
|
||||
@@ -47,6 +47,7 @@ public:
|
||||
private:
|
||||
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<DDSConnector::DdsConnector> m_ddsConnector;
|
||||
std::shared_ptr<Core::Interface::Dtc> m_dtcCore;
|
||||
std::shared_ptr<Core::Pacemaker> m_pacemaker;
|
||||
|
||||
+17
-17
@@ -37,14 +37,14 @@ HandlerNotification::~HandlerNotification()
|
||||
|
||||
bool HandlerNotification::init()
|
||||
{
|
||||
INFO_LOG() << "--- Start NotificationManagement HandlerNotification.";
|
||||
INFO_LOG(m_logger) << "--- Start NotificationManagement HandlerNotification.";
|
||||
|
||||
QVector<Database::NomAddress> dataAddressVec;
|
||||
|
||||
// read all addresses from database
|
||||
if (!m_db->select(dataAddressVec))
|
||||
{
|
||||
ERROR_LOG() << "Error reading address data from database!";
|
||||
ERROR_LOG(m_logger) << "Error reading address data from database!";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ bool HandlerNotification::init()
|
||||
// Remove old notifications
|
||||
if (isRemoveable(notif))
|
||||
{
|
||||
INFO_LOG() << "Remove old notification " << notif.title() << ", id = " << notif.id();
|
||||
INFO_LOG(m_logger) << "Remove old notification " << notif.title() << ", id = " << notif.id();
|
||||
removeNotificationIds.append(notif.id());
|
||||
return;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ bool HandlerNotification::init()
|
||||
if (ret.error())
|
||||
{
|
||||
delete ifs;
|
||||
ERROR_LOG() << ret();
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
bRet = false;
|
||||
return;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ bool HandlerNotification::init()
|
||||
};
|
||||
if (!m_db->select(cb) || !bRet)
|
||||
{
|
||||
ERROR_LOG() << "Error reading data from database!";
|
||||
ERROR_LOG(m_logger) << "Error reading data from database!";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -99,11 +99,11 @@ bool HandlerNotification::init()
|
||||
m_db->removeNomNotification(notificationId);
|
||||
trans.commit();
|
||||
|
||||
DEBUG_LOG() << "m_objectNotificationMap.size() = " << m_objectNotificationMap.size();
|
||||
DEBUG_LOG(m_logger) << "m_objectNotificationMap.size() = " << m_objectNotificationMap.size();
|
||||
|
||||
if (!m_ddsHandler->fts())
|
||||
{
|
||||
ERROR_LOG() << "m_ddsHandler->fts() == nullptr!";
|
||||
ERROR_LOG(m_logger) << "m_ddsHandler->fts() == nullptr!";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -118,8 +118,8 @@ bool HandlerNotification::init()
|
||||
connect(m_removeNotificationTimer, &QTimer::timeout, this, &HandlerNotification::onCheckRemove);
|
||||
m_removeNotificationTimer->start();
|
||||
|
||||
DEBUG_LOG() << "removeTimerInterval: " << Settings::removeTimerIntervalMSec();
|
||||
DEBUG_LOG() << "expiryTime: " << Settings::expiryIntervalMSec();
|
||||
DEBUG_LOG(m_logger) << "removeTimerInterval: " << Settings::removeTimerIntervalMSec();
|
||||
DEBUG_LOG(m_logger) << "expiryTime: " << Settings::expiryIntervalMSec();
|
||||
|
||||
return true;
|
||||
} // end of init()
|
||||
@@ -128,14 +128,14 @@ bool HandlerNotification::init()
|
||||
void HandlerNotification::onCreateNotificationRequest(const rti::core::SampleIdentity &cookie,
|
||||
const CreateNotification &request)
|
||||
{
|
||||
DEBUG_LOG() << "onCreateNotificationRequest: " << request;
|
||||
DEBUG_LOG(m_logger) << "onCreateNotificationRequest: " << request;
|
||||
|
||||
ObjectNotification *ifs(new ObjectNotification(m_ddsHandler, m_db));
|
||||
const Core::FunctionReplyObject ret = ifs->createObject(request.notification());
|
||||
if (ret.error())
|
||||
{
|
||||
delete ifs;
|
||||
WARNING_LOG() << ret();
|
||||
WARNING_LOG(m_logger) << ret();
|
||||
m_ddsHandler->fts()->createNotificationReply(cookie, ret);
|
||||
return;
|
||||
}
|
||||
@@ -149,7 +149,7 @@ void HandlerNotification::onCreateNotificationRequest(const rti::core::SampleIde
|
||||
void HandlerNotification::onReadReceiptRequest(const rti::core::SampleIdentity &cookie,
|
||||
const ReadReceipt &request)
|
||||
{
|
||||
DEBUG_LOG() << "onReadReceiptRequest: " << request;
|
||||
DEBUG_LOG(m_logger) << "onReadReceiptRequest: " << request;
|
||||
Core::FunctionReplyObject ret;
|
||||
|
||||
for (const auto notificationId : request.notificationIds())
|
||||
@@ -170,7 +170,7 @@ void HandlerNotification::onReadReceiptRequest(const rti::core::SampleIdentity &
|
||||
|
||||
void HandlerNotification::onDeleteMessageRequest(const rti::core::SampleIdentity &cookie, const DeleteMessage &request)
|
||||
{
|
||||
DEBUG_LOG() << "onDeleteMessageRequest: " << request;
|
||||
DEBUG_LOG(m_logger) << "onDeleteMessageRequest: " << request;
|
||||
Core::FunctionReplyObject ret;
|
||||
|
||||
for (const auto notificationId : request.notificationIds())
|
||||
@@ -203,10 +203,10 @@ void HandlerNotification::onExerciseChanged(const ExerciseManagement::Exercise &
|
||||
if (obj->notification().exerciseId() != data.id())
|
||||
continue;
|
||||
|
||||
DEBUG_LOG() << "Remove notification " << obj->id();
|
||||
DEBUG_LOG(m_logger) << "Remove notification " << obj->id();
|
||||
Core::FunctionReplyObject ret = obj->removeObject();
|
||||
if (ret.error())
|
||||
ERROR_LOG() << ret();
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
else
|
||||
{
|
||||
// delete ObjectNotification
|
||||
@@ -229,10 +229,10 @@ void HandlerNotification::onCheckRemove()
|
||||
if (!isRemoveable(notif))
|
||||
continue;
|
||||
|
||||
DEBUG_LOG() << "Remove notification " << obj->id();
|
||||
DEBUG_LOG(m_logger) << "Remove notification " << obj->id();
|
||||
Core::FunctionReplyObject ret = obj->removeObject();
|
||||
if (ret.error())
|
||||
ERROR_LOG() << ret();
|
||||
ERROR_LOG(m_logger) << ret();
|
||||
else
|
||||
{
|
||||
// delete ObjectNotification
|
||||
|
||||
+2
@@ -33,6 +33,8 @@ public:
|
||||
bool init();
|
||||
|
||||
private: // methods
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onCreateNotificationRequest(const rti::core::SampleIdentity &cookie,
|
||||
const CreateNotification &request) override final;
|
||||
void onReadReceiptRequest(const rti::core::SampleIdentity &cookie,
|
||||
|
||||
+10
-10
@@ -18,13 +18,13 @@ namespace NotificationManagement
|
||||
MainHandler::MainHandler()
|
||||
: m_logger(getLogger("MainHandler"))
|
||||
{
|
||||
INFO_LOG() << "MainHandler::MainHandler";
|
||||
INFO_LOG(m_logger) << "MainHandler::MainHandler";
|
||||
} // end of ctor()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
MainHandler::~MainHandler()
|
||||
{
|
||||
INFO_LOG() << "MainHandler::~MainHandler";
|
||||
INFO_LOG(m_logger) << "MainHandler::~MainHandler";
|
||||
m_ddsHandler = nullptr;
|
||||
m_dbHandler = nullptr;
|
||||
} // end of dtor()
|
||||
@@ -32,38 +32,38 @@ MainHandler::~MainHandler()
|
||||
|
||||
bool MainHandler::init(int domainId)
|
||||
{
|
||||
INFO_LOG() << "Start MessageDataManagement MainHandler. domainId ="<<domainId;
|
||||
INFO_LOG(m_logger) << "Start MessageDataManagement MainHandler. domainId ="<<domainId;
|
||||
|
||||
// initialize DDS
|
||||
m_ddsHandler = std::make_shared<DdsHandler>(domainId);
|
||||
if (!m_ddsHandler->init())
|
||||
{
|
||||
ERROR_LOG() << "Initialisation DdsHandler failed.";
|
||||
ERROR_LOG(m_logger) << "Initialisation DdsHandler failed.";
|
||||
if (m_ddsHandler->pacemaker())
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError);
|
||||
return false;
|
||||
}
|
||||
INFO_LOG() << "m_ddsHandler initialized. ";
|
||||
INFO_LOG(m_logger) << "m_ddsHandler initialized. ";
|
||||
|
||||
// initialize database
|
||||
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.";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError);
|
||||
return false;
|
||||
}
|
||||
INFO_LOG() << "DbHandler initialized. ";
|
||||
INFO_LOG(m_logger) << "DbHandler initialized. ";
|
||||
|
||||
INFO_LOG() << "create HandlerNotification. ";
|
||||
INFO_LOG(m_logger) << "create HandlerNotification. ";
|
||||
m_handlerNotification = std::make_shared<HandlerNotification>(m_ddsHandler, m_dbHandler->db());
|
||||
if (!m_handlerNotification->init())
|
||||
{
|
||||
ERROR_LOG() << "create HandlerNotification failed.";
|
||||
ERROR_LOG(m_logger) << "create HandlerNotification failed.";
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::StartingError);
|
||||
return false;
|
||||
}
|
||||
INFO_LOG() << "HandlerNotification initialized";
|
||||
INFO_LOG(m_logger) << "HandlerNotification initialized";
|
||||
|
||||
m_ddsHandler->pacemaker()->setNewState(Core::RunningState::Running);
|
||||
//m_ddsHandler->enableEquipmentMessage();
|
||||
|
||||
@@ -32,6 +32,8 @@ public:
|
||||
bool init(int domainId);
|
||||
|
||||
private: // attributes
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<DdsHandler> m_ddsHandler; ///< Pointer to DDS handler
|
||||
std::shared_ptr<DbHandler> m_dbHandler; ///< Pointer to DB handler
|
||||
std::shared_ptr<HandlerNotification> m_handlerNotification;
|
||||
|
||||
+18
-18
@@ -46,9 +46,9 @@ Core::FunctionReplyObject ObjectNotification::createObject(const NomNotification
|
||||
|
||||
// Neue DB Id in lokale Struktur uebernehmen
|
||||
m_dataNotificationObject.id(dbDataNotification.id);
|
||||
DEBUG_LOG() << "New NotificationId: " << dbDataNotification.id;
|
||||
DEBUG_LOG(m_logger) << "New NotificationId: " << dbDataNotification.id;
|
||||
|
||||
DEBUG_LOG() << "Handle Address for notificationId:" << dbDataNotification.id << " number of depending recipients: " << data.recipientIds().size();
|
||||
DEBUG_LOG(m_logger) << "Handle Address for notificationId:" << dbDataNotification.id << " number of depending recipients: " << data.recipientIds().size();
|
||||
|
||||
// Behandlung von Recipients
|
||||
for (size_t i = 0; i < data.recipientIds().size(); ++i)
|
||||
@@ -98,7 +98,7 @@ QString ObjectNotification::contentArgsToJson()
|
||||
|
||||
for (const std::string& arg : std::as_const(m_dataNotificationObject.contentArgs()))
|
||||
{
|
||||
DEBUG_LOG() << ".arg() ersetzt immer den kleinsten freien Platzhalter"
|
||||
DEBUG_LOG(m_logger) << ".arg() ersetzt immer den kleinsten freien Platzhalter"
|
||||
<< ", arg=" << arg;
|
||||
QJsonObject argObj;
|
||||
argObj[CONTENT_ID] = i;
|
||||
@@ -110,18 +110,18 @@ QString ObjectNotification::contentArgsToJson()
|
||||
mainObject[TRANSLATION_ARGS] = jsonArray;
|
||||
|
||||
QJsonDocument doc(mainObject);
|
||||
DEBUG_LOG() << "ObjectNotification::contentArgsToJson properties=" << QString::fromUtf8(doc.toJson(QJsonDocument::Compact));
|
||||
DEBUG_LOG(m_logger) << "ObjectNotification::contentArgsToJson properties=" << QString::fromUtf8(doc.toJson(QJsonDocument::Compact));
|
||||
return QString::fromUtf8(doc.toJson(QJsonDocument::Compact));
|
||||
}
|
||||
|
||||
std::vector<std::string> ObjectNotification::jsonToContentArgs(const QString &jsonString)
|
||||
{
|
||||
//DEBUG_LOG() << "jsonToContentArgs jsonString=" << jsonString;
|
||||
//DEBUG_LOG(m_logger) << "jsonToContentArgs jsonString=" << jsonString;
|
||||
std::vector<std::string> result;
|
||||
// 1. String parsen
|
||||
QJsonDocument doc = QJsonDocument::fromJson(jsonString.toUtf8());
|
||||
if (!doc.isObject()) {
|
||||
//WARNING_LOG() << "properties: Invalid JSON-Object";
|
||||
//WARNING_LOG(m_logger) << "properties: Invalid JSON-Object";
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ std::vector<std::string> ObjectNotification::jsonToContentArgs(const QString &js
|
||||
|
||||
// 2. Das Array aus "translationsArgs" herausholen
|
||||
if (!hauptObjekt.contains(TRANSLATION_ARGS) || !hauptObjekt[TRANSLATION_ARGS].isArray()) {
|
||||
//WARNING_LOG() << "Missing or invalid 'translationsArgs' key (must be an array).";
|
||||
//WARNING_LOG(m_logger) << "Missing or invalid 'translationsArgs' key (must be an array).";
|
||||
return result;
|
||||
}
|
||||
QJsonArray jsonArray = hauptObjekt[TRANSLATION_ARGS].toArray();
|
||||
@@ -148,8 +148,8 @@ std::vector<std::string> ObjectNotification::jsonToContentArgs(const QString &js
|
||||
// 4. Zugriff über die ID testen
|
||||
if (sucheMap.contains(gesuchteId)) {
|
||||
QJsonObject treffer = sucheMap[gesuchteId];
|
||||
//DEBUG_LOG() << "ID" << gesuchteId << "gefunden!";
|
||||
//DEBUG_LOG() << "Inhalt:" << treffer[CONTENT_ARG].toString();
|
||||
//DEBUG_LOG(m_logger) << "ID" << gesuchteId << "gefunden!";
|
||||
//DEBUG_LOG(m_logger) << "Inhalt:" << treffer[CONTENT_ARG].toString();
|
||||
QString contentStr = treffer[CONTENT_ARG].toString();
|
||||
result.emplace_back(contentStr.toStdString());
|
||||
} else {
|
||||
@@ -177,7 +177,7 @@ Core::FunctionReplyObject ObjectNotification::readReceipt(const ReadReceipt &dat
|
||||
continue;
|
||||
|
||||
dbDataAddr = toDbData(recipientAddr);
|
||||
DEBUG_LOG() << "Found Operator " << data.operatorId() << " with repicpentID " << dbDataAddr.id;
|
||||
DEBUG_LOG(m_logger) << "Found Operator " << data.operatorId() << " with repicpentID " << dbDataAddr.id;
|
||||
dbDataAddr.notificationId = dbDataNotification.id;
|
||||
|
||||
break;
|
||||
@@ -206,7 +206,7 @@ Core::FunctionReplyObject ObjectNotification::readReceipt(const ReadReceipt &dat
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_LOG() << "Notification already processed id=" << notificationId;
|
||||
DEBUG_LOG(m_logger) << "Notification already processed id=" << notificationId;
|
||||
return Core::FunctionReplyObject(dbDataNotification.processed, {}, {}, tr_lts("dds", "Notification already processed"));
|
||||
}
|
||||
}
|
||||
@@ -216,7 +216,7 @@ Core::FunctionReplyObject ObjectNotification::readReceipt(const ReadReceipt &dat
|
||||
|
||||
trans.commit();
|
||||
|
||||
INFO_LOG() << "Data changed for NotificationId: " << m_dataNotificationObject.id();
|
||||
INFO_LOG(m_logger) << "Data changed for NotificationId: " << m_dataNotificationObject.id();
|
||||
|
||||
const std::vector<Address> recipients = m_dataNotificationObject.recipientIds();
|
||||
const Address sender = m_dataNotificationObject.sender();
|
||||
@@ -249,7 +249,7 @@ Core::FunctionReplyObject ObjectNotification::deleteMessage(const DeleteMessage
|
||||
|
||||
for (const Address &recipientAddr : std::as_const(m_dataNotificationObject.recipientIds()))
|
||||
{
|
||||
DEBUG_LOG() << "recipientAddr="
|
||||
DEBUG_LOG(m_logger) << "recipientAddr="
|
||||
<< ", id: " << recipientAddr.id() << ", addressId: " << recipientAddr.addressId() << ", isDeleted: " << recipientAddr.isDeleted();
|
||||
if (data.operatorId() > 0 && recipientAddr.addressType() == AddressType_def::Operator && recipientAddr.addressId() != data.operatorId())
|
||||
continue;
|
||||
@@ -275,7 +275,7 @@ Core::FunctionReplyObject ObjectNotification::deleteMessage(const DeleteMessage
|
||||
|
||||
trans.commit();
|
||||
|
||||
INFO_LOG() << "Data changed for NotificationId: " << m_dataNotificationObject.id();
|
||||
INFO_LOG(m_logger) << "Data changed for NotificationId: " << m_dataNotificationObject.id();
|
||||
|
||||
std::vector<Address> recipients = m_dataNotificationObject.recipientIds();
|
||||
Address sender = m_dataNotificationObject.sender();
|
||||
@@ -284,7 +284,7 @@ Core::FunctionReplyObject ObjectNotification::deleteMessage(const DeleteMessage
|
||||
|
||||
for (const Address &addr : std::as_const(recipients))
|
||||
{
|
||||
DEBUG_LOG() << "addr="
|
||||
DEBUG_LOG(m_logger) << "addr="
|
||||
<< ", id: " << addr.id() << ", addressId: " << addr.addressId() << ", isDeleted: " << addr.isDeleted();
|
||||
|
||||
if (addr.id() == dbDataAddr.id)
|
||||
@@ -302,7 +302,7 @@ Core::FunctionReplyObject ObjectNotification::deleteMessage(const DeleteMessage
|
||||
|
||||
Core::FunctionReplyObject ObjectNotification::deleteObject(const DeleteMessage &data, int notificationId)
|
||||
{
|
||||
DEBUG_LOG() << "ObjectNotification::deleteObject"
|
||||
DEBUG_LOG(m_logger) << "ObjectNotification::deleteObject"
|
||||
<< ", notificationId: " << notificationId << ", addressId: " << data.addressId() << ", operatorId: " << data.operatorId()
|
||||
<< ", workstationId: " << data.workstationId();
|
||||
deleteMessage(data, notificationId);
|
||||
@@ -328,10 +328,10 @@ bool ObjectNotification::isValid() const { return m_dataNotificationObject.id()
|
||||
|
||||
void ObjectNotification::onPublishData()
|
||||
{
|
||||
INFO_LOG() << "Publish NomNotification-data to dds notificationId:" << m_dataNotificationObject.id();
|
||||
INFO_LOG(m_logger) << "Publish NomNotification-data to dds notificationId:" << m_dataNotificationObject.id();
|
||||
|
||||
if (!m_ddsHandler->dts()->publish(m_dataNotificationObject))
|
||||
WARNING_LOG() << "Error publishing NomNotification-data to dds";
|
||||
WARNING_LOG(m_logger) << "Error publishing NomNotification-data to dds";
|
||||
|
||||
} // end of onPublishData()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
+2
@@ -50,11 +50,13 @@ public:
|
||||
static Address toDdsData(const Database::NomAddress &dbData); // db -> dds
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onPublishData();
|
||||
QString contentArgsToJson();
|
||||
static std::vector<std::string> jsonToContentArgs(const QString &properties);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<DdsHandler> m_ddsHandler;
|
||||
std::shared_ptr<DatabaseInterface> m_db;
|
||||
NomNotification m_dataNotificationObject;
|
||||
|
||||
Reference in new issue
Block a user