Esempio n. 1
0
 def __init__(self, _strPluginName, _strPluginDir=None, _strTestName=None):
     """
     Initialize the test case by determining the paths to the plugin home and plugin test directories.
     """
     EDTestCase.__init__(self, _strTestName)
     self._edPlugin = None
     self._strPluginName = _strPluginName
     self._strPluginHome = EDUtilsTest.getFactoryPluginTest().getModuleLocation(_strPluginName)
     self._strPluginTestsDataHome = EDUtilsTest.getPluginTestDataDirectory(self.getClassName())
     self._listRequiredConfigurationPluginNames = []
     self._strConfigurationFile = None
    def testGenerateXSDataInputXDSIndexing(self):
        filename = "XSDataIndexingInput_reference.xml"
        path = os.path.join(self.dataPath, filename)
        xmlIndexingInput = EDUtilsTest.readAndParseFile(path)
        from XSDataMXv1 import XSDataIndexingInput
        xsDataIndexingInput = XSDataIndexingInput.parseString(xmlIndexingInput)

        from EDHandlerXSDataXDSv1_0 import EDHandlerXSDataXDSv1_0
        xsDataInputXDSIndexing = EDHandlerXSDataXDSv1_0.generateXSDataInputXDSIndexing(xsDataIndexingInput)

        referenceFilename = "XSDataInputXDSIndexing_reference.xml"
        referencePath = os.path.join(self.dataPath, referenceFilename)
        xmlInputXDSIndexingReference = EDUtilsTest.readAndParseFile(referencePath)
        EDAssert.equal(xmlInputXDSIndexingReference, xsDataInputXDSIndexing.marshal())
 def testGenerateXSDataIndexingResult(self):
     strFilename = "XSDataMOSFLMOutputIndexing_reference.xml"
     strPath = os.path.join(self.m_strDataPath, strFilename)
     strXMLMOSFLMOutputIndexing = EDUtilsTest.readAndParseFile(strPath)
     from XSDataMOSFLMv10 import XSDataMOSFLMOutputIndexing
     xsDataMOSFLMOutputIndexing = XSDataMOSFLMOutputIndexing.parseString(strXMLMOSFLMOutputIndexing)
     from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10
     xsDataIndexingResult = EDHandlerXSDataMOSFLMv10.generateXSDataIndexingResult(xsDataMOSFLMOutputIndexing)
     strReferenceFilename = "XSDataIndexingResult_reference.xml"
     strReferencePath = os.path.join(self.m_strDataPath, strReferenceFilename)
     strXMLIndexingOutputReference = EDUtilsTest.readAndParseFile(strReferencePath)
     from XSDataMXv1 import  XSDataIndexingResult
     xsdataIndexingResultReference = XSDataIndexingResult.parseString(strXMLIndexingOutputReference)
     EDAssert.equal(xsdataIndexingResultReference.marshal(), xsDataIndexingResult.marshal())
 def testGenerateXSDataMOSFLMInputIntegration(self):
     strFilename = "XSDataIntegrationInput_reference.xml"
     strPath = os.path.join(self.m_strDataPath, strFilename)
     strXMLIntegrationInput = EDUtilsTest.readAndParseFile(strPath)
     from XSDataMXv1 import XSDataIntegrationInput
     xsDataIntegrationInput = XSDataIntegrationInput.parseString(strXMLIntegrationInput)
     from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10
     xsDataMOSFLMInputIntegration = EDHandlerXSDataMOSFLMv10.generateXSDataMOSFLMInputIntegration(xsDataIntegrationInput)
     strReferenceFilename = "XSDataMOSFLMInputIntegration_reference.xml"
     strReferencePath = os.path.join(self.m_strDataPath, strReferenceFilename)
     strXMLIntegrationInputReference = EDUtilsTest.readAndParseFile(strReferencePath)
     EDFactoryPluginStatic.loadModule("XSDataMOSFLMv10")
     from XSDataMOSFLMv10 import XSDataMOSFLMInputIntegration
     xsDataMOSFLMInputIntegrationReference = XSDataMOSFLMInputIntegration.parseString(strXMLIntegrationInputReference)
     EDAssert.equal(xsDataMOSFLMInputIntegrationReference.marshal(), xsDataMOSFLMInputIntegration.marshal())
 def testGenerateXSDataResultPowderIntegration(self):
     strReferenceInputFile = os.path.join(self.m_strDataPath, "XSDataResultFIT2DCake_reference.xml")
     strXMLInput = EDUtilsTest.readAndParseFile(strReferenceInputFile)
     EDApplication.loadModule("XSDataFIT2Dv1_0")
     from XSDataFIT2Dv1_0 import XSDataResultFIT2DCake
     xsDataResultFIT2DCake = XSDataResultFIT2DCake.parseString(strXMLInput)
     from EDHandlerXSDataFIT2Dv1_0 import EDHandlerXSDataFIT2Dv1_0
     edHandlerXSDataFIT2Dv1_0 = EDHandlerXSDataFIT2Dv1_0()
     xsDataResultPowderDiffraction = edHandlerXSDataFIT2Dv1_0.getXSDataResultPowderIntegration(xsDataResultFIT2DCake)
     strReferencePath = os.path.join(self.m_strDataPath, "XSDataResultPowderIntegration_reference.xml")
     strXMLResultReference = EDUtilsTest.readAndParseFile(strReferencePath)
     EDApplication.loadModule("XSDataDiffractionCTv1")
     from XSDataDiffractionCTv1 import XSDataResultPowderIntegration
     xsDataResultPowderIntegrationReference = XSDataResultPowderIntegration.parseString(strXMLResultReference)
     EDAssert.equal(xsDataResultPowderIntegrationReference.marshal(), xsDataResultPowderDiffraction.marshal())
