Пример #1
0
    def ztestFullGenieParticulateSamples(self):
        """
test Genie Particulate samples
"""
         
        request="spectrum=CURR/QC/BK, analysis=CURR"
        
        # get full 2003-10-24 to 2003-10-26
        listOfSamplesToTest = self.getListOfSampleIDs('2007-01-04',endDate='2007-01-15',spectralQualif='FULL',nbOfElem='5')
        
        # error
        # these two are working
        #listOfSamplesToTest = [ "916900","917873" ]
               
        #transform in numbers and retransform in str to remove the 0 at the beginning of the number"
        #intifiedlist = map(int,listOfSamplesToTest)
        
        #listOfSamplesToTest = map(str,intifiedlist)
        
        TestSAMPMLCreator.c_log.info("list samples: %s"%listOfSamplesToTest)
        
        cpt = 0
        total_t0 = time.time()
        
        for sampleID in listOfSamplesToTest:
            
            TestSAMPMLCreator.c_log.info("\n********************************************************************************\n Start Test %d for SampleID %s.\n********************************************************************************\n"%(cpt,sampleID))
           
            t0 = time.time()
           
            # fetchnoble particulate
            fetcher = DBDataFetcher.getDataFetcher(self.mainConn,self.archConn,sampleID)
            
            fetcher.fetch(request,'PAR')
                 
            renderer = GenieParticulateRenderer(fetcher)
   
            xmlStr = renderer.asXmlStr(request)
           
            path = "/tmp/samples/sampml-full-%s.xml"%(sampleID)
   
            ctbto.common.xml_utils.pretty_print_xml(StringIO.StringIO(xmlStr),path)
           
            # check if no tags are left
            self.assertIfNoTagsLeft(path)
           
            self.assertAllCalibrationInfo(path)
           
            t1 = time.time()
           
            TestSAMPMLCreator.c_log.info("\n********************************************************************************\n End of Test %d for SampleID %s. Test executed in %s seconds.\n********************************************************************************\n"%(cpt,sampleID,(t1-t0)))
                       
            cpt +=1
        
        total_t1 = time.time()
        
        TestSAMPMLCreator.c_log.info("\n****************************************************************************\n****************************************************************************\n****** EXECUTED %d FULL SAMPLE RETRIEVALS in %s seconds ********\n****************************************************************************\n****************************************************************************\n"%(cpt,total_t1-total_t0))
Пример #2
0
    def ztestGetOneParticulateSampleAndDoBitChecking(self):
        """
get a unique particulate sample and do a bit checking against a registered existing sample
"""
        
        request="spectrum=CURR, analysis=CURR"
        cpt = 0
        total_t0 = time.time()
        
        #listOfSamplesToTest = self.getListOfSampleIDs('2008-12-24',endDate='2008-12-25',spectralQualif='FULL',nbOfElem='1')
        
        #sampleID = listOfSamplesToTest[0]
        sampleID = 967273
        
        # fetchnoble particulate
        fetcher = DBDataFetcher.getDataFetcher(self.mainConn,self.archConn,sampleID)
            
        fetcher.fetch(request,'PAR')
                 
        renderer = GenieParticulateRenderer(fetcher)
   
        xmlStr = renderer.asXmlStr(request)
           
        path = "/tmp/samples/sampml-full-%s.xml"%(sampleID)
   
        ctbto.common.xml_utils.pretty_print_xml(StringIO.StringIO(xmlStr),path)
           
        # check if no tags are left
        self.assertIfNoTagsLeft(path)
           
        self.assertAllCalibrationInfo(path)
        
        self.assertFileContentEquals("%s/samples/sampml-full-%s.xml.master"%(self._get_tests_dir_path(),sampleID),path)
                           
        cpt +=1
        
        total_t1 = time.time()
        
        TestSAMPMLCreator.c_log.info("\n****************************************************************************\n****************************************************************************\n****** EXECUTED %d FULL SAMPLE RETRIEVALS in %s seconds ********\n****************************************************************************\n****************************************************************************\n"%(cpt,total_t1-total_t0))