#include <DQMServices/ClientConfig/interface/QTestConfigurationParser.h>
Public Member Functions | |
std::map< std::string, std::vector< std::string > > | meToTestsList () const |
Returns the map between the MonitoElemnt and the list of tests requested for it. | |
bool | parseQTestsConfiguration () |
Methor that parses the xml file configFile, returns false if no errors are encountered. | |
QTestConfigurationParser () | |
Creator. | |
std::map< std::string, std::map< std::string, std::string > > | testsList () const |
Returns the Quality Tests list with their parameters obtained from the xml file. | |
~QTestConfigurationParser () | |
Destructor. | |
Private Member Functions | |
bool | checkParameters (std::string qtestName, std::string qtestType) |
std::map< std::string, std::string > | getParams (xercesc::DOMElement *qtestElement, std::string test) |
int | instances () |
bool | monitorElementTestsMap () |
bool | qtestsConfig () |
Private Attributes | |
std::map< std::string, std::vector< std::string > > | mapMonitorElementTests |
QTestParameterNames * | qtestParamNames |
std::map< std::string, std::map< std::string, std::string > > | testsRequested |
std::vector< std::string > | testsToDisable |
Static Private Attributes | |
static int | s_numberOfInstances = 0 |
Definition at line 24 of file QTestConfigurationParser.h.
QTestConfigurationParser::QTestConfigurationParser | ( | ) |
Creator.
Definition at line 19 of file QTestConfigurationParser.cc.
References e, qtestParamNames, and s_numberOfInstances.
00019 { 00020 00021 qtestParamNames=new QTestParameterNames(); 00022 00023 try { 00024 if (s_numberOfInstances==0) 00025 XMLPlatformUtils::Initialize(); 00026 } 00027 catch (const XMLException& e) { 00028 throw(std::runtime_error("Standard pool exception : Fatal Error on pool::TrivialFileCatalog")); 00029 } 00030 00031 ++s_numberOfInstances; 00032 }
QTestConfigurationParser::~QTestConfigurationParser | ( | ) |
Destructor.
Definition at line 34 of file QTestConfigurationParser.cc.
References qtestParamNames.
00034 { 00035 delete qtestParamNames; 00036 qtestParamNames = 0; 00037 }
bool QTestConfigurationParser::checkParameters | ( | std::string | qtestName, | |
std::string | qtestType | |||
) | [private] |
Definition at line 125 of file QTestConfigurationParser.cc.
References QTestParameterNames::getTestParamNames(), qtestParamNames, and testsRequested.
00125 { 00126 00127 std::vector<std::string> paramNames=qtestParamNames->getTestParamNames(qtestType); 00128 if(paramNames.size() == 0) { 00129 00130 return true; 00131 } 00132 paramNames.push_back("error"); 00133 paramNames.push_back("warning"); 00134 00135 std::map<std::string, std::string> namesMap=testsRequested[qtestName]; 00136 00137 for(std::vector<std::string>::iterator namesItr=paramNames.begin(); namesItr!=paramNames.end(); ++namesItr){ 00138 if(namesMap.find(*namesItr)==namesMap.end()){ 00139 return true; 00140 } 00141 } 00142 00143 return false; 00144 }
std::map<std::string, std::string> QTestConfigurationParser::getParams | ( | xercesc::DOMElement * | qtestElement, | |
std::string | test | |||
) | [private] |
Referenced by qtestsConfig().
int QTestConfigurationParser::instances | ( | ) | [inline, private] |
Definition at line 42 of file QTestConfigurationParser.h.
References s_numberOfInstances.
00042 {return s_numberOfInstances;}
std::map<std::string, std::vector<std::string> > QTestConfigurationParser::meToTestsList | ( | ) | const [inline] |
Returns the map between the MonitoElemnt and the list of tests requested for it.
Definition at line 36 of file QTestConfigurationParser.h.
References mapMonitorElementTests.
Referenced by QTestHandle::attachTests().
00036 { return mapMonitorElementTests;}
bool QTestConfigurationParser::monitorElementTestsMap | ( | ) | [private] |
Get ME name
Loop on linkTagsNum
Definition at line 146 of file QTestConfigurationParser.cc.
References qtxml::_toDOMS(), qtxml::_toString(), DQMParserBase::doc, i, mapMonitorElementTests, and tt.
Referenced by parseQTestsConfiguration().
00146 { 00147 00148 std::string testON="true"; 00149 std::string testOFF="false"; 00150 00151 unsigned int linkTagsNum = 00152 doc->getElementsByTagName(qtxml::_toDOMS("LINK"))->getLength(); 00153 00154 00155 for (unsigned int i=0; i<linkTagsNum; ++i){ 00156 00157 DOMNode* linkNode = 00158 doc->getElementsByTagName(qtxml::_toDOMS("LINK"))->item(i); 00160 if (! linkNode){ 00161 return true; 00162 } 00163 DOMElement* linkElement = static_cast<DOMElement *>(linkNode); 00164 if (! linkElement){ 00165 return true; 00166 } 00167 std::string linkName = qtxml::_toString (linkElement->getAttribute (qtxml::_toDOMS ("name"))); 00168 00169 DOMNodeList *testList = linkElement->getElementsByTagName (qtxml::_toDOMS ("TestName")); 00170 unsigned int numberOfTests=testList->getLength(); 00171 00172 std::vector<std::string> qualityTestList; 00173 for(unsigned int tt=0; tt<numberOfTests; ++tt){ 00174 DOMElement * testElement = dynamic_cast <DOMElement *> ( testList ->item(tt)); 00175 if (!testElement ){ 00176 return true; 00177 } 00178 00179 std::string activate = qtxml::_toString (testElement ->getAttribute (qtxml::_toDOMS ("activate"))); 00180 00181 DOMText *argText = dynamic_cast <DOMText *> (testElement ->getFirstChild()); 00182 00183 if(!std::strcmp(activate.c_str(),testON.c_str())) { 00184 if (!argText){ 00185 return true; 00186 }else{ 00187 std::string regExpValue = qtxml::_toString (argText->getData()); 00188 qualityTestList.push_back(regExpValue); 00189 } 00190 } 00191 if(!std::strcmp(activate.c_str(),testOFF.c_str())) { 00192 if (argText) { 00193 std::string regExpValue = qtxml::_toString (argText->getData()); 00194 // Create List of QTests to unattach from current ME 00195 } 00196 } 00197 00198 } 00199 00200 00201 if(qualityTestList.size()) mapMonitorElementTests[linkName]=qualityTestList; 00202 } 00203 00204 00205 return false; 00206 00207 00208 00209 }
bool QTestConfigurationParser::parseQTestsConfiguration | ( | ) |
Methor that parses the xml file configFile, returns false if no errors are encountered.
Definition at line 39 of file QTestConfigurationParser.cc.
References mapMonitorElementTests, monitorElementTestsMap(), qtestsConfig(), testsRequested, and testsToDisable.
Referenced by QTestHandle::configureTests().
00039 { 00040 testsToDisable.clear(); 00041 testsRequested.clear(); 00042 mapMonitorElementTests.clear(); 00043 bool qtErrors= this->qtestsConfig(); 00044 bool meErrors= this->monitorElementTestsMap(); 00045 return (qtErrors||meErrors); 00046 00047 }
bool QTestConfigurationParser::qtestsConfig | ( | ) | [private] |
Get Node
Get QTEST name
Get Qtest TYPE
Definition at line 49 of file QTestConfigurationParser.cc.
References qtxml::_toDOMS(), qtxml::_toString(), DQMParserBase::doc, getParams(), i, testsRequested, and testsToDisable.
Referenced by parseQTestsConfiguration().
00049 { 00050 00051 std::string testActivationOFF="false"; 00052 00053 unsigned int qtestTagsNum = 00054 doc->getElementsByTagName(qtxml::_toDOMS("QTEST"))->getLength(); 00055 00056 for (unsigned int i=0; i<qtestTagsNum; ++i){ 00058 DOMNode* qtestNode = 00059 doc->getElementsByTagName(qtxml::_toDOMS("QTEST"))->item(i); 00060 00061 00063 if (! qtestNode){ 00064 return true; 00065 } 00066 DOMElement* qtestElement = static_cast<DOMElement *>(qtestNode); 00067 if (! qtestElement){ 00068 return true; 00069 } 00070 std::string qtestName = qtxml::_toString (qtestElement->getAttribute (qtxml::_toDOMS ("name"))); 00071 std::string activate = qtxml::_toString (qtestElement->getAttribute (qtxml::_toDOMS ("activate"))); 00072 if(!std::strcmp(activate.c_str(),testActivationOFF.c_str())) { 00073 testsToDisable.push_back(qtestName); 00074 }else{ 00075 00077 DOMNodeList *typeNodePrefix 00078 = qtestElement->getElementsByTagName (qtxml::_toDOMS ("TYPE")); 00079 00080 if (typeNodePrefix->getLength () != 1)return true; 00081 00082 00083 DOMElement *prefixNode = dynamic_cast <DOMElement *> (typeNodePrefix->item (0)); 00084 if (!prefixNode)return true; 00085 00086 DOMText *prefixText = dynamic_cast <DOMText *> (prefixNode->getFirstChild()); 00087 if (!prefixText)return true; 00088 00089 std::string qtestType = qtxml::_toString (prefixText->getData ()); 00090 00091 testsRequested[qtestName]= this->getParams(qtestElement, qtestType); 00092 00093 if( this->checkParameters(qtestName, qtestType)) return true; 00094 } 00095 00096 } //loop on qtestTagsNum 00097 00098 return false; 00099 00100 }
std::map<std::string, std::map<std::string, std::string> > QTestConfigurationParser::testsList | ( | ) | const [inline] |
Returns the Quality Tests list with their parameters obtained from the xml file.
Definition at line 34 of file QTestConfigurationParser.h.
References testsRequested.
Referenced by QTestHandle::configureTests().
00034 { return testsRequested;}
std::map<std::string, std::vector<std::string> > QTestConfigurationParser::mapMonitorElementTests [private] |
Definition at line 51 of file QTestConfigurationParser.h.
Referenced by meToTestsList(), monitorElementTestsMap(), and parseQTestsConfiguration().
Definition at line 54 of file QTestConfigurationParser.h.
Referenced by checkParameters(), QTestConfigurationParser(), and ~QTestConfigurationParser().
int QTestConfigurationParser::s_numberOfInstances = 0 [static, private] |
Definition at line 48 of file QTestConfigurationParser.h.
Referenced by instances(), and QTestConfigurationParser().
std::map<std::string, std::map<std::string, std::string> > QTestConfigurationParser::testsRequested [private] |
Definition at line 50 of file QTestConfigurationParser.h.
Referenced by checkParameters(), parseQTestsConfiguration(), qtestsConfig(), and testsList().
std::vector<std::string> QTestConfigurationParser::testsToDisable [private] |
Definition at line 52 of file QTestConfigurationParser.h.
Referenced by parseQTestsConfiguration(), and qtestsConfig().