Esempio n. 6
0
 def testGenerateXSDataInputBestv1_2(
         self, _strFileNameXSDataInputStrategy_reference,
         _strFileNameXSDataInputBest_reference):
     """
     This method is testing the generation of the XSDataInputBest object given a XSDataIndexingStrategy object.
     """
     strReferenceInputFile = os.path.join(
         self.strDataPath, _strFileNameXSDataInputStrategy_reference)
     strPath = os.path.join(self.strDataPath, strReferenceInputFile)
     from XSDataMXv1 import XSDataInputStrategy
     xsDataInputStrategy = XSDataInputStrategy.parseFile(strPath)
     from EDHandlerXSDataBestv1_2 import EDHandlerXSDataBestv1_2
     edHandlerXSDataBestv1_2 = EDHandlerXSDataBestv1_2()
     xsDataInputBestv1_2 = edHandlerXSDataBestv1_2.getXSDataInputBest(
         xsDataInputStrategy)
     strReferencePath = os.path.join(self.strDataPath,
                                     _strFileNameXSDataInputBest_reference)
     strXMLInputBestReference = EDUtilsTest.readAndParseFile(
         strReferencePath)
     EDFactoryPluginStatic.loadModule("XSDataBestv1_2")
     from XSDataBestv1_2 import XSDataInputBest
     xsDataInputBestReference = XSDataInputBest.parseString(
         strXMLInputBestReference)
     EDAssert.equal(xsDataInputBestReference.marshal(),
                    xsDataInputBestv1_2.marshal())
Esempio n. 7
0
 def testCheckParameters(self):
     edPluginSPD = self.createPlugin()
     edStringXMLInput = EDUtilsTest.readAndParseFile(
         self.m_edStringReferenceInputFileName)
     xsDataInputSPDCake = XSDataInputSPDCake.parseString(edStringXMLInput)
     edPluginSPD.setDataInput(xsDataInputSPDCake)
     edPluginSPD.checkParameters()
 def testGenerateXSDataIndexingResult(self):
     """
     This method tests the generation of an XSDataIndexingResult object given an XSDataResultLabelit object.
     """
     strPath = os.path.join(self.strDataPath, self.strReferenceOutputFile)
     strXMLResultLabelit = EDUtilsTest.readAndParseFile(strPath)
     EDFactoryPluginStatic.loadModule("XSDataLabelitv10")
     from XSDataLabelitv10 import XSDataResultLabelit
     xsDataResultLabelit = XSDataResultLabelit.parseString(strXMLResultLabelit)
     from EDHandlerXSDataLabelitv10 import EDHandlerXSDataLabelitv10
     xsDataIndexingResult = EDHandlerXSDataLabelitv10.generateXSDataIndexingResult(xsDataResultLabelit)
     strReferencePath = os.path.join(self.strDataPath, "XSDataIndexingResult_reference.xml")
     strIndexingResultReferenceXML = EDUtilsTest.readAndParseFile(strReferencePath)
     from XSDataMXv1 import XSDataIndexingResult
     xsDataIndexingResultReference = XSDataIndexingResult.parseString(strIndexingResultReferenceXML)
     EDAssert.equal(xsDataIndexingResultReference.marshal(), xsDataIndexingResult.marshal())
Esempio n. 9
0
 def __init__(self, _strTestName=None):
     EDTestCase.__init__(self, "EDTestCaseEDConfiguration")
     strKernelDataHome = EDUtilsTest.getPluginTestDataDirectory(
         self.getClassName())
     strDataDir = "EDConfiguration"
     self.strDataPath = EDUtilsPath.mergePath(strKernelDataHome, strDataDir)
     self.strEdnaSiteOrig = EDUtilsPath.getEdnaSite()
    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 testDropFileCreation( self ):
        """
        This test will check to make sure the dropfile is created correctly and saved properly
        """
        
        try :
            os.remove("../data/out/test2.drop")
        except :
            print "nothing to delete"
        
        try :
            os.rename("../data/create-ds.xml.icat","../data/create-ds.xml")
        except :
            print "nothing to delete"          
        
        # Create the plugin instance
        edPluginExecSRBRegister = self.createPlugin()
        # Read in the data from the XML, for the big xml 
        edStringInputExecSRBRegisterv10XML  = EDUtilsTest.readAndParseFile( self.m_edStringReferenceDataInputFile )

        # gives the data to the plugin
        edPluginExecSRBRegister.setDataInput( edStringInputExecSRBRegisterv10XML )
        
        # call the method
        edPluginExecSRBRegister.createDropFile();
        
        # finalise the process
        edPluginExecSRBRegister.moveGeneratedFiles()
        
        # check that the file has been created
        EDAssert.equal(True, os.path.isfile("../data/out/test2.drop"))
        EDAssert.equal(True, os.path.isfile("../data/create-ds.xml.icat"))
    def testFileNameExtraction( self ):
        """
        This method should test to make sure that the plugin is extracting the correct file 
        list from the xml ingest file
        """
        
        try :
            os.rename("../data/create-ds.xml.icat","../data/create-ds.xml")
        except :
            print "nothing to delete"     
            
        # Create the plugin instance
        edPluginExecSRBRegister = self.createPlugin()
        # Read in the data from the XML 
        edStringInputExecSRBRegisterv10XML  = EDUtilsTest.readAndParseFile( self.m_edStringReferenceDataInputFile )

        # gives the data to the plugin
        edPluginExecSRBRegister.setDataInput( edStringInputExecSRBRegisterv10XML )
        
        edPluginExecSRBRegister.openXMLTree()
        
        edFilelist = edPluginExecSRBRegister.processFileList()
        
        # assert that the filelist is correct
        edTestlist = ["EDPluginExecSRBRegisterv10_output.xml\n"]
        
        EDAssert.equal(edFilelist,edTestlist)
 def __init__(self, _pyStrTestName=None):
     EDTestCase.__init__(self, _pyStrTestName)
     strKernelDataHome = EDUtilsTest.getPluginTestDataDirectory(self.getClassName())
     strDataDir = "EDHandlerRaddosev10"
     self.strDataPath = EDUtilsPath.mergePath(strKernelDataHome, strDataDir)
     self.strReferenceInputFile2 = EDUtilsPath.mergePath(self.strDataPath, "XSDataRaddosev10Input_reference_02.xml")
     self.strObtainedInputFile2 = "XSDataInputRaddosev10FromObject_02.xml"
Esempio n. 14
0
 def __init__(self, _pyStrTestName=None):
     """
     """
     EDTestCase.__init__(self, _pyStrTestName)
     pyStrMXv1DataHome = EDUtilsTest.getPluginTestDataDirectory(self.getClassName())
     pyStrDataDir = "EDHandlerXDSv1_0"
     self.m_pyStrDataPath = os.path.join(pyStrMXv1DataHome, pyStrDataDir)
