22 if (s_numberOfInstances==0)
25 catch (
const XMLException&
e) {
26 throw(std::runtime_error(
"Standard pool exception : Fatal Error on pool::TrivialFileCatalog"));
29 ++s_numberOfInstances;
33 delete qtestParamNames;
34 qtestParamNames =
nullptr;
38 testsToDisable.clear();
39 testsRequested.clear();
40 mapMonitorElementTests.clear();
41 bool qtErrors= this->qtestsConfig();
42 bool meErrors= this->monitorElementTestsMap();
43 return (qtErrors||meErrors);
51 unsigned int qtestTagsNum =
54 for (
unsigned int i=0;
i<qtestTagsNum; ++
i){
64 DOMElement* qtestElement =
static_cast<DOMElement *
>(qtestNode);
70 if(!std::strcmp(activate.c_str(),testActivationOFF.c_str())) {
71 testsToDisable.push_back(qtestName);
75 DOMNodeList *typeNodePrefix
78 if (typeNodePrefix->getLength () != 1)
return true;
81 DOMElement *prefixNode = dynamic_cast <DOMElement *> (typeNodePrefix->item (0));
82 if (!prefixNode)
return true;
84 DOMText *prefixText = dynamic_cast <DOMText *> (prefixNode->getFirstChild());
85 if (!prefixText)
return true;
89 testsRequested[qtestName]= this->
getParams(qtestElement, qtestType);
91 if( this->checkParameters(qtestName, qtestType))
return true;
102 std::map<std::string, std::string> paramNamesValues;
103 paramNamesValues[
"type"]=qtestType;
105 DOMNodeList *arguments = qtestElement->getElementsByTagName (
qtxml::_toDOMS (
"PARAM"));
107 for (
unsigned int i=0;
i<arguments->getLength(); ++
i){
108 DOMElement *argNode = dynamic_cast <DOMElement *> ( arguments ->item(
i));
110 DOMText *argText = dynamic_cast <DOMText *> (argNode->getFirstChild());
116 paramNamesValues[regExp]=regExpValue;
119 return paramNamesValues;
125 std::vector<std::string> paramNames=qtestParamNames->getTestParamNames(qtestType);
132 paramNames.push_back(
"error");
133 paramNames.push_back(
"warning");
135 std::map<std::string, std::string> namesMap=testsRequested[qtestName];
137 for(std::vector<std::string>::iterator namesItr=paramNames.begin(); namesItr!=paramNames.end(); ++namesItr){
138 if(namesMap.find(*namesItr)==namesMap.end()){
151 unsigned int linkTagsNum =
155 for (
unsigned int i=0;
i<linkTagsNum; ++
i){
163 DOMElement* linkElement =
static_cast<DOMElement *
>(linkNode);
169 DOMNodeList *testList = linkElement->getElementsByTagName (
qtxml::_toDOMS (
"TestName"));
170 unsigned int numberOfTests=testList->getLength();
172 std::vector<std::string> qualityTestList;
173 for(
unsigned int tt=0;
tt<numberOfTests; ++
tt){
174 DOMElement * testElement = dynamic_cast <DOMElement *> ( testList ->item(
tt));
181 DOMText *argText = dynamic_cast <DOMText *> (testElement ->getFirstChild());
183 if(!std::strcmp(activate.c_str(),testON.c_str())) {
188 qualityTestList.push_back(regExpValue);
191 if(!std::strcmp(activate.c_str(),testOFF.c_str())) {
201 if(!qualityTestList.empty()) 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