Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
+21
-22
@@ -17,12 +17,11 @@
|
||||
//---------------------------------------------------------------------------------
|
||||
namespace ProjectDataManagement
|
||||
{
|
||||
PdmTests::PdmTests(QObject *parent)
|
||||
: QObject(parent)
|
||||
PdmTests::PdmTests(QObject *parent) : QObject(parent)
|
||||
, m_id(0)
|
||||
, m_testId(0)
|
||||
, m_bTestsSuccessful(true)
|
||||
{
|
||||
, m_bTestsSuccessful(true),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
qRegisterMetaType<Core::FunctionReply>("Core::FunctionReply");
|
||||
}
|
||||
|
||||
@@ -33,22 +32,22 @@ PdmTests::~PdmTests()
|
||||
//---------------------------------------------------------------------------------
|
||||
bool PdmTests::init(int domainId, int testId)
|
||||
{
|
||||
DEBUG_LOG() << "init begin";
|
||||
DEBUG_LOG(m_logger) << "init begin";
|
||||
m_testId = testId;
|
||||
|
||||
// initialize DDS
|
||||
m_ddsConnector.reset(new DDSConnector::DdsConnector(domainId, IDL::PartitionType::Global, 0));
|
||||
if (!m_ddsConnector->init())
|
||||
return false;
|
||||
DEBUG_LOG() << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
DEBUG_LOG(m_logger) << "DdsHandler(" << domainId << ") for partition: " << m_ddsConnector->getDefaultPartition();
|
||||
m_ddsConnector->initPublisherSubscriber();
|
||||
|
||||
DEBUG_LOG() << "create dtc";
|
||||
DEBUG_LOG(m_logger) << "create dtc";
|
||||
m_dtc = ProjectDataManagement::Interface::Dtc::create(m_ddsConnector);
|
||||
DEBUG_LOG() << "create ftc";
|
||||
DEBUG_LOG(m_logger) << "create ftc";
|
||||
m_ftc = ProjectDataManagement::Interface::Ftc::create(m_ddsConnector);
|
||||
bool bRet = m_dtc->enableAll() && m_ftc->enableAll();
|
||||
DEBUG_LOG() << "init end - bRet = " << bRet;
|
||||
DEBUG_LOG(m_logger) << "init end - bRet = " << bRet;
|
||||
|
||||
return bRet;
|
||||
}
|
||||
@@ -56,7 +55,7 @@ bool PdmTests::init(int domainId, int testId)
|
||||
//---------------------------------------------------------------------------------
|
||||
void PdmTests::startTest()
|
||||
{
|
||||
INFO_LOG() << "startTest";
|
||||
INFO_LOG(m_logger) << "startTest";
|
||||
if (m_testId == 0)
|
||||
{
|
||||
QTimer::singleShot(1000, this, &PdmTests::tryGetAllVulnerabilityKinds);
|
||||
@@ -72,7 +71,7 @@ void PdmTests::startTest()
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_LOG() << "Unknown test case!";
|
||||
ERROR_LOG(m_logger) << "Unknown test case!";
|
||||
failExit();
|
||||
}
|
||||
QTimer::singleShot(5000, qApp, &QCoreApplication::quit);
|
||||
@@ -82,21 +81,21 @@ void PdmTests::startTest()
|
||||
//---------------------------------------------------------------------------------
|
||||
void PdmTests::tryGetAllVulnerabilityKinds()
|
||||
{
|
||||
INFO_LOG() << "trying to get all ProjectDataManagements";
|
||||
INFO_LOG(m_logger) << "trying to get all ProjectDataManagements";
|
||||
const QMap<qint32, ProjectDataManagement::VulnerabilityKind> map = m_dtc->vulnerabilityKinds();
|
||||
if (map.isEmpty())
|
||||
{
|
||||
ERROR_LOG() << "Error requesting vulnerability kinds data";
|
||||
ERROR_LOG(m_logger) << "Error requesting vulnerability kinds data";
|
||||
failExit();
|
||||
}
|
||||
else
|
||||
{
|
||||
INFO_LOG() << "Amount of vulnerability kinds = " << map.size();
|
||||
INFO_LOG(m_logger) << "Amount of vulnerability kinds = " << map.size();
|
||||
m_id = map.firstKey();
|
||||
for(auto it = map.begin(); it != map.end(); ++it)
|
||||
{
|
||||
const ProjectDataManagement::VulnerabilityClass &vc = it.value().vulnerabilityClassId();
|
||||
INFO_LOG() << "VulnerabilityKind(" << it.key() << ") : " << it.value().name()
|
||||
INFO_LOG(m_logger) << "VulnerabilityKind(" << it.key() << ") : " << it.value().name()
|
||||
<< ", translation " << m_dtc->trVulnerabilityKindName(it.key(), vc);
|
||||
}
|
||||
}
|
||||
@@ -107,18 +106,18 @@ void PdmTests::tryGetAllVulnerabilityKinds()
|
||||
//---------------------------------------------------------------------------------
|
||||
void PdmTests::tryGetVulnerabilityKind()
|
||||
{
|
||||
INFO_LOG() << "trying get itemData for Vulnerability kind " << m_id;
|
||||
INFO_LOG(m_logger) << "trying get itemData for Vulnerability kind " << m_id;
|
||||
ProjectDataManagement::VulnerabilityKind data = m_dtc->vulnerabilityKind(m_id);
|
||||
|
||||
if (data.taVulnerabilityKind() <= 0)
|
||||
{
|
||||
ERROR_LOG() << "Error receiving data for id " << m_id;
|
||||
ERROR_LOG(m_logger) << "Error receiving data for id " << m_id;
|
||||
failExit();
|
||||
}
|
||||
else
|
||||
{
|
||||
const ProjectDataManagement::VulnerabilityClass &vc = data.vulnerabilityClassId();
|
||||
INFO_LOG() << "## VulnerabilityKind: (" << data.taVulnerabilityKind() << "), name: " << data.name()
|
||||
INFO_LOG(m_logger) << "## VulnerabilityKind: (" << data.taVulnerabilityKind() << "), name: " << data.name()
|
||||
<< ", translation " << m_dtc->trVulnerabilityKindName(m_id, vc);
|
||||
QTimer::singleShot(0, qApp, &QCoreApplication::quit);
|
||||
}
|
||||
@@ -128,19 +127,19 @@ void PdmTests::tryGetVulnerabilityKind()
|
||||
//---------------------------------------------------------------------------------
|
||||
void PdmTests::tryGetAllBiteComponentTexts()
|
||||
{
|
||||
INFO_LOG() << "trying to get all Bite Component Texts";
|
||||
INFO_LOG(m_logger) << "trying to get all Bite Component Texts";
|
||||
const QMap<qint32, ProjectDataManagement::BiteComponentText> map = m_dtc->biteComponentTexts();
|
||||
if (map.isEmpty())
|
||||
{
|
||||
ERROR_LOG() << "Error requesting bite components text data";
|
||||
ERROR_LOG(m_logger) << "Error requesting bite components text data";
|
||||
failExit();
|
||||
}
|
||||
else
|
||||
{
|
||||
INFO_LOG() << "Amount of bite component texts = " << map.size();
|
||||
INFO_LOG(m_logger) << "Amount of bite component texts = " << map.size();
|
||||
m_id = map.firstKey();
|
||||
for(auto it = map.begin(); it != map.end(); ++it)
|
||||
INFO_LOG() << "BiteComponent(" << it.key() << ") : " << it.value().name()
|
||||
INFO_LOG(m_logger) << "BiteComponent(" << it.key() << ") : " << it.value().name()
|
||||
<< ", translation " << m_dtc->trBiteComponentTextName(it.key());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ public:
|
||||
~ChargeTypeRename() = default;
|
||||
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void onUpdateChargeNamesRequest(const rti::core::SampleIdentity &cookie,
|
||||
const UpdateChargeNamesRequest &request) override;
|
||||
// void onSuppressVisibilityRequest(const rti::core::SampleIdentity &cookie,
|
||||
|
||||
@@ -16,14 +16,14 @@ namespace ProjectDataManagement
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -36,11 +36,11 @@ bool DdsHandler::init(const QStringList &qosFileList)
|
||||
|
||||
m_ddsDts = ProjectDataManagement::Interface::Dts::create(m_ddsConnector);
|
||||
bool bRet = m_ddsDts->enableAll();
|
||||
INFO_LOG() << "Dts initialised";
|
||||
INFO_LOG(m_logger) << "Dts initialised";
|
||||
|
||||
m_ddsFts = ProjectDataManagement::Interface::Fts::create(m_ddsConnector);
|
||||
bRet &= m_ddsFts->enableAll();
|
||||
INFO_LOG() << "Fts initialised";
|
||||
INFO_LOG(m_logger) << "Fts initialised";
|
||||
|
||||
return bRet;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ public:
|
||||
std::shared_ptr<DDSConnector::DdsConnector> dds() 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;
|
||||
|
||||
@@ -37,7 +37,7 @@ 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;
|
||||
}
|
||||
|
||||
@@ -45,13 +45,13 @@ 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;
|
||||
}
|
||||
|
||||
if(Settings::settings()->settings()->value(QLatin1String("TrainingAreaBase/UsePvSan"), false).toBool())
|
||||
{
|
||||
DEBUG_LOG() << "Has PvSan so do the import";
|
||||
DEBUG_LOG(m_logger) << "Has PvSan so do the import";
|
||||
PvSanImport(db(), m_logger);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ public:
|
||||
std::shared_ptr<DatabaseInterface> db() const;
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
std::shared_ptr<DdsHandler> m_ddsHandler;
|
||||
std::shared_ptr<DbHandler> m_dbHandler;
|
||||
std::shared_ptr<Translation> m_translation;
|
||||
|
||||
+14
-14
@@ -33,7 +33,7 @@ bool PvSanImport::publishDataPvSan()
|
||||
//b->removePdmTranslation()
|
||||
if (!readFile(procedures, material, injuries, kind, place1, place2))
|
||||
{
|
||||
ERROR_LOG() << "Can't read pvsan file";
|
||||
ERROR_LOG(m_logger) << "Can't read pvsan file";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -99,13 +99,13 @@ bool PvSanImport::readFile(QVector<QString> &procedures, QVector<QString> &mater
|
||||
{
|
||||
QString vbkFile = NGL::findFile(NGL::FileType::ConfigFile, QStringLiteral("vbk.csv"));
|
||||
QFile csvFile(vbkFile);
|
||||
DEBUG_LOG() << "Start reading File " << vbkFile;
|
||||
DEBUG_LOG(m_logger) << "Start reading File " << vbkFile;
|
||||
|
||||
if (!csvFile.exists())
|
||||
return false;
|
||||
if(!csvFile.open(QIODevice::ReadOnly))
|
||||
return false;
|
||||
DEBUG_LOG() << "Opened File";
|
||||
DEBUG_LOG(m_logger) << "Opened File";
|
||||
|
||||
bool skip = true;
|
||||
QTextStream in(&csvFile);
|
||||
@@ -118,7 +118,7 @@ bool PvSanImport::readFile(QVector<QString> &procedures, QVector<QString> &mater
|
||||
if (!line.startsWith(QStringLiteral("Version")))
|
||||
continue;
|
||||
|
||||
// ERROR_LOG() << line;
|
||||
// ERROR_LOG(m_logger) << line;
|
||||
QStringList versionSplit = line.split(QStringLiteral(";"));
|
||||
if (versionSplit.size() > 1)
|
||||
m_version = versionSplit.at(1);
|
||||
@@ -161,7 +161,7 @@ bool PvSanImport::readFile(QVector<QString> &procedures, QVector<QString> &mater
|
||||
skip = false;
|
||||
continue;
|
||||
}
|
||||
//ERROR_LOG() << line;
|
||||
//ERROR_LOG(m_logger) << line;
|
||||
|
||||
//now we read all lines until the end
|
||||
if (!line.isEmpty())
|
||||
@@ -265,12 +265,12 @@ bool PvSanImport::readFile(QVector<QString> &procedures, QVector<QString> &mater
|
||||
|
||||
csvFile.close();
|
||||
|
||||
// ERROR_LOG() << "read " << procedures.size() << " procedures from file";
|
||||
// ERROR_LOG() << "read " << material.size() << " materials from file";
|
||||
// ERROR_LOG() << "read " << injuries.size() << " injuries from file";
|
||||
// ERROR_LOG() << "read " << kind.size() << " kinds from file";
|
||||
// ERROR_LOG() << "read " << place1.size() << " place1 from file";
|
||||
// ERROR_LOG() << "read " << place2.size() << " place2 from file";
|
||||
// ERROR_LOG(m_logger) << "read " << procedures.size() << " procedures from file";
|
||||
// ERROR_LOG(m_logger) << "read " << material.size() << " materials from file";
|
||||
// ERROR_LOG(m_logger) << "read " << injuries.size() << " injuries from file";
|
||||
// ERROR_LOG(m_logger) << "read " << kind.size() << " kinds from file";
|
||||
// ERROR_LOG(m_logger) << "read " << place1.size() << " place1 from file";
|
||||
// ERROR_LOG(m_logger) << "read " << place2.size() << " place2 from file";
|
||||
|
||||
|
||||
return true;
|
||||
@@ -336,7 +336,7 @@ bool PvSanImport::addProcedures(const QVector<QString> &procedures)
|
||||
{
|
||||
|
||||
QStringList measure = entry.split(QStringLiteral(";"));
|
||||
// ERROR_LOG() << entry << " size of split: " << measure.size();
|
||||
// ERROR_LOG(m_logger) << entry << " size of split: " << measure.size();
|
||||
if (measure.size() < 34 )
|
||||
continue;
|
||||
Database::PdmSanitationProcedures pros;
|
||||
@@ -405,11 +405,11 @@ bool PvSanImport::addMaterial(const QVector<QString> &material)
|
||||
|
||||
q.prepare(stmt);
|
||||
|
||||
DEBUG_LOG() << "Statement: " << stmt;
|
||||
DEBUG_LOG(m_logger) << "Statement: " << stmt;
|
||||
|
||||
if (!q.exec())
|
||||
{
|
||||
WARNING_LOG() << "Could not delete sanitation materials";
|
||||
WARNING_LOG(m_logger) << "Could not delete sanitation materials";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -22,6 +22,7 @@ public:
|
||||
PvSanImport(const std::shared_ptr<DatabaseInterface> &db,
|
||||
NGL::INGLLogger &logger);
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
qint64 getCode(const QString &type, int typeId);
|
||||
|
||||
bool publishDataPvSan();
|
||||
|
||||
@@ -24,7 +24,7 @@ Translation::Translation(const std::shared_ptr<DdsHandler> &dds, const std::shar
|
||||
, m_dds(dds)
|
||||
, m_db(db)
|
||||
{
|
||||
DEBUG_LOG() << "Translation ctor";
|
||||
DEBUG_LOG(m_logger) << "Translation ctor";
|
||||
m_publishTimer.setInterval(1000);
|
||||
m_publishTimer.setSingleShot(true);
|
||||
m_publishTimer.setTimerType(Qt::VeryCoarseTimer);
|
||||
@@ -40,7 +40,7 @@ Translation::~Translation()
|
||||
|
||||
void Translation::collectAndPublishData()
|
||||
{
|
||||
DEBUG_LOG() << "Collecting translation data";
|
||||
DEBUG_LOG(m_logger) << "Collecting translation data";
|
||||
m_jsonData.clear();
|
||||
const auto cb = [this](const Database::PdmTranslation &data)
|
||||
{
|
||||
@@ -49,13 +49,13 @@ void Translation::collectAndPublishData()
|
||||
|
||||
if (!m_db->select(cb))
|
||||
{
|
||||
WARNING_LOG() << "Error fetching translations from db";
|
||||
WARNING_LOG(m_logger) << "Error fetching translations from db";
|
||||
return;
|
||||
}
|
||||
|
||||
publishData();
|
||||
|
||||
DEBUG_LOG() << "Collecting translation data - finished";
|
||||
DEBUG_LOG(m_logger) << "Collecting translation data - finished";
|
||||
}
|
||||
|
||||
void Translation::publishData()
|
||||
@@ -69,7 +69,7 @@ void Translation::publishData()
|
||||
const QByteArray compressed = qCompress(data, 9);
|
||||
const QByteArray md5Sum = QCryptographicHash::hash(compressed, QCryptographicHash::Md5).toHex();
|
||||
|
||||
INFO_LOG() << "Created translation blob with " << arr.size() << " elements, size: " << compressed.size()
|
||||
INFO_LOG(m_logger) << "Created translation blob with " << arr.size() << " elements, size: " << compressed.size()
|
||||
<< " (uncompressed: " << data.size() << "), md5Sum: " << md5Sum;
|
||||
m_dds->dts()->publish(ProjectDataManagement::TranslationBlob(s_translationBlobId,
|
||||
LtsUtils::convert<std::vector<uint8_t>>(compressed),
|
||||
@@ -127,7 +127,7 @@ void Translation::onInsertUpdateTranslationRequest(const rti::core::SampleIdenti
|
||||
else
|
||||
{
|
||||
fro = Core::FunctionReplyObject(te.id, tr_lts("dds", "Can not insert/update translation element"));
|
||||
WARNING_LOG() << fro();
|
||||
WARNING_LOG(m_logger) << fro();
|
||||
}
|
||||
m_dds->fts()->insertUpdateTranslationReply(cookie, fro);
|
||||
}
|
||||
|
||||
@@ -30,10 +30,12 @@ protected Q_SLOTS:
|
||||
void collectAndPublishData();
|
||||
void publishData();
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void addToJson(const Database::PdmTranslation &data);
|
||||
void onInsertUpdateTranslationRequest(const rti::core::SampleIdentity &cookie,
|
||||
const InsertUpdateTranslationRequest &request) override;
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
QHash<int, QJsonObject> m_jsonData;
|
||||
std::shared_ptr<DdsHandler> m_dds;
|
||||
std::shared_ptr<ProjectDataManagement::DatabaseInterface> m_db;
|
||||
|
||||
Reference in new issue
Block a user