Esempio n. 15
0
 def addTestCaseFromName(self, _strTestCaseName):
     """
     This method adds a test case give it's name to the test suite. If the test case
     cannot be loaded an error message is issued and it's name is added to the list of not
     executed test cases.
     @return: NumberTestCaseFailure
     @rtype: integer 
     """
     edTestCase = None
     exceptionObject = None
     try:
         edTestCase = EDUtilsTest.getFactoryPluginTest().loadPlugin(
             _strTestCaseName)
     except ImportError as exceptionObject:
         strWarningMessage = "Could not create the test case: %s, reason: %s" % (
             _strTestCaseName, exceptionObject)
         EDVerbose.WARNING(strWarningMessage)
         self.__dictTestCaseNotExecuted[_strTestCaseName] = "%s : %s" % (
             self.getClassName(), strWarningMessage)
     if edTestCase is None:
         if exceptionObject is None:
             EDVerbose.error(
                 "EDTestSuite.addTestCaseFromName: Could not create the test case: "
                 + _strTestCaseName)
             self.__dictTestCaseNotExecuted[
                 _strTestCaseName] = "%s : Could not create the test case" % self.getClassName(
                 )
     else:
         edTestCase.setTestSuiteName(self.getClassName())
         self.__listTestCase.append(edTestCase)
 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 testSpatialDistortion(self):
        strRefX = "spline-3-18x.edf"
        strRefY = "spline-3-18y.edf"
        self.loadTestImage([strRefX, strRefY])
        edPluginSPD = self.createPlugin()
        strXMLInput = EDUtilsTest.readAndParseFile(self.strReferenceInputFileName)
        xsDataInputSPDCake = XSDataInputSPDCake.parseString(strXMLInput)
        edPluginSPD.setDataInput(xsDataInputSPDCake)
        edPluginSPD.configure()
        edPluginSPD.getInputParameter()
        ########################################################################
        # Enforce some values
        ########################################################################
        edPluginSPD.dictGeometry["SpatialDistortionFile"] = os.path.join(self.getPluginTestsDataHome(), "frelon_spline_file_to_correct_SPD.spline")
        edPluginSPD.dictGeometry["TiltRotation"] = 18
        edPluginSPD.dictGeometry["AngleOfTilt"] = 3
        spline = Spline()
        spline.read(edPluginSPD.dictGeometry["SpatialDistortionFile"])
        edPluginSPD.dictGeometry["PixelSizeX"], edPluginSPD.dictGeometry["PixelSizeY"] = spline.getPixelSize()
        edPluginSPD.createDisplacementMatrix(spline)
        edPluginSPD.cleanDispMat(edPluginSPD.getWorkingDirectory())

        refX = fabio.openimage.openimage(os.path.join(self.getTestsDataImagesHome(), strRefX)).data
        obtX = fabio.openimage.openimage(os.path.join(edPluginSPD.getWorkingDirectory(), "frelon_spline_file_to_correct_SPD-tilted-x.edf")).data
        refY = fabio.openimage.openimage(os.path.join(self.getTestsDataImagesHome(), strRefY)).data
        obtY = fabio.openimage.openimage(os.path.join(edPluginSPD.getWorkingDirectory(), "frelon_spline_file_to_correct_SPD-tilted-y.edf")).data

#        print edPluginSPD.dictGeometry
        EDAssert.arraySimilar(obtX, refX , _fAbsMaxDelta=0.1, _strComment="X displacement Matrix is the same")
        EDAssert.arraySimilar(obtY, refY , _fAbsMaxDelta=0.1, _strComment="Y displacement Matrix is the same")
 def __init__(self, _strTestName=None):
     EDTestCase.__init__(self, _strTestName)
     strMXv1DataHome = EDUtilsTest.getPluginTestDataDirectory(self.getClassName())
     strDataDir = "EDHandlerBestv1_2"
     self.strDataPath = os.path.join(strMXv1DataHome, strDataDir)
     self.strReferenceInputFile = os.path.join(self.strDataPath, "XSDataInputStrategy_reference.xml")
     self.strReferenceOutputFile = os.path.join(self.strDataPath, "XSDataResultBestv1_2_reference.xml")
 def testGenerateXSDataInputLabelit(self, _strFileNameXSDataIndexingInput_reference,
                                           _strFileNameXSDataLabelitInput_reference):
     """
     This method is testing the generation of the XSDataInputLabelit object given a XSDataIndexingInput object.
     """
     strPath = os.path.join(self.strDataPath, _strFileNameXSDataIndexingInput_reference)
     strXMLIndexingInput = EDUtilsTest.readAndParseFile(strPath)
     from XSDataMXv1 import XSDataIndexingInput
     xsDataIndexingInput = XSDataIndexingInput.parseString(strXMLIndexingInput)
     from EDHandlerXSDataLabelitv10 import EDHandlerXSDataLabelitv10
     xsDataInputLabelit = EDHandlerXSDataLabelitv10.generateXSDataInputLabelit(xsDataIndexingInput)
     strReferencePath = os.path.join(self.strDataPath, _strFileNameXSDataLabelitInput_reference)
     strXMLInputLabelitReference = EDUtilsTest.readAndParseFile(strReferencePath)
     EDFactoryPluginStatic.loadModule("XSDataLabelitv10")
     from XSDataLabelitv10 import XSDataInputLabelit
     xsDataInputLabelitReference = XSDataInputLabelit.parseString(strXMLInputLabelitReference)
     EDAssert.equal(xsDataInputLabelitReference.marshal(), xsDataInputLabelit.marshal())
Esempio n. 20
0
 def __init__(self, _pyStrTestName=None):
     """
     """
     EDTestCase.__init__(self, _pyStrTestName)
     pyStrMXv1DataHome = EDUtilsTest.getPluginTestDataDirectory(
         self.getClassName())
     pyStrDataDir = "EDHandlerXDSv1_0"
     self.m_pyStrDataPath = os.path.join(pyStrMXv1DataHome, pyStrDataDir)
    def testGenerateXSDataInputXDSIndexing(self):
        filename = "XSDataIndexingInput_reference.xml"
        path = os.path.join(self.dataPath, filename)
        xmlIndexingInput = EDUtilsTest.readAndParseFile(path)
        from XSDataMXv1 import XSDataIndexingInput
        xsDataIndexingInput = XSDataIndexingInput.parseString(xmlIndexingInput)

        from EDHandlerXSDataXDSv1_0 import EDHandlerXSDataXDSv1_0
        xsDataInputXDSIndexing = EDHandlerXSDataXDSv1_0.generateXSDataInputXDSIndexing(
            xsDataIndexingInput)

        referenceFilename = "XSDataInputXDSIndexing_reference.xml"
        referencePath = os.path.join(self.dataPath, referenceFilename)
        xmlInputXDSIndexingReference = EDUtilsTest.readAndParseFile(
            referencePath)
        EDAssert.equal(xmlInputXDSIndexingReference,
                       xsDataInputXDSIndexing.marshal())
