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);
51 std::string testActivationOFF=
"false";
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);
128 if(paramNames.size() == 0) {
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()){
148 std::string testON=
"true";
149 std::string testOFF=
"false";
151 unsigned int linkTagsNum =
155 for (
unsigned int i=0;
i<linkTagsNum; ++
i){
163 DOMElement* linkElement =
static_cast<DOMElement *
>(linkNode);
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.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