14 using namespace xercesc;
24 if (s_numberOfInstances==0)
25 XMLPlatformUtils::Initialize();
27 catch (
const XMLException&
e) {
28 throw(std::runtime_error(
"Standard pool exception : Fatal Error on pool::TrivialFileCatalog"));
31 ++s_numberOfInstances;
35 delete qtestParamNames;
40 testsToDisable.clear();
41 testsRequested.clear();
42 mapMonitorElementTests.clear();
43 bool qtErrors= this->qtestsConfig();
44 bool meErrors= this->monitorElementTestsMap();
45 return (qtErrors||meErrors);
53 unsigned int qtestTagsNum =
56 for (
unsigned int i=0;
i<qtestTagsNum; ++
i){
66 DOMElement* qtestElement =
static_cast<DOMElement *
>(qtestNode);
72 if(!std::strcmp(activate.c_str(),testActivationOFF.c_str())) {
73 testsToDisable.push_back(qtestName);
77 DOMNodeList *typeNodePrefix
80 if (typeNodePrefix->getLength () != 1)
return true;
83 DOMElement *prefixNode = dynamic_cast <DOMElement *> (typeNodePrefix->item (0));
84 if (!prefixNode)
return true;
86 DOMText *prefixText = dynamic_cast <DOMText *> (prefixNode->getFirstChild());
87 if (!prefixText)
return true;
91 testsRequested[qtestName]= this->getParams(qtestElement, qtestType);
93 if( this->checkParameters(qtestName, qtestType))
return true;
104 std::map<std::string, std::string> paramNamesValues;
105 paramNamesValues[
"type"]=qtestType;
107 DOMNodeList *arguments = qtestElement->getElementsByTagName (
qtxml::_toDOMS (
"PARAM"));
109 for (
unsigned int i=0;
i<arguments->getLength(); ++
i){
110 DOMElement *argNode = dynamic_cast <DOMElement *> ( arguments ->item(
i));
112 DOMText *argText = dynamic_cast <DOMText *> (argNode->getFirstChild());
118 paramNamesValues[regExp]=regExpValue;
121 return paramNamesValues;
127 std::vector<std::string> paramNames=qtestParamNames->getTestParamNames(qtestType);
134 paramNames.push_back(
"error");
135 paramNames.push_back(
"warning");
137 std::map<std::string, std::string> namesMap=testsRequested[qtestName];
139 for(std::vector<std::string>::iterator namesItr=paramNames.begin(); namesItr!=paramNames.end(); ++namesItr){
140 if(namesMap.find(*namesItr)==namesMap.end()){
153 unsigned int linkTagsNum =
157 for (
unsigned int i=0;
i<linkTagsNum; ++
i){
165 DOMElement* linkElement =
static_cast<DOMElement *
>(linkNode);
172 unsigned int numberOfTests=testList->getLength();
174 std::vector<std::string> qualityTestList;
175 for(
unsigned int tt=0;
tt<numberOfTests; ++
tt){
176 DOMElement * testElement = dynamic_cast <DOMElement *> ( testList ->item(
tt));
183 DOMText *argText = dynamic_cast <DOMText *> (testElement ->getFirstChild());
185 if(!std::strcmp(activate.c_str(),testON.c_str())) {
190 qualityTestList.push_back(regExpValue);
193 if(!std::strcmp(activate.c_str(),testOFF.c_str())) {
203 if(qualityTestList.size()) mapMonitorElementTests[linkName]=qualityTestList;
std::map< std::string, std::string > getParams(xercesc::DOMElement *qtestElement, std::string test)
bool monitorElementTestsMap()
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()
Destructor.
QTestConfigurationParser()
Creator.
XMLCh * _toDOMS(std::string temp)
static int s_numberOfInstances