Esempio n. 22
0
    def processKernel(self):
        """
        Executes the test case.
        """
        EDVerbose.DEBUG("EDTestCase.processKernel")
        EDVerbose.screen()
        EDVerbose.unitTest(
            "==================================================================="
        )
        if self.getTestSuiteName() is not None:
            EDVerbose.unitTest("TEST SUITE : %s" % self.getTestSuiteName())
        EDVerbose.unitTest("TEST CASE  : %s" % self.getClassName())
        EDVerbose.unitTest(" ")
        if self.__strReasonForNotBeingExecuted == "":
            self.setTimeInit()
            iNumberMethods = self.getNumberOfTests()
            EDVerbose.unitTest("Total number of tests : %d" % iNumberMethods)
            EDVerbose.unitTest()
            iTestCaseNumber = 0
            if self.getListTest() == []:
                self.__strReasonForNotBeingExecuted = "No test methods!"
            else:
                for pyTestMethod in self.getListTest():
                    iTestCaseNumber = iTestCaseNumber + 1
                    strMethodName = EDUtilsTest.patchMethodName(pyTestMethod)
                    EDVerbose.unitTest(
                        "-------------------------------------------------------------------"
                    )
                    EDVerbose.unitTest("Test case method : %s" % strMethodName)
                    EDVerbose.unitTest()
                    try:
                        pyTestMethod()
                        self.__iNumberTestMethodSuccess += 1
                        EDVerbose.unitTest("%s executed with SUCCESS" %
                                           strMethodName)
                        EDVerbose.unitTest()

                    except AssertionError as pyException:
                        self.__dictMethodFailureMessages[strMethodName] = str(
                            pyException)
                        self.__iNumberTestMethodFailure += 1
                        EDVerbose.unitTest("Assertion Error Raised!")
                        EDVerbose.unitTest("%s executed with FAILURE" %
                                           strMethodName)
                        EDVerbose.unitTest()

                    except Exception as pyException:
                        self.__dictMethodFailureMessages[strMethodName] = str(
                            pyException)
                        self.__iNumberTestMethodFailure += 1
                        EDVerbose.unitTest("Unexpected Error!")
                        EDVerbose.unitTest("%s executed with FAILURE" %
                                           strMethodName)
                        EDVerbose.unitTest()
                        EDVerbose.writeErrorTrace()
                        EDVerbose.unitTest()
                self.__bIsExecuted = True
                self.setTimeEnd()
Esempio n. 23
0
 def getTestsDataImagesHome(self):
     """
     Returns the Test data home directory
     @return: TestsDataImagesHome
     @rtype: string
     """
     if (self.__strTestsDataImagesHome is None):
         self.__strTestsDataImagesHome = EDUtilsTest.getTestsDataImagesHome()
     return self.__strTestsDataImagesHome
 def testCleanDispMat(self):
     edPluginSPD = self.createPlugin()
     strXMLInput = EDUtilsTest.readAndParseFile(self.strReferenceInputFileName)
     xsDataInputSPDCake = XSDataInputSPDCake.parseString(strXMLInput)
     edPluginSPD.setDataInput(xsDataInputSPDCake)
     if EDVerbose.isVerboseDebug():
          edPluginSPD.cleanDispMat(edPluginSPD.getWorkingDirectory())
     else:
         edPluginSPD.cleanDispMat()
 def __init__(self, _pyStrTestName=None):
     EDTestCase.__init__(self, _pyStrTestName)
     strKernelDataHome = EDUtilsTest.getPluginTestDataDirectory(
         self.getClassName())
     strDataDir = "EDHandlerRaddosev10"
     self.strDataPath = EDUtilsPath.mergePath(strKernelDataHome, strDataDir)
     self.strReferenceInputFile2 = EDUtilsPath.mergePath(
         self.strDataPath, "XSDataRaddosev10Input_reference_02.xml")
     self.strObtainedInputFile2 = "XSDataInputRaddosev10FromObject_02.xml"
 def __init__(self, _strTestName=None):
     EDTestCase.__init__(self, "EDTestCaseEDUtilsTable")
     self.__edConfiguration = None
     strKernelDataHome = EDUtilsTest.getPluginTestDataDirectory(self.getClassName())
     strDataDir = "EDUtilsTable"
     self.__strDataPath = os.path.join(strKernelDataHome, strDataDir)
     self.__strFileName = "EDPluginBestv01_dnaTables.xml"
     self.__strFilePath = os.path.join(self.__strDataPath, self.__strFileName)
     self.__strFileName2 = "EDPluginBestv01_dnaTables2.xml"
     self.__strFilePath2 = os.path.join(self.__strDataPath, self.__strFileName2)
Esempio n. 27
0
 def __init__(self, _strPluginName, _strPluginDir=None, _strTestName=None):
     """
     Initialize the test case by determining the paths to the plugin home and plugin test directories.
     """
     EDTestCase.__init__(self, _strTestName)
     self.__strPluginName = _strPluginName
     self.__strTestsDataDir = None
     self.__strPluginTestsDataDir = None
     self.__strPluginHome = EDUtilsTest.getFactoryPluginTest().getModuleLocation(_strPluginName)
     self.__strPluginTestsDataHome = EDUtilsTest.getPluginTestDataDirectory(self.getClassName())
     self.__listRequiredConfigurationPluginNames = []
     self.__strConfigurationFile = None
     self.__dictConfigurations = {} #key=pluginName ; value=config
     self.dictReplace = {"${EDNA_TESTS_DATA_HOME}": EDUtilsTest.getTestsDataHome(),
                    "${EDNA_PLUGIN_TESTS_DATA_HOME}" : self.getPluginTestsDataHome(),
                    "${EDNA_HOME}": EDUtilsPath.getEdnaHome(),
                    "${USER}":  os.getenv("USER", "UndefindedUser"),
                    "${TMPDIR}": os.getenv("TMPDIR", tempfile.gettempdir()),
                     }
Esempio n. 28
0
 def __init__(self, _strTestName=None):
     EDTestCase.__init__(self, _strTestName)
     strMXv1DataHome = EDUtilsTest.getPluginTestDataDirectory(
         self.getClassName())
     strDataDir = "EDHandlerBestv1_2"
     self.strDataPath = os.path.join(strMXv1DataHome, strDataDir)
     self.strReferenceInputFile = os.path.join(
         self.strDataPath, "XSDataInputStrategy_reference.xml")
     self.strReferenceOutputFile = os.path.join(
         self.strDataPath, "XSDataResultBestv1_2_reference.xml")
