CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/DQMServices/ClientConfig/src/QTestHandle.cc

Go to the documentation of this file.
00001 
00011 #include "DQMServices/ClientConfig/interface/QTestHandle.h"
00012 #include "DQMServices/ClientConfig/interface/QTestConfigurationParser.h"
00013 #include "DQMServices/ClientConfig/interface/QTestConfigure.h"
00014 #include "DQMServices/ClientConfig/interface/QTestStatusChecker.h"
00015 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00016 #include "boost/scoped_ptr.hpp"
00017 
00018 bool firstTime=true;
00019 
00020 QTestHandle::QTestHandle()
00021 {
00022   qtParser     = new QTestConfigurationParser;
00023   qtConfigurer = new QTestConfigure;
00024   qtChecker    = new QTestStatusChecker;
00025 
00026   testsConfigured = false;
00027   
00028 }
00029 
00030 QTestHandle::~QTestHandle()
00031 {
00032   delete qtParser;
00033   delete qtConfigurer;
00034   delete qtChecker;
00035 }
00036 
00037 bool QTestHandle::configureTests(const std::string &configFile, DQMStore *bei, bool UseDB)
00038 {
00039   //In case of UseDB==true the configFile is the content of the xml file itself
00040   //In case of UseDB==false (default) configFile is just the name of the file
00041   if (testsConfigured)
00042     qtParser->getNewDocument(configFile,UseDB);
00043   else
00044   {
00045     qtParser->getDocument(configFile,UseDB);
00046     testsConfigured=true;
00047   }
00048 
00049   if (! qtParser->parseQTestsConfiguration())
00050   {
00051     std::map<std::string, std::map<std::string, std::string> > testsONList
00052       = qtParser->testsList();
00053 
00054     if (qtConfigurer->enableTests(testsONList,bei)) 
00055       return true;
00056   }
00057   else
00058     return true;
00059 
00060   return false;
00061 }
00062 
00063 
00064 void QTestHandle::attachTests(DQMStore *bei, bool verboseQT)
00065 {
00066 
00067   std::map<std::string, std::vector<std::string> > mapMeToTests
00068     = qtParser->meToTestsList();
00069  
00070  
00071   for (std::map<std::string, std::vector<std::string> >::iterator itr = mapMeToTests.begin();
00072        itr != mapMeToTests.end();
00073        ++itr)
00074   {
00075     const std::string &meName = itr->first;
00076     const std::vector<std::string> &tests = itr->second;
00077     
00078     for (std::vector<std::string>::const_iterator testsItr = tests.begin();
00079          testsItr != tests.end(); ++testsItr){
00080       int cases =  bei->useQTestByMatch(meName, *testsItr);
00081       if (firstTime && verboseQT && cases == 0)
00082        edm::LogWarning ("QTestHandle::attachTests")
00083        << " ==>> Invalid qtest xml: Link '"<< meName 
00084        <<"', QTest '"<< *testsItr << "'  - no matching ME! <<== ";
00085       }
00086   }
00087   firstTime = false;
00088 }
00089 
00090 std::pair<std::string,std::string>
00091 QTestHandle::checkGlobalQTStatus(DQMStore *bei) const
00092 {
00093   return qtChecker->checkGlobalStatus(bei);
00094 }
00095 
00096 std::map< std::string, std::vector<std::string> >
00097 QTestHandle::checkDetailedQTStatus(DQMStore *bei) const
00098 {
00099   return qtChecker->checkDetailedStatus(bei);
00100 }