def testSetDataInput(self): """ This method test the setDataInput method of the Labelit plugin by providing an XML string and then retriving an XSDataInputLabelit object. """ #Create the plugin instance edPluginControlDLSArchiver = self.createPlugin() # create an object which contains the test information edStringInputPluginControlDLSArchiverv10XML = EDUtilsTest.readAndParseFile( self.m_edStringReferenceDataInputFile) # gives the data to the plugin edPluginControlDLSArchiver.setDataInput( edStringInputPluginControlDLSArchiverv10XML) # get the data from the plugin xsDataInputPluginControlDLSArchiver = edPluginControlDLSArchiver.getDataInput( ) # get the string of the path edStringPath = EDString(xsDataInputPluginControlDLSArchiver. getDropZonePath().getPath().getValue()) # create the test path edStringPathReference = EDString("../data/test/ingest/") # Actually test the data. EDAssert.equal(edStringPath, edStringPathReference) #check out that the list is getting read in properly #FIXME, add in some proper test code here print xsDataInputPluginControlDLSArchiver.getDropZonePath().getPath( ).getValue() print xsDataInputPluginControlDLSArchiver.getIgnoreList()[1].getValue()
def testSetDataInput( self ): """ This method test the setDataInput method of the SRBRegister plugin by providing an XML string and then retriving an XSDataInputLabelit object. It checks both inputs """ #Create the plugin instance edPluginExecSRBRegister = self.createPlugin() # create an object which contains the test information edStringInputExecSRBRegisterv10XML = EDUtilsTest.readAndParseFile( self.m_edStringReferenceDataInputFile ) # gives the data to the plugin edPluginExecSRBRegister.setDataInput( edStringInputExecSRBRegisterv10XML ) # get the data from the plugin xsDataInputPluginExecSRBRegister = edPluginExecSRBRegister.getDataInput() # get the string of the path edStringPath = EDString( xsDataInputPluginExecSRBRegister.getSrbDropFileName().getPath().getValue() ) # create the test path edStringPathReference = EDString( "../data/out/test2.drop" ) # Actually test the data. EDAssert.equal( edStringPathReference, edStringPath ) # test the reading of the other data edStringPath = EDString( xsDataInputPluginExecSRBRegister.getXmlIngestFileName().getPath().getValue() ) # create the test path edStringPathReference = EDString( "../data/create-ds.xml" ) # Actually test the data. EDAssert.equal( edStringPathReference, edStringPath )
def generateExecutiveSummary(self, _oedPlugin): """ Generates a summary of the execution of the plugin. """ self.DEBUG("EDPluginSTACv10Strategy.generateExecutiveSummary") self.addExecutiveSummaryLine("<!--SUMMARY_BEGIN-->") if (self.getStringVersion() is not None): self.addExecutiveSummaryLine(self.getStringVersion() + " by Sandor Brockhauser") import math self.addExecutiveSummaryLine("") #also STAC credit string self.addExecutiveSummaryLine( EDString(self.m_oxsKappaResponse.getComment())) self.addExecutiveSummaryLine( "----------------------------------------------------------------") self.addExecutiveSummaryLine( "--ID------OStart----OEnd------K--------P----#Img-----Compl%-----") oxsDataList = self.m_oxsKappaResponse.getGenerated_sweep() for oxsDataSweep in oxsDataList: self.addExecutiveSummaryLine( "%5s : %7s <-> %7s %7s %7s %4s %7s" % \ ( EDString(oxsDataSweep.getStrategyID()), \ EDString(oxsDataSweep.getOmegaStart()), EDString(oxsDataSweep.getOmegaEnd()), EDString(oxsDataSweep.getKappa()), EDString(oxsDataSweep.getPhi()), #exposure, #resolution, EDString(1+int(math.fabs(float(oxsDataSweep.getOmegaEnd())-float(oxsDataSweep.getOmegaStart())))), EDString(oxsDataSweep.getCompleteness()) ) ) self.addExecutiveSummaryLine( "----------------------------------------------------------------") self.addExecutiveSummaryLine("<!--SUMMARY_END-->")
def openXMLTree(self): """ Opens the xml file and places the tree in the object """ # get the filename to load # get the data from the plugin xsDataInputPluginExecSRBRegister = self.getDataInput() # get the string of the path xsDataInputPluginExecSRBRegister.getXmlIngestFileName().getPath( ).getValue() edFileName = EDString(xsDataInputPluginExecSRBRegister. getXmlIngestFileName().getPath().getValue()) #print '\nedFileName= ' + str( edFileName ) try: self.edTree = minidom.parse(edFileName) except Exception: # This is to make the tests pass, and it is during the postprocess step where the data is returned from the plugin. EDVerbose.DEBUG( strftime("%Y-%m-%d %H:%M:%S") + " *** EDPluginExecSRBRegisterv10.openXMLTree Failed to parse file '%s' renaming it." % edFileName) #os.rename( edFileName, edFileName + '.invalid' ) shutil.move(edFileName, edFileName + '.invalid')
def postProcess(self, _edObject=None): """ reading back and genericly process the output """ EDPluginExecProcessScript.postProcess(self) self.DEBUG("EDPluginSTACv10.postProcess") OutputData = self.fetchOutput() self.DEBUG("EDPluginSTACv10.postProcess: " + EDString(OutputData)) if (OutputData is not None): self.setDataOutput(OutputData)
def generateExecutiveSummary(self, _oedPlugin): """ Generates a summary of the execution of the plugin. """ self.DEBUG("EDPluginSTACv10Alignment.generateExecutiveSummary") self.addExecutiveSummaryLine("<!--SUMMARY_BEGIN-->") if (self.getStringVersion() is not None): self.addExecutiveSummaryLine(self.getStringVersion() + " by Sandor Brockhauser") self.addExecutiveSummaryLine("") self.addExecutiveSummaryLine( EDString(self.m_oxsKappaAlignmentResponse.getComment())) self.addExecutiveSummaryLine( "-------------------------------------------------------") self.addExecutiveSummaryLine( "--v1-----------v2------------O---------K--------P------") oxsDataKappaAlignmentList = self.m_oxsKappaAlignmentResponse.getPossible_orientation( ) for oxsDataPossible_orientation in oxsDataKappaAlignmentList: self.addExecutiveSummaryLine( "%13s %13s : %7s %7s %7s" % \ ( EDString(oxsDataPossible_orientation.getV1()), \ EDString(oxsDataPossible_orientation.getV2()), EDString(oxsDataPossible_orientation.getOmega()), EDString(oxsDataPossible_orientation.getKappa()), EDString(oxsDataPossible_orientation.getPhi()) ) ) self.addExecutiveSummaryLine( "-------------------------------------------------------") self.addExecutiveSummaryLine("<!--SUMMARY_END-->")
def testSetDataInput(self): """ This method test the setDataInput method of the Labelit plugin by providing an XML string and then retriving an XSDataInputLabelit object. """ #Create the plugin instance edPluginExecICATIngester = self.createPlugin() # create an object which contains the test information edStringInputExecICATIngesterv10XML = EDUtilsTest.readAndParseFile( self.m_edStringReferenceDataInputFile) # gives the data to the plugin edPluginExecICATIngester.setDataInput( edStringInputExecICATIngesterv10XML) # get the data from the plugin xsDataInputPluginExecICATIngester = edPluginExecICATIngester.getDataInput( ) # get the string of the path edStringPath = EDString(xsDataInputPluginExecICATIngester. getXmlIngestFileName().getPath().getValue()) # create the test path edStringPathReference = EDString("/tmp/xmlingest/") # Actualy test the data. EDAssert.equal(edStringPathReference, edStringPath)
def getFileSize(self): """ Function to compute the file size """ EDVerbose.DEBUG( strftime("%Y-%m-%d %H:%M:%S") + " *** EDPluginExecSRBRegisterv10.getFileSize...") # get the filename to load # get the data from the plugin xsDataInputPluginExecSRBRegister = self.getDataInput() # get the string of the path xsDataInputPluginExecSRBRegister.getXmlIngestFileName().getPath( ).getValue() edFileName = EDString(xsDataInputPluginExecSRBRegister. getXmlIngestFileName().getPath().getValue()) # get the size of the current file edFileStats = os.stat(edFileName) self.edXMLFileSize = edFileStats[stat.ST_SIZE]