Esempio n. 29
0
 def __init__(self, _strTestName=None):
     EDTestCase.__init__(self, _strTestName)
     strDiffractionCTv1DataHome = EDUtilsTest.getPluginTestDataDirectory(
         self.getClassName())
     strDataDir = "EDHandlerFIT2Dv1_0"
     self.m_strDataPath = os.path.abspath(
         os.path.join(strDiffractionCTv1DataHome, strDataDir))
     self.m_strReferenceOutputFile = os.path.abspath(
         os.path.join(self.m_strDataPath,
                      "XSDataResultFIT2DCake_reference.xml"))
Esempio n. 30
0
 def __init__(self, _pyStrTestName=None):
     EDTestCase.__init__(self, _pyStrTestName)
     strMXv1DataHome = EDUtilsTest.getPluginTestDataDirectory(self.getClassName())
     strDataDir = "EDHandlerISPyBv1_3"
     self.strDataPath = os.path.join(strMXv1DataHome, strDataDir)
     self.dictReplace = {"${EDNA_TESTIMAGES}": EDUtilsPath.EDNA_TESTIMAGES,
                    "${EDNA_HOME}": EDUtilsPath.getEdnaHome(),
                    "${USER}":  os.getenv("USER", "UndefindedUser"),
                    "${TMPDIR}": os.getenv("TMPDIR", tempfile.gettempdir()),
                     }
Esempio n. 31
0
 def testGenerateXSDataResultPowderIntegration(self):
     strReferenceInputFile = os.path.join(
         self.m_strDataPath, "XSDataResultFIT2DCake_reference.xml")
     strXMLInput = EDUtilsTest.readAndParseFile(strReferenceInputFile)
     EDApplication.loadModule("XSDataFIT2Dv1_0")
     from XSDataFIT2Dv1_0 import XSDataResultFIT2DCake
     xsDataResultFIT2DCake = XSDataResultFIT2DCake.parseString(strXMLInput)
     from EDHandlerXSDataFIT2Dv1_0 import EDHandlerXSDataFIT2Dv1_0
     edHandlerXSDataFIT2Dv1_0 = EDHandlerXSDataFIT2Dv1_0()
     xsDataResultPowderDiffraction = edHandlerXSDataFIT2Dv1_0.getXSDataResultPowderIntegration(
         xsDataResultFIT2DCake)
     strReferencePath = os.path.join(
         self.m_strDataPath, "XSDataResultPowderIntegration_reference.xml")
     strXMLResultReference = EDUtilsTest.readAndParseFile(strReferencePath)
     EDApplication.loadModule("XSDataDiffractionCTv1")
     from XSDataDiffractionCTv1 import XSDataResultPowderIntegration
     xsDataResultPowderIntegrationReference = XSDataResultPowderIntegration.parseString(
         strXMLResultReference)
     EDAssert.equal(xsDataResultPowderIntegrationReference.marshal(),
                    xsDataResultPowderDiffraction.marshal())
Esempio n. 32
0
 def testGenerateXSDataIndexingResult(self):
     strFilename = "XSDataMOSFLMOutputIndexing_reference.xml"
     strPath = os.path.join(self.m_strDataPath, strFilename)
     strXMLMOSFLMOutputIndexing = EDUtilsTest.readAndParseFile(strPath)
     from XSDataMOSFLMv10 import XSDataMOSFLMOutputIndexing
     xsDataMOSFLMOutputIndexing = XSDataMOSFLMOutputIndexing.parseString(
         strXMLMOSFLMOutputIndexing)
     from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10
     xsDataIndexingResult = EDHandlerXSDataMOSFLMv10.generateXSDataIndexingResult(
         xsDataMOSFLMOutputIndexing)
     strReferenceFilename = "XSDataIndexingResult_reference.xml"
     strReferencePath = os.path.join(self.m_strDataPath,
                                     strReferenceFilename)
     strXMLIndexingOutputReference = EDUtilsTest.readAndParseFile(
         strReferencePath)
     from XSDataMXv1 import XSDataIndexingResult
     xsdataIndexingResultReference = XSDataIndexingResult.parseString(
         strXMLIndexingOutputReference)
     EDAssert.equal(xsdataIndexingResultReference.marshal(),
                    xsDataIndexingResult.marshal())
Esempio n. 33
0
 def testGenerateXSDataMOSFLMInputIntegration(self):
     strFilename = "XSDataIntegrationInput_reference.xml"
     strPath = os.path.join(self.m_strDataPath, strFilename)
     strXMLIntegrationInput = EDUtilsTest.readAndParseFile(strPath)
     from XSDataMXv1 import XSDataIntegrationInput
     xsDataIntegrationInput = XSDataIntegrationInput.parseString(
         strXMLIntegrationInput)
     from EDHandlerXSDataMOSFLMv10 import EDHandlerXSDataMOSFLMv10
     xsDataMOSFLMInputIntegration = EDHandlerXSDataMOSFLMv10.generateXSDataMOSFLMInputIntegration(
         xsDataIntegrationInput)
     strReferenceFilename = "XSDataMOSFLMInputIntegration_reference.xml"
     strReferencePath = os.path.join(self.m_strDataPath,
                                     strReferenceFilename)
     strXMLIntegrationInputReference = EDUtilsTest.readAndParseFile(
         strReferencePath)
     EDFactoryPluginStatic.loadModule("XSDataMOSFLMv10")
     from XSDataMOSFLMv10 import XSDataMOSFLMInputIntegration
     xsDataMOSFLMInputIntegrationReference = XSDataMOSFLMInputIntegration.parseString(
         strXMLIntegrationInputReference)
     EDAssert.equal(xsDataMOSFLMInputIntegrationReference.marshal(),
                    xsDataMOSFLMInputIntegration.marshal())
