20 if (s_numberOfInstances == 0)
22 }
catch (
const XMLException &
e) {
23 throw(std::runtime_error(
"Standard pool exception : Fatal Error on pool::TrivialFileCatalog"));
26 ++s_numberOfInstances;
30 delete qtestParamNames;
31 qtestParamNames =
nullptr;
35 testsToDisable.clear();
36 testsRequested.clear();
37 mapMonitorElementTests.clear();
38 bool qtErrors = this->qtestsConfig();
39 bool meErrors = this->monitorElementTestsMap();
40 return (qtErrors || meErrors);
46 unsigned int qtestTagsNum =
doc()->getElementsByTagName(
qtxml::_toDOMS(
"QTEST"))->getLength();
48 for (
unsigned int i = 0;
i < qtestTagsNum; ++
i) {
56 DOMElement *qtestElement =
static_cast<DOMElement *
>(qtestNode);
62 if (!std::strcmp(activate.c_str(), testActivationOFF.c_str())) {
63 testsToDisable.push_back(qtestName);
66 DOMNodeList *typeNodePrefix = qtestElement->getElementsByTagName(
qtxml::_toDOMS(
"TYPE"));
68 if (typeNodePrefix->getLength() != 1)
71 DOMElement *prefixNode =
dynamic_cast<DOMElement *
>(typeNodePrefix->item(0));
75 DOMText *prefixText =
dynamic_cast<DOMText *
>(prefixNode->getFirstChild());
81 testsRequested[qtestName] = this->
getParams(qtestElement, qtestType);
83 if (this->checkParameters(qtestName, qtestType))
94 std::map<std::string, std::string> paramNamesValues;
95 paramNamesValues[
"type"] = qtestType;
97 DOMNodeList *arguments = qtestElement->getElementsByTagName(
qtxml::_toDOMS(
"PARAM"));
99 for (
unsigned int i = 0;
i < arguments->getLength(); ++
i) {
100 DOMElement *argNode =
dynamic_cast<DOMElement *
>(arguments->item(
i));
102 DOMText *argText =
dynamic_cast<DOMText *
>(argNode->getFirstChild());
108 paramNamesValues[regExp] = regExpValue;
111 return paramNamesValues;
115 std::vector<std::string> paramNames = qtestParamNames->getTestParamNames(qtestType);
122 paramNames.push_back(
"error");
123 paramNames.push_back(
"warning");
125 std::map<std::string, std::string> namesMap = testsRequested[qtestName];
127 for (std::vector<std::string>::iterator namesItr = paramNames.begin(); namesItr != paramNames.end(); ++namesItr) {
128 if (namesMap.find(*namesItr) == namesMap.end()) {
140 unsigned int linkTagsNum =
doc()->getElementsByTagName(
qtxml::_toDOMS(
"LINK"))->getLength();
142 for (
unsigned int i = 0;
i < linkTagsNum; ++
i) {
148 DOMElement *linkElement =
static_cast<DOMElement *
>(linkNode);
155 unsigned int numberOfTests = testList->getLength();
157 std::vector<std::string> qualityTestList;
158 for (
unsigned int tt = 0;
tt < numberOfTests; ++
tt) {
159 DOMElement *testElement =
dynamic_cast<DOMElement *
>(testList->item(
tt));
166 DOMText *argText =
dynamic_cast<DOMText *
>(testElement->getFirstChild());
168 if (!std::strcmp(activate.c_str(), testON.c_str())) {
173 qualityTestList.push_back(regExpValue);
176 if (!std::strcmp(activate.c_str(), testOFF.c_str())) {
184 if (!qualityTestList.empty())
185 mapMonitorElementTests[linkName] = qualityTestList;
std::map< std::string, std::string > getParams(xercesc::DOMElement *qtestElement, std::string test)
bool monitorElementTestsMap()
~QTestConfigurationParser() override
Destructor.
bool parseQTestsConfiguration()
Methor that parses the xml file configFile, returns false if no errors are encountered.
std::string _toString(const XMLCh *toTranscode)
bool checkParameters(std::string qtestName, std::string qtestType)
QTestConfigurationParser()
Creator.
const T & getParams(const std::vector< T > ¶ms, size_t index)
XMLCh * _toDOMS(std::string temp)
static int s_numberOfInstances