Esempio n. 34
0
 def __init__(self, _strTestName=None):
     EDTestCase.__init__(self, "EDTestCaseEDUtilsTable")
     self.__edConfiguration = None
     strKernelDataHome = EDUtilsTest.getPluginTestDataDirectory(
         self.getClassName())
     strDataDir = "EDUtilsTable"
     self.__strDataPath = os.path.join(strKernelDataHome, strDataDir)
     self.__strFileName = "EDPluginBestv01_dnaTables.xml"
     self.__strFilePath = os.path.join(self.__strDataPath,
                                       self.__strFileName)
     self.__strFileName2 = "EDPluginBestv01_dnaTables2.xml"
     self.__strFilePath2 = os.path.join(self.__strDataPath,
                                        self.__strFileName2)
 def __init__(self, _edStringTestName=None):
     EDTestCasePluginUnit.__init__(self, "EDPluginControlID11v1_0")
     self.dictID11Reference = {
         "1 DEGREE AZ": "NO",
         "ANGLE OF TILT": "-0.63004673688",
         "AZIMUTH BINS": "36",
         "CONSERVE INT.": "NO",
         "DARK CURRENT": "YES",
         "DC FILE": os.path.join(EDUtilsTest.getTestsDataImagesHome(), "ID11-Dark.edf"),
         "DIM1_DATA": "2048",
         "DIM2_DATA": "2048",
         "DISTANCE": "136.908",
         "END AZIMUTH": "360",
         "FF FILE": os.path.join(EDUtilsTest.getTestsDataImagesHome(), "ID11-Flat.edf"),
         "FF MULTIPLIER": "1000.000",
         "FF SCALE": "NO",
         "FLAT-FIELD": "YES",
         "GEOMETRY COR.": "YES",
         "INNER RADIUS": "5",
         "MASK FILE": "None",
         "OUTER RADIUS": "1000",
         "POLARISATION": "YES",
         "RADIAL BINS": "20",
         "SCAN TYPE": "2-THETA",
         "SD FILE": os.path.join(EDUtilsTest.getTestsDataImagesHome(), "ID11-Frelon.spline"),
         "SPATIAL DIS.": "YES",
         "START AZIMUTH": "0.0",
         "TILT ROTATION": "-2.51342948328",
         "USE MASK": "NO",
         "WAVELENGTH": "0.2952",
         "X-BEAM CENTRE": "1002.509",
         "X-PIXEL SIZE": "50",
         "Y-BEAM CENTRE": "999.6282",
         "Y-PIXEL SIZE": "50",
         "input_extn": "edf",
         "output_extn": "spr",
         "saving_format": "SPREAD SHEET",
         "output_dir": "/tmp/edna-" + os.environ["USER"],
     }
Esempio n. 36
0
    def processKernel(self):
        """
        Executes the test case.
        """
        EDVerbose.DEBUG("EDTestCase.processKernel")
        EDVerbose.screen()
        EDVerbose.unitTest("===================================================================")
        if self.getTestSuiteName() is not None:
            EDVerbose.unitTest("TEST SUITE : %s" % self.getTestSuiteName())
        EDVerbose.unitTest("TEST CASE  : %s" % self.getClassName())
        EDVerbose.unitTest(" ")
        if self.__strReasonForNotBeingExecuted == "":
            self.setTimeInit()
            iNumberMethods = self.getNumberOfTests()
            EDVerbose.unitTest("Total number of tests : %d" % iNumberMethods)
            EDVerbose.unitTest()
            iTestCaseNumber = 0
            if self.getListTest() == []:
                self.__strReasonForNotBeingExecuted = "No test methods!"
            else:
                for pyTestMethod in self.getListTest():
                    iTestCaseNumber = iTestCaseNumber + 1
                    strMethodName = EDUtilsTest.patchMethodName(pyTestMethod)
                    EDVerbose.unitTest("-------------------------------------------------------------------")
                    EDVerbose.unitTest("Test case method : %s" % strMethodName)
                    EDVerbose.unitTest()
                    try:
                        pyTestMethod()
                        self.__iNumberTestMethodSuccess += 1
                        EDVerbose.unitTest("%s executed with SUCCESS" % strMethodName)
                        EDVerbose.unitTest()

                    except AssertionError, pyException:
                        self.__dictMethodFailureMessages[strMethodName] = str(pyException)
                        self.__iNumberTestMethodFailure += 1
                        EDVerbose.unitTest("Assertion Error Raised!")
                        EDVerbose.unitTest("%s executed with FAILURE" % strMethodName)
                        EDVerbose.unitTest()

                    except Exception, pyException:
                        self.__dictMethodFailureMessages[strMethodName] = str(pyException)
                        self.__iNumberTestMethodFailure += 1
                        EDVerbose.unitTest("Unexpected Error!")
                        EDVerbose.unitTest("%s executed with FAILURE" % strMethodName)
                        EDVerbose.unitTest()
                        EDVerbose.writeErrorTrace()
                        EDVerbose.unitTest()
                self.__bIsExecuted = True
                self.setTimeEnd()
Esempio n. 37
0
 def addTestCaseFromName(self, _strTestCaseName):
     """
     This method adds a test case give it's name to the test suite. If the test case
     cannot be loaded an error message is issued and it's name is added to the list of not
     executed test cases.
     @return: NumberTestCaseFailure
     @rtype: integer 
     """
     edTestCase = None
     exceptionObject = None
     try:
         edTestCase = EDUtilsTest.getFactoryPluginTest().loadPlugin(_strTestCaseName)
     except exceptions.ImportError, exceptionObject:
         strWarningMessage = "Could not create the test case: %s, reason: %s" % (_strTestCaseName, exceptionObject)
         EDVerbose.WARNING(strWarningMessage)
         self.__dictTestCaseNotExecuted[_strTestCaseName] = "%s : %s" % (self.getClassName(), strWarningMessage)
 def testIgnoreFile(self):
     
     # Create the plugin instance
     edPluginExecSRBRegister = self.createPlugin()
     # Read in the data from the XML, for the big xml 
     edStringInputExecSRBRegisterv10XML  = EDUtilsTest.readAndParseFile( self.m_edStringReferenceDataInputFile3)
     
     # gives the data to the plugin
     edPluginExecSRBRegister.setDataInput( edStringInputExecSRBRegisterv10XML )
     
     # first load the tree
     edPluginExecSRBRegister.openXMLTree()
     
     edPluginExecSRBRegister.checkAgainstIgnoreList()
     
     EDAssert.equal(False,edPluginExecSRBRegister.forArchiving)
Esempio n. 39
0
 def parseParameterFiles(self, _strPath):
     """
     parses Configuration file
     """
     self.DEBUG("EDPluginControlID11v1_0.parseParameterFiles")
     self.__dictID11 = {}
     dictSub = {"${TEST_DATA_IMAGES_HOME}": EDUtilsTest.getTestsDataImagesHome()}
     for linefile in EDUtilsFile.readFileAndParseVariables(_strPath, dictSub).split("\n"):
         strLineData = linefile.strip()
         #discard comment lines 
         if not strLineData.startswith('#') :
             #  discard end line carriage return
             splited = strLineData.split("=", 1)
             if len(splited) == 2:
                 self.__dictID11[splited[0].strip()] = splited[1].strip()
     return self.__dictID11
 def testGenerateXSDataInputBestv1_2(self, _strFileNameXSDataInputStrategy_reference, _strFileNameXSDataInputBest_reference):
     """
     This method is testing the generation of the XSDataInputBest object given a XSDataIndexingStrategy object.
     """
     strReferenceInputFile = os.path.join(self.strDataPath, _strFileNameXSDataInputStrategy_reference)
     strPath = os.path.join(self.strDataPath, strReferenceInputFile)
     from XSDataMXv1 import XSDataInputStrategy
     xsDataInputStrategy = XSDataInputStrategy.parseFile(strPath)
     from EDHandlerXSDataBestv1_2 import EDHandlerXSDataBestv1_2
     edHandlerXSDataBestv1_2 = EDHandlerXSDataBestv1_2()
     xsDataInputBestv1_2 = edHandlerXSDataBestv1_2.getXSDataInputBest(xsDataInputStrategy)
     strReferencePath = os.path.join(self.strDataPath, _strFileNameXSDataInputBest_reference)
     strXMLInputBestReference = EDUtilsTest.readAndParseFile(strReferencePath)
     EDFactoryPluginStatic.loadModule("XSDataBestv1_2")
     from XSDataBestv1_2 import XSDataInputBest
     xsDataInputBestReference = XSDataInputBest.parseString(strXMLInputBestReference)
     EDAssert.equal(xsDataInputBestReference.marshal(), xsDataInputBestv1_2.marshal())
 def testGenerateSPDCommand(self):
     edPluginSPD = self.createPlugin()
     strXMLInput = EDUtilsTest.readAndParseFile(self.strReferenceInputFileName)
     xsDataInputSPDCake = XSDataInputSPDCake.parseString(strXMLInput)
     edPluginSPD.setDataInput(xsDataInputSPDCake)
     edPluginSPD.configure()
     edPluginSPD.getInputParameter()
     #edPluginSPD.preProcess()
     edPluginSPD.generateSPDCommand()
     EDVerbose.screen("SPD configuration:\n%s" % edPluginSPD.getSPDConfig())
     if EDVerbose.isVerboseDebug():
         expected = """off_1=0 off_2=0 verbose=2 src_ext=.edf cor_ext=.cor wvl=1.000000e-10 cen_1=1.050000e+03 cen_2=1.000000e+03 dis=1.000000e-01 pix_1=4.722440e-05 pix_2=4.683150e-05 do_distortion=0 do_dark=0"""
         #"do_distortion=2 off_1=0 off_2=0  verbose=2 src_ext=.edf cor_ext=.cor wvl=1.000000e-10 cen_1=1.050000e+03 cen_2=1.000000e+03 dis=1.000000e-01 pix_1=4.722440e-05 pix_2=4.683150e-05 do_dark=0"
     else:
         expected = """off_1=0 off_2=0 verbose=0 src_ext=.edf cor_ext=.cor wvl=1.000000e-10 cen_1=1.050000e+03 cen_2=1.000000e+03 dis=1.000000e-01 pix_1=4.722440e-05 pix_2=4.683150e-05 do_distortion=0 do_dark=0"""
         #do_distortion=2 off_1=0 off_2=0  verbose=0 src_ext=.edf cor_ext=.cor wvl=1.000000e-10 cen_1=1.050000e+03 cen_2=1.000000e+03 dis=1.000000e-01 pix_1=4.722440e-05 pix_2=4.683150e-05 do_dark=0"
     EDAssert.equal(edPluginSPD.getSPDConfig(), expected)
Esempio n. 42
0
    def testGenerateSPDCommand(self):
        edPluginSPD = self.createPlugin()
        edStringXMLInput = EDUtilsTest.readAndParseFile(self.m_edStringReferenceInputFileName)
        xsDataInputSPDCake = XSDataInputSPDCake.parseString(edStringXMLInput)
        edPluginSPD.setDataInput(xsDataInputSPDCake)
        edPluginSPD.configure()
        edPluginSPD.getInputParameter()
        #edPluginSPD.preProcess()
        edPluginSPD.generateSPDCommand()
        EDVerbose.screen("SPD configuration:\n %s" % edPluginSPD.getSPDConfig())
        if EDVerbose.isVerboseDebug():
            expected = """off_1=0 off_2=0 verbose=2 src_ext=.edf wvl=1.000000e-10 cen_1=1.050000e+03 cen_2=1.000000e+03 dis=1.000000e-01 pix_1=4.722440e-05 pix_2=4.683150e-05 do_distortion=0 do_dark=0 cor_ext=.cor azim_int=1 azim_pass=0 azim_ext=.cor azim_r_num=1489"""
#            """do_distortion=2 off_1=0 off_2=0  verbose=2 src_ext=.edf wvl=1.000000e-10 cen_1=1.050000e+03 cen_2=1.000000e+03 dis=1.000000e-01 pix_1=4.722440e-05 pix_2=4.683150e-05 do_dark=0 cor_ext=.cor azim_int=1 azim_pass=0 azim_ext=.cor azim_r_num=1489"""
        else:
            expected = """off_1=0 off_2=0 verbose=0 src_ext=.edf wvl=1.000000e-10 cen_1=1.050000e+03 cen_2=1.000000e+03 dis=1.000000e-01 pix_1=4.722440e-05 pix_2=4.683150e-05 do_distortion=0 do_dark=0 cor_ext=.cor azim_int=1 azim_pass=0 azim_ext=.cor azim_r_num=1489"""
#            """do_distortion=2 off_1=0 off_2=0  verbose=0 src_ext=.edf wvl=1.000000e-10 cen_1=1.050000e+03 cen_2=1.000000e+03 dis=1.000000e-01 pix_1=4.722440e-05 pix_2=4.683150e-05 do_dark=0 cor_ext=.cor azim_int=1 azim_pass=0 azim_ext=.cor azim_r_num=1489"""

        EDAssert.equal(edPluginSPD.getSPDConfig(), expected)
 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 )
Esempio n. 44
0
 def parseParameterFiles(self, _strPath):
     """
     parses Configuration file
     """
     self.DEBUG("EDPluginControlID11v1_0.parseParameterFiles")
     self.__dictID11 = {}
     dictSub = {
         "${TEST_DATA_IMAGES_HOME}": EDUtilsTest.getTestsDataImagesHome()
     }
     for linefile in EDUtilsFile.readFileAndParseVariables(
             _strPath, dictSub).split("\n"):
         strLineData = linefile.strip()
         #discard comment lines
         if not strLineData.startswith('#'):
             #  discard end line carriage return
             splited = strLineData.split("=", 1)
             if len(splited) == 2:
                 self.__dictID11[splited[0].strip()] = splited[1].strip()
     return self.__dictID11
 def __init__(self):
     """
     """
     EDTestCasePluginExecute.__init__(self, "EDPluginTestPluginFactory")
     strModuleLocation = EDUtilsTest.getFactoryPluginTest().getModuleLocation("EDPluginTestPluginFactory")
     strRootDirectory = EDUtilsPath.appendListOfPaths(strModuleLocation, [ "..", "tests", "data" ])
     # Default input
     self.setDataInputFile(os.path.join(strRootDirectory, "XSDataInputString_reference.xml"))
     self.setReferenceDataOutputFile(os.path.join(strRootDirectory, "XSDataResultString_reference.xml"))
     # Named input
     self.setDataInputFile(os.path.join(strRootDirectory, "XSDataInputString_reference.xml"), "value1")
     self.setReferenceDataOutputFile(os.path.join(strRootDirectory, "XSDataResultString_reference.xml"), "value1")
     # List input
     self.setDataInputFile(os.path.join(strRootDirectory, "XSDataInputString_reference.xml"), "value2")
     self.setDataInputFile(os.path.join(strRootDirectory, "XSDataInputString_reference.xml"), "value2")
     self.setDataInputFile(os.path.join(strRootDirectory, "XSDataInputString_reference.xml"), "value2")
     self.setReferenceDataOutputFile(os.path.join(strRootDirectory, "XSDataResultString_reference.xml"), "value2")
     self.setReferenceDataOutputFile(os.path.join(strRootDirectory, "XSDataResultString_reference.xml"), "value2")
     self.setReferenceDataOutputFile(os.path.join(strRootDirectory, "XSDataResultString_reference.xml"), "value2")
Esempio n. 46
0
    def preProcess(self):
        """
        PreProcess of the execution test: download an EDF file from http://www.edna-site.org
        and remove any existing output file, i.e. /tmp/diff6105.edf 
        """
        EDTestCasePluginExecute.preProcess(self)
        self.loadTestImage([ "test_region1_dark_1_0040.edf"])

        xsDataInputReference = XSDataInputExecCommandLine.parseString(self.readAndParseFile (self.getDataInputFile()))
        strInputFile = xsDataInputReference.getInputFileName().getPath().getValue()
        if not(os.path.isdir(os.path.dirname(strInputFile))):
            os.makedirs(os.path.dirname(strInputFile), int("777", 8))
        EDVerbose.DEBUG("temporary filename is :" + strInputFile)
        shutil.copy(os.path.join(EDUtilsTest.getTestsDataImagesHome(), "test_region1_dark_1_0040.edf"), strInputFile)
        strInputXML = self.readAndParseFile (self.getDataInputFile())
        xsDataInputReference = XSDataInputExecCommandLine.parseString(strInputXML)
        outputFileName = xsDataInputReference.getInputFileName().getPath().getValue() + ".gz"
        EDVerbose.DEBUG(" Output file is %s" % outputFileName)
        if os.path.isfile(outputFileName):
            EDVerbose.DEBUG(" Output file exists %s, I will remove it" % outputFileName)
            os.remove(outputFileName)
 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)
Esempio n. 48
0
 def preProcess(self):
     """
     Scans the command line.
     """
     EDVerbose.DEBUG("EDTestLauncher.preProcess")
     edCommandLine = EDCommandLine(sys.argv)
     EDVerbose.log(self.getEdCommandLine().getCommandLine())
     self.processCommandLineDebugVerboseLogFile()
     bContinue = True
     strTestName = edCommandLine.getArgument(EDTestLauncher.TEST_LABEL)
     EDVerbose.DEBUG("EDTestLauncher.preProcess: test name = %r" % strTestName)
     if (strTestName is None):
         EDVerbose.screen("ERROR - no --test argument found")
         bContinue = False
     else:
         self.__edTestCase = EDUtilsTest.getFactoryPluginTest().loadPlugin(strTestName)
     if (bContinue):
         # Determine the base directory
         if(self.getBaseDir() is None):
             self.processCommandLineBaseDirectory()
         # Create the application working directory  
         strApplicationInstanceName = strTestName + "_" + time.strftime("%Y%m%d-%H%M%S", time.localtime())
         if(self.getWorkingDir() is None):
             self.setWorkingDir(strApplicationInstanceName)
         self.createApplicationWorkingDirectory()
         # Set the name of the log file
         EDVerbose.setLogFileName(os.path.join(self.getBaseDir(), strApplicationInstanceName + ".log"))
         # The check for --quiet and --DEBUG should ideally be placed elsewhere,
         # for example in EDApplication.
         if (edCommandLine.existCommand(EDTestLauncher.QUIET_LABEL)):
             EDVerbose.setVerboseOff()
             EDVerbose.setTestOff()
         if (edCommandLine.existCommand(EDApplication.DEBUG_PARAM_LABEL_1) or \
             edCommandLine.existCommand(EDApplication.DEBUG_PARAM_LABEL_2)):
             EDVerbose.setVerboseDebugOn()
             EDVerbose.DEBUG("EDTestLauncher.preProcess: Debug mode")
Esempio n. 49
0
 def testCheckParameters(self):
     pyStrXMLInput = EDUtilsTest.readAndParseFile(self.m_pyStrReferenceInputFile)
     edPluginExecPDBSETUnitCell = self.createPlugin()
     edPluginExecPDBSETUnitCell.setDataInput(pyStrXMLInput)
     edPluginExecPDBSETUnitCell.checkParameters()
Esempio n. 50
0
 def __init__(self, _strTestName=None):
     EDTestCase.__init__(self, _strTestName)
     strMXv1DataHome = EDUtilsTest.getPluginTestDataDirectory(
         self.getClassName())
     strDataDir = "EDHandlerMOSFLMv10"
     self.m_strDataPath = os.path.join(strMXv1DataHome, strDataDir)
 def __init__(self, _testName=None):
     EDTestCase.__init__(self, _testName)
     dataHome = EDUtilsTest.getPluginTestDataDirectory(self.getClassName())
     dataDir = "EDHandlerXDSv1_0"
     self.dataPath = os.path.join(dataHome, dataDir)