def testAddConfigFile(self):
     # Tests adding a config file
     strPath = os.path.join(self.strDataPath, "XSConfiguration.xml")
     edConfiguration = EDConfiguration()
     edConfiguration.addConfigurationFile(strPath)
     # Load the config file again, this time the cache should be used
     edConfiguration.addConfigurationFile(strPath)
 def testConfigureOK(self):
     edPluginControlIndexingv10 = self.createPlugin()
     strPathToTestConfigFile = os.path.join(self.getPluginTestsDataHome(), "XSConfiguration.xml")
     edConfiguration = EDConfiguration(strPathToTestConfigFile)
     dictItem = edConfiguration.get(edPluginControlIndexingv10.getPluginName())
     edPluginControlIndexingv10.setConfig(dictItem)
     edPluginControlIndexingv10.configure()
 def preProcess(self):
     EDTestCasePluginExecuteDistlSignalStrengthThinClientv1_1.preProcess(self)
     # Load the configuration file
     xsPluginItem = self.getPluginConfiguration()
     if xsPluginItem is not None:
         strServerPort = EDConfiguration.getStringParamValue(xsPluginItem, \
             EDPluginDistlSignalStrengthThinClientv1_1.CONF_DISTL_SIGNAL_STRENGTH_SERVER_PORT)
         if strServerPort is None:
             iServerPort = EDPluginDistlSignalStrengthThinClientv1_1.DEFAULT_SERVER_PORT
         else:
             iServerPort = int(strServerPort)
         strPathToServer = EDConfiguration.getStringParamValue(xsPluginItem, \
             EDPluginDistlSignalStrengthThinClientv1_1.CONF_PATH_TO_DISTL_SIGNAL_STRENGTH_SERVER)
         if(strPathToServer == None):
             strErrorMessage = "EDPluginLabelitv1_1.configure : Configuration parameter missing: " + \
                                 "distl.mp_spotfinder_server_read_file"
             self.error(strErrorMessage)
             self.addErrorMessage(strErrorMessage)
             self.setFailure()
         # Start the server using random port
         self.subprocess = EDUtilsPlatform.Popen(shlex.split(str(EDUtilsPlatform.escape(strPathToServer + " distl.port=%d" % iServerPort))),
                                                    cwd=os.getcwd())
         self.iPID = self.subprocess.pid
         # Give the server some time to start up
         time.sleep(8)
 def testConfigureOK(self):
     edPluginStrategy = self.createPlugin()
     strPathToTestConfigFile = os.path.join(self.getPluginTestsDataHome(), "XSConfiguration_ESRF.xml")
     edConfiguration = EDConfiguration(strPathToTestConfigFile)
     dictItem = edConfiguration.get(edPluginStrategy.getPluginName())
     edPluginStrategy.setConfig(dictItem)
     edPluginStrategy.configure()
 def testExecute(self):
     """
     Runs the plugin and then compares expected output with obtained output to verify that it executed correctly. 
     """
     #self.run()
     for i in range(1):
         # We set up the plugin manually as it has to be executed many times
         edPlugin = self.createPlugin()
         edConfiguration = EDConfiguration(self.getConfigurationFile())
         edConfiguration.load()
         edPlugin.setConfiguration(
             edConfiguration.getPluginItem(
                 "EDPluginISPyBStoreImageQualityIndicatorsv1_4"))
         edPlugin.setDataInput(
             EDUtilsFile.readFileAndParseVariables(self.getDataInputFile()))
         edPlugin.executeSynchronous()
         # Check that the id extists in the results
         xsDataResult = edPlugin.getDataOutput()
         bAttributeExists = True
         if xsDataResult.getImageQualityIndicatorsId() is None:
             bAttributeExists = False
         EDAssert.equal(
             True, bAttributeExists,
             "Attribute imageQualityIndicatorsId = %d in the result" %
             xsDataResult.imageQualityIndicatorsId.value)
示例#6
0
 def testRasterConfiguration(self):
     strPathToTestConfigFile = os.path.join(self.strUnitTestDataHome,
                                            "XSConfiguration_raster.xml")
     edConfiguration = EDConfiguration(strPathToTestConfigFile)
     dictItem = edConfiguration.get(self.getPluginName())
     xsDataMOSFLMInput = XSDataMOSFLMInput()
     xsDataMOSFLMBeam = XSDataMOSFLMBeamPosition()
     xsDataMOSFLMBeam.setX(XSDataLength(1.0))
     xsDataMOSFLMBeam.setY(XSDataLength(2.0))
     xsDataMOSFLMInput.setBeam(xsDataMOSFLMBeam)
     xsDataMOSFLMDetector = XSDataMOSFLMDetector()
     xsDataMOSFLMDetector.setType(XSDataString("ADSC"))
     xsDataMOSFLMInput.setDetector(xsDataMOSFLMDetector)
     xsDataMOSFLMInput.setDirectory(XSDataString("/tmp"))
     xsDataMOSFLMInput.setTemplate(XSDataString("testdata_1_###.img"))
     xsDataMOSFLMInput.setWavelength(XSDataWavelength(1.1111))
     xsDataMOSFLMInput.setDistance(XSDataLength(222.22))
     edPluginMOSFLMv10 = self.createPlugin()
     edPluginMOSFLMv10.setScriptExecutable("cat")
     edPluginMOSFLMv10.setConfig(dictItem, _bLocal=True)
     edPluginMOSFLMv10.configure()
     edPluginMOSFLMv10.setXSDataInputClass(XSDataMOSFLMInput)
     edPluginMOSFLMv10.setDataInput(xsDataMOSFLMInput)
     edPluginMOSFLMv10.generateMOSFLMCommands()
     edListCommands = edPluginMOSFLMv10.getListCommandExecution()
     edListCommandsReference = [
         'WAVELENGTH 1.1111', 'DISTANCE 222.22', 'BEAM 1.0 2.0',
         'DETECTOR ADSC', 'DIRECTORY /tmp', 'TEMPLATE testdata_1_###.img',
         'RASTER 15 15 3 3 3'
     ]
     EDAssert.equal(edListCommandsReference, edListCommands,
                    "MOSFLM commands with ratser configured")
 def testRasterConfiguration(self):
     strPathToTestConfigFile = os.path.join(self.strUnitTestDataHome, "XSConfiguration_raster.xml")
     edConfiguration = EDConfiguration(strPathToTestConfigFile)
     edConfiguration.load()
     xsPluginItem = edConfiguration.getPluginItem("EDPluginMOSFLMv10")
     xsDataMOSFLMInput = XSDataMOSFLMInput()
     xsDataMOSFLMBeam = XSDataMOSFLMBeamPosition()
     xsDataMOSFLMBeam.setX(XSDataLength(1.0))
     xsDataMOSFLMBeam.setY(XSDataLength(2.0))
     xsDataMOSFLMInput.setBeam(xsDataMOSFLMBeam)
     xsDataMOSFLMDetector = XSDataMOSFLMDetector()
     xsDataMOSFLMDetector.setType(XSDataString("ADSC"))
     xsDataMOSFLMInput.setDetector(xsDataMOSFLMDetector)
     xsDataMOSFLMInput.setDirectory(XSDataString("/tmp"))
     xsDataMOSFLMInput.setTemplate(XSDataString("testdata_1_###.img"))
     xsDataMOSFLMInput.setWavelength(XSDataWavelength(1.1111))
     xsDataMOSFLMInput.setDistance(XSDataLength(222.22))
     edPluginMOSFLMv10 = self.createPlugin()
     edPluginMOSFLMv10.setScriptExecutable("cat")
     edPluginMOSFLMv10.setConfiguration(xsPluginItem)
     edPluginMOSFLMv10.configure()
     edPluginMOSFLMv10.setXSDataInputClass(XSDataMOSFLMInput)
     edPluginMOSFLMv10.setDataInput(xsDataMOSFLMInput)
     edPluginMOSFLMv10.generateMOSFLMCommands()
     edListCommands = edPluginMOSFLMv10.getListCommandExecution()
     edListCommandsReference = ['WAVELENGTH 1.1111', 'DISTANCE 222.22', 'BEAM 1.0 2.0', 'DETECTOR ADSC', 'DIRECTORY /tmp', 'TEMPLATE testdata_1_###.img', 'RASTER 15 15 3 3 3']
     EDAssert.equal(edListCommandsReference, edListCommands, "MOSFLM commands with ratser configured")
示例#8
0
 def testGenerateMOSFLMIntegrationCommands(self):
     strPathToTestConfigFile = os.path.join(self.strUnitTestDataHome,
                                            "XSConfiguration_unitTest.xml")
     edConfiguration = EDConfiguration(strPathToTestConfigFile)
     xsPluginItem = edConfiguration.getXSConfigurationItem(
         "EDPluginMOSFLMIntegrationv10")
     pluginIntegration = self.createPlugin()
     pluginIntegration.setScriptExecutable("cat")
     pluginIntegration.setConfiguration(xsPluginItem)
     pluginIntegration.configure()
     strXMLInputData = self.readAndParseFile(self.strReferenceDataInputFile)
     pluginIntegration.setDataInput(strXMLInputData)
     pluginIntegration.generateMOSFLMCommands()
     listCommandExecution = pluginIntegration.getListCommandExecution()
     listCommandReference = [
         'WAVELENGTH 0.934', 'DISTANCE 198.440994',
         'BEAM 102.478996 104.8862', 'DETECTOR ADSC',
         'DIRECTORY ' + self.strDataImagePath,
         'TEMPLATE ref-testscale_1_###.img', 'SYMMETRY P222',
         'MATRIX ' + pluginIntegration.getScriptBaseName() + '_matrix.mat',
         'MOSAIC 0.75', 'HKLOUT process_1_1.mtz',
         'PROCESS 1 TO 1 START 0.000000 ANGLE 1.000000', 'BEST ON', 'GO',
         'BEST OFF'
     ]
     EDAssert.equal(listCommandReference, listCommandExecution)
 def preProcess(self):
     EDTestCasePluginExecuteDistlSignalStrengthThinClientv1_1.preProcess(
         self)
     # Load the configuration file
     xsPluginItem = self.getPluginConfiguration()
     if xsPluginItem is not None:
         strServerPort = EDConfiguration.getStringParamValue(xsPluginItem, \
             EDPluginDistlSignalStrengthThinClientv1_1.CONF_DISTL_SIGNAL_STRENGTH_SERVER_PORT)
         if strServerPort is None:
             iServerPort = EDPluginDistlSignalStrengthThinClientv1_1.DEFAULT_SERVER_PORT
         else:
             iServerPort = int(strServerPort)
         strPathToServer = EDConfiguration.getStringParamValue(xsPluginItem, \
             EDPluginDistlSignalStrengthThinClientv1_1.CONF_PATH_TO_DISTL_SIGNAL_STRENGTH_SERVER)
         if (strPathToServer == None):
             strErrorMessage = "EDPluginLabelitv1_1.configure : Configuration parameter missing: " + \
                                 "distl.mp_spotfinder_server_read_file"
             self.error(strErrorMessage)
             self.addErrorMessage(strErrorMessage)
             self.setFailure()
         # Start the server using random port
         self.subprocess = EDUtilsPlatform.Popen(shlex.split(
             str(
                 EDUtilsPlatform.escape(strPathToServer +
                                        " distl.port=%d" % iServerPort))),
                                                 cwd=os.getcwd())
         self.iPID = self.subprocess.pid
         # Give the server some time to start up
         time.sleep(8)
    def configure(self):
        """
        Gets the configuration parameters (if any).
        """
        EDPluginControl.configure(self)
        EDVerbose.DEBUG("EDPluginControlCharacterisationv1_1.configure")
        pluginConfiguration = self.getConfiguration()

        if(pluginConfiguration is None):
            EDVerbose.DEBUG("No plugin configuration found for EDPluginControlCharacterisationv1_1.")
        else:
            if (self.getControlledPluginName("indexingPlugin") is not None):
                self.__strPluginIndexingName = self.getControlledPluginName("indexingPlugin")
            if (self.getControlledPluginName("integrationPlugin") is not None):
                self.__strPluginIntegrationName = self.getControlledPluginName("integrationPlugin")
            if (self.getControlledPluginName("strategyPlugin") is not None):
                self.__strPluginStrategyName = self.getControlledPluginName("strategyPlugin")
            if (self.getControlledPluginName("kappaStrategyPlugin") is not None):
                self.__strPluginKappaStrategyName = self.getControlledPluginName("kappaStrategyPlugin")
            if (self.getControlledPluginName("integrationPointlessPlugin") is not None):
                self.__strPluginIntegrationPoitlessName = self.getControlledPluginName("integrationPointlessPlugin")

            pyStrKappa = EDConfiguration.getStringParamValue(pluginConfiguration, "KAPPA")
            if(pyStrKappa == "ON"):
                self.__strPluginStrategyName = self.__strPluginKappaStrategyName

            pyStrPointless = EDConfiguration.getStringParamValue(pluginConfiguration, "POINTLESS")
            if(pyStrPointless == "ON"):
                self.__strPluginIntegrationName = self.__strPluginIntegrationPointlessName
    def configure(self):
        EDPluginControl.configure(self)
        EDVerbose.DEBUG("EDPluginControlKappaStrategyv2_0.configure")
        pluginConfiguration = self.getConfiguration()

        if pluginConfiguration != None:
            strSymopHome = EDConfiguration.getStringParamValue(
                pluginConfiguration, self.strCONF_SYMOP_HOME)
            if (strSymopHome == None):
                strWarningMessage = EDMessage.WARNING_NO_PARAM_CONFIGURATION_ITEM_FOUND_03 % (
                    'EDPluginControlKappaStrategyv2_0.configure',
                    self.strCONF_SYMOP_HOME, self.getPluginName())
                EDVerbose.warning(strWarningMessage)
                self.addWarningMessage(strWarningMessage)
            else:
                strSymopHomeNorm = os.path.normpath(strSymopHome)
                self.setSymopHome(strSymopHomeNorm)

            strSymopHome = EDConfiguration.getStringParamValue(
                pluginConfiguration, "KAPPA")
            if (strSymopHome == None or strSymopHome != "ON"):
                #self.strPluginStrategyName = "EDPluginControlStrategyv10"
                #self.strPluginStrategyName = "EDPluginControlStrategyv2_0"
                self.KappaStrategy = 0
            else:
                self.KappaStrategy = 1
    def configure(self):
        """
        Gets the dbserver parameters from the config file and stores them in class member attributes.
        """
        EDPluginExec.configure(self)
        pluginConfiguration = self.getConfiguration()

        if(pluginConfiguration == None):
            EDVerbose.DEBUG("*** EDPluginISPyBv1_2.configure: pluginConfiguration is None, using default settings")
        else:
            EDVerbose.DEBUG("*** EDPluginISPyBv1_2.configure: pluginConfiguration found, using settings from there")
            strDbserverHost = EDConfiguration.getStringParamValue(pluginConfiguration, "dbserverHost")
            if(strDbserverHost == None):
                strErrorMessage = EDMessage.ERROR_EXECUTION_03 % ("EDPluginISPyBv1_2.configure", self.getClassName(), \
                                                                     "Configuration parameter missing: dbserverHost")
                EDVerbose.error(strErrorMessage)
                self.addErrorMessage(strErrorMessage)
                raise RuntimeError, strErrorMessage
            else:
                self.setDbserverHost(strDbserverHost)

            strDbserverPort = EDConfiguration.getStringParamValue(pluginConfiguration, "dbserverPort")
            if(strDbserverPort == None):
                strErrorMessage = EDMessage.ERROR_EXECUTION_03 % ("EDPluginISPyBv1_2.configure", self.getClassName(), \
                                                                     "Configuration parameter missing: dbserverPort")
                EDVerbose.error(strErrorMessage)
                self.addErrorMessage(strErrorMessage)
                raise RuntimeError, strErrorMessage
            else:
                self.setDbserverPort(int (strDbserverPort))
示例#13
0
 def testSetXSConfigurationItem(self):
     xsPluginItem = XSPluginItem()
     xsPluginItem.name = "EDPluginTestSetConfig"
     edConfiguration = EDConfiguration()
     edConfiguration.setXSConfigurationItem(xsPluginItem)
     xsDataPluginItem = edConfiguration.getXSConfigurationItem("EDPluginTestSetConfig")
     EDAssert.equal(True, xsDataPluginItem is not None, "Obtanied set configuration")
示例#14
0
    def testSetDataModelInput(self):
        edPluginBest = self.createPlugin()
        edConfigurationGood01 = EDConfiguration(os.path.join(self.m_pyStrDataPath, "XSConfiguration.xml"))
        dictItemGood01 = edConfigurationGood01.get(self.getPluginName())
        edPluginBest.setConfig(dictItemGood01, _bLocal = True)
        edPluginBest.setScriptExecutable("cat")
        edPluginBest.configure()

        from XSDataBestv1_2 import XSDataInputBest
        xsDataInputBest = XSDataInputBest()

        from XSDataCommon import XSDataAbsorbedDoseRate
        from XSDataCommon import XSDataDouble
        from XSDataCommon import XSDataString
        from XSDataCommon import XSDataTime
        from XSDataCommon import XSDataFile
        from XSDataCommon import XSDataAngularSpeed
        from XSDataCommon import XSDataString
        from XSDataCommon import XSDataAngle
        from XSDataCommon import XSDataBoolean

        xsDataInputBest.setCrystalAbsorbedDoseRate(XSDataAbsorbedDoseRate(0.22E+06))
        xsDataInputBest.setCrystalShape(XSDataDouble(1))
        xsDataInputBest.setCrystalSusceptibility(XSDataDouble(1.5))
        xsDataInputBest.setDetectorType(XSDataString("q210-2x"))
        xsDataInputBest.setBeamExposureTime(XSDataTime(1))
        xsDataInputBest.setBeamMaxExposureTime(XSDataTime(10000))
        xsDataInputBest.setBeamMinExposureTime(XSDataTime(0.1))
        xsDataInputBest.setGoniostatMinRotationWidth(XSDataAngle(0.1))
        xsDataInputBest.setGoniostatMaxRotationSpeed(XSDataAngularSpeed(10))
        xsDataInputBest.setAimedResolution(XSDataDouble(2))
        xsDataInputBest.setAimedRedundancy(XSDataDouble(6.5))
        xsDataInputBest.setAimedCompleteness(XSDataDouble(0.9))
        xsDataInputBest.setAimedIOverSigma(XSDataDouble(3))
        xsDataInputBest.setComplexity(XSDataString("min"))
        xsDataInputBest.setAnomalousData(XSDataBoolean(False))
        fileDirectory = edPluginBest.getWorkingDirectory()

        bestFileContentDat = EDUtilsFile.readFile(os.path.join(self.m_pyStrDataPath, "bestfile.dat"))
        xsDataInputBest.setBestFileContentDat(XSDataString(bestFileContentDat))

        bestFileContentPar = EDUtilsFile.readFile(os.path.join(self.m_pyStrDataPath, "bestfile.par"))
        xsDataInputBest.setBestFileContentPar(XSDataString(bestFileContentPar))

        bestFileContentHKL = EDUtilsFile.readFile(os.path.join(self.m_pyStrDataPath, "bestfile1.hkl"))
        xsDataInputBest.addBestFileContentHKL(XSDataString(bestFileContentHKL))

        xsDataInputBest.exportToFile(self.m_edObtainedInputFile)

        pyStrExpectedInput = self.readAndParseFile (self.m_edReferenceInputFile)
        pyStrObtainedInput = self.readAndParseFile (self.m_edObtainedInputFile)

        xsDataInputExpected = XSDataInputBest.parseString(pyStrExpectedInput)
        xsDataInputObtained = XSDataInputBest.parseString(pyStrObtainedInput)

        EDAssert.equal(xsDataInputExpected.marshal(), xsDataInputObtained.marshal())
        EDUtilsFile.deleteFile(self.m_edObtainedInputFile)

        self.cleanUp(edPluginBest)
 def testConfigureOK(self):
     edPluginStrategy = self.createPlugin()
     strPathToTestConfigFile = os.path.join(self.getPluginTestsDataHome(), "XSConfiguration_ESRF.xml")
     edConfiguration = EDConfiguration(strPathToTestConfigFile)
     dictItem = edConfiguration.get(edPluginStrategy.getPluginName())
     edPluginStrategy.setConfig(dictItem)
     edPluginStrategy.configure()
     EDAssert.equal("/opt/pxsoft/ccp4-6.0.2/lib/data", edPluginStrategy.getSymopHome())
示例#16
0
 def preProcess(self, _edObject=None):
     EDPluginExecProcessScript.preProcess(self)
     self.DEBUG("EDPluginSTACv10.preProcess")
     xsPluginItem = self.getConfiguration()
     self.addListCommandPreExecution("export STACDIR=%s" % EDConfiguration.getStringParamValue(xsPluginItem, "STACDIR"))
     self.addListCommandPreExecution("export BCMDEF=%s" % EDConfiguration.getStringParamValue(xsPluginItem, "BCMDEF"))
     self.addListCommandPreExecution("export RUNDIR=%s" % self.getWorkingDirectory())
     self.setScriptCommandline("stac.core.STAC_DNA_listener %s -%s/" % (self.getSTACcommand(), self.getWorkingDirectory()))
示例#17
0
 def testGetXSConfigurationItem1(self):
     strPath = os.path.join(self.strDataPath, "XSConfiguration.xml")
     edConfiguration = EDConfiguration()
     edConfiguration.addConfigurationFile(strPath)
     xsDataPluginItem = edConfiguration.getXSConfigurationItem(
         "indexingMosflm")
     EDAssert.equal(True, xsDataPluginItem is not None,
                    "Obtanied configuration for indexingMosflm")
示例#18
0
 def testGetXSConfigurationItem2(self):
     edConfiguration = EDConfiguration()
     xsDataPluginItem1 = edConfiguration.getXSConfigurationItem("EDPluginTestPluginFactory")
     EDAssert.equal(True, xsDataPluginItem1 is not None, "Obtanied configuration for EDPluginTestPluginFactory")
     xsDataPluginItem2 = edConfiguration.getXSConfigurationItem("EDPluginTestPluginFactoryImport1")
     EDAssert.equal(True, xsDataPluginItem2 is not None, "Obtanied imported configuration for EDPluginTestPluginFactoryImport1")
     xsDataPluginItem3 = edConfiguration.getXSConfigurationItem("EDPluginTestPluginFactoryImport2")
     EDAssert.equal(True, xsDataPluginItem3 is not None, "Obtanied imported configuration for EDPluginTestPluginFactoryImport2")
 def testConfigureOK(self):
     edPluginStrategy = self.createPlugin()
     strPathToTestConfigFile = os.path.join(self.getPluginTestsDataHome(),
                                            "XSConfiguration_ESRF.xml")
     edConfiguration = EDConfiguration(strPathToTestConfigFile)
     dictItem = edConfiguration.get(edPluginStrategy.getPluginName())
     edPluginStrategy.setConfig(dictItem)
     edPluginStrategy.configure()
 def preProcess(self, _edObject=None):
     EDPluginExecProcessScript.preProcess(self)
     EDVerbose.DEBUG("EDPluginSTACv10.preProcess")
     xsPluginItem = self.getConfiguration()
     self.addListCommandPreExecution("export STACDIR=%s" % EDConfiguration.getStringParamValue(xsPluginItem, "STACDIR"))
     self.addListCommandPreExecution("export BCMDEF=%s" % EDConfiguration.getStringParamValue(xsPluginItem, "BCMDEF"))
     self.addListCommandPreExecution("export RUNDIR=%s" % self.getWorkingDirectory())
     self.setScriptCommandline("stac.core.STAC_DNA_listener %s -%s/" % (self.getSTACcommand(), self.getWorkingDirectory()))
 def testSendEmail(self):
     pluginMXCuBE = self.createPlugin()
     strPathToTestConfig = os.path.join(self.getPluginTestsDataHome(),
                                                     "XSConfiguration.xml")
     edConfiguration = EDConfiguration(strPathToTestConfig)
     edConfiguration.load()
     EDApplication.setConfiguration(edConfiguration)
     pluginMXCuBE.configure()
     pluginMXCuBE.sendEmail("EDTestCasePluginUnitControlInterfaceToMXCuBEv1_2sendEmail: Test subject", "EDTestCasePluginUnitControlInterfaceToMXCuBEv1_2sendEmail: Test message")
示例#22
0
 def testStaticEDConfiguration(self):
     # This test make sure that changing an instatiation of EDConfiguration does not change the
     # corresponding plugin configuration for EDConfigurationStatic
     strPathToTestConfigFile = os.path.join(self.strDataPath, "XSConfiguration_testNonStatic.xml")
     edConfiguration = EDConfiguration(strPathToTestConfigFile)
     strParam1 = edConfiguration.getStringValue("EDPluginTestPluginFactory", "testItemName")
     EDUtilsPath.setEdnaSite("TestStaticConfiguration") 
     strParam2 = EDConfigurationStatic.getStringValue("EDPluginTestPluginFactory", "testItemName")
     EDAssert.equal(False, strParam1 == strParam2, "Static config is not equal to local config")
 def testGetPluginListSize(self):
     """
     Testing the retrieved XSPluginList size from configuration
     """
     strPath = os.path.join(self.strDataPath, "XSConfiguration.xml")
     edConfiguration = EDConfiguration()
     edConfiguration.addConfigurationFile(strPath)
     iPluginListSize = edConfiguration.getPluginListSize()
     EDAssert.equal(1, iPluginListSize)
示例#24
0
 def testGetPluginListSize(self):
     """
     Testing the retrieved XSPluginList size from configuration
     """
     strPath = os.path.join(self.strDataPath, "XSConfiguration.xml")
     edConfiguration = EDConfiguration()
     edConfiguration.addConfigurationFile(strPath)
     iPluginListSize = edConfiguration.getPluginListSize()
     EDAssert.equal(1, iPluginListSize)
示例#25
0
 def testGetPluginItemError(self):
     """
     Testing the retrieval of an absent plugin
     """
     strPath = os.path.join(self.strDataPath, "XSConfiguration.xml")
     edConfiguration = EDConfiguration()
     edConfiguration.addConfigurationFile(strPath)
     xsPluginItem = edConfiguration.getXSConfigurationItem("toto")
     EDAssert.equal(None, xsPluginItem, "Non-existing configuration item should be None")
示例#26
0
 def testGetParamItem(self):
     """
     Testing the XSParamItem inside an XSPluginItem
     """
     strPath = os.path.join(self.strDataPath, "XSConfiguration.xml")
     edConfiguration = EDConfiguration()
     edConfiguration.addConfigurationFile(strPath)
     strValue = edConfiguration.getStringValue("indexingMosflm", "workingDir")
     EDAssert.equal("/path/to/working/dir", strValue)
示例#27
0
 def testSetXSConfigurationItem(self):
     xsPluginItem = XSPluginItem()
     xsPluginItem.name = "EDPluginTestSetConfig"
     edConfiguration = EDConfiguration()
     edConfiguration.setXSConfigurationItem(xsPluginItem)
     xsDataPluginItem = edConfiguration.getXSConfigurationItem(
         "EDPluginTestSetConfig")
     EDAssert.equal(True, xsDataPluginItem is not None,
                    "Obtanied set configuration")
 def testGetParamValue(self):
     """
     Testing the XSParamItem Value convertion from string to different formats
     """
     xsPluginItem = self.___edConfiguration.getPluginItem("indexingMosflm")
     EDAssert.equal("/path/to/working/dir", self.___edConfiguration.getStringParamValue(xsPluginItem, "workingDir"))
     EDAssert.equal("/path/to/working/dir", EDConfiguration.getStringParamValue(xsPluginItem, "workingDir"))
     EDAssert.equal(3, self.___edConfiguration.getIntegerParamValue(xsPluginItem, "number"))
     EDAssert.equal(3, EDConfiguration.getIntegerParamValue(xsPluginItem, "number"))
示例#29
0
    def preProcess(self, _edObject=None):
        EDPluginExecProcessScript.preProcess(self)
        EDVerbose.DEBUG("*** EDPluginFIT2DCakev1_0.preProcess")
        # Check that the input data and correction images are present
        xsDataInputFIT2DCake = self.getDataInput()
        pyStrPathToInputFile = xsDataInputFIT2DCake.getInputFile().getPath(
        ).getValue()
        if (not os.path.exists(pyStrPathToInputFile)):
            strErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % (
                self.getPluginName() + ".preProcess", pyStrPathToInputFile)
            EDVerbose.error(strErrorMessage)
            self.addErrorMessage(strErrorMessage)
            raise RuntimeError, strErrorMessage
        pyStrPathToDarkCurrentImageFile = xsDataInputFIT2DCake.getDarkCurrentImageFile(
        ).getPath().getValue()
        if (not os.path.exists(pyStrPathToDarkCurrentImageFile)):
            strErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % (
                self.getPluginName() + ".preProcess",
                pyStrPathToDarkCurrentImageFile)
            EDVerbose.error(strErrorMessage)
            self.addErrorMessage(strErrorMessage)
            raise RuntimeError, strErrorMessage
        pyStrPathToFlatFieldImageFile = xsDataInputFIT2DCake.getFlatFieldImageFile(
        ).getPath().getValue()
        if (not os.path.exists(pyStrPathToFlatFieldImageFile)):
            strErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % (
                self.getPluginName() + ".preProcess",
                pyStrPathToFlatFieldImageFile)
            EDVerbose.error(strErrorMessage)
            self.addErrorMessage(strErrorMessage)
            raise RuntimeError, strErrorMessage
        pyStrPathToSpatialDistortionFile = xsDataInputFIT2DCake.getSpatialDistortionFile(
        ).getPath().getValue()
        if (not os.path.exists(pyStrPathToSpatialDistortionFile)):
            strErrorMessage = EDMessage.ERROR_CANNOT_READ_FILE_02 % (
                self.getPluginName() + ".preProcess",
                pyStrPathToSpatialDistortionFile)
            EDVerbose.error(strErrorMessage)
            self.addErrorMessage(strErrorMessage)
            raise RuntimeError, strErrorMessage
        # Get path to Xvfb program
        pluginConfiguration = self.getConfiguration()
        if (pluginConfiguration is not None):
            self.m_strPathToXvfb = EDConfiguration.getStringParamValue(
                pluginConfiguration, self.m_strCONF_PATH_TO_XVFB)
            self.m_strArgumentsForXvfb = EDConfiguration.getStringParamValue(
                pluginConfiguration, self.m_strCONF_ARGUMENTS_FOR_XVFB)
        if (self.m_strPathToXvfb is None):
            strErrorMessage = EDMessage.ERROR_NO_PLUGIN_CONFIGURATION_ITEM_FOUND_02 % (
                self.getPluginName() + ".preProcess",
                self.m_strCONF_PATH_TO_XVFB)
            EDVerbose.error(strErrorMessage)
            self.addErrorMessage(strErrorMessage)
            raise RuntimeError, strErrorMessage

        self.generateFIT2DCommands()
示例#30
0
 def testGetPluginItemError(self):
     """
     Testing the retrieval of an absent plugin
     """
     strPath = os.path.join(self.strDataPath, "XSConfiguration.xml")
     edConfiguration = EDConfiguration()
     edConfiguration.addConfigurationFile(strPath)
     xsPluginItem = edConfiguration.getXSConfigurationItem("toto")
     EDAssert.equal(None, xsPluginItem,
                    "Non-existing configuration item should be None")
示例#31
0
文件: EDPlugin.py 项目: rentreg/edna
 def setConfiguration(self, _xsPluginItem):
     """
     Receives a Plugin Configuration as XSPluginItem or python dict from the application.
     """
     self.DEBUG("EDPlugin.setConfiguration")
     self.__edConfiguration = EDConfiguration()
     if isinstance(_xsPluginItem, dict):
         self.__edConfiguration[self.getPluginName()] = _xsPluginItem
     else:
         self.__edConfiguration.setXSConfigurationItem(_xsPluginItem)
示例#32
0
 def testGetParamItem(self):
     """
     Testing the XSParamItem inside an XSPluginItem
     """
     strPath = os.path.join(self.strDataPath, "XSConfiguration.xml")
     edConfiguration = EDConfiguration()
     edConfiguration.addConfigurationFile(strPath)
     strValue = edConfiguration.getStringValue("indexingMosflm",
                                               "workingDir")
     EDAssert.equal("/path/to/working/dir", strValue)
示例#33
0
 def setConfig(self, _dict, _bLocal=False):
     """
     Receives a dictionary (Plugin Configuration) from the application.
     """
     self.DEBUG("EDPlugin.setConfiguration")
     if _bLocal:
         self.__edConfiguration = EDConfiguration()
     if _dict is not None:
         self.__edConfiguration[self.getPluginName()] = _dict
     else:
         self.__edConfiguration[self.getPluginName()] = {}
 def testGetPathToProjectConfigurationFile(self):
     edConfiguration = EDConfiguration()
     strPathToConfigurationFile1 = edConfiguration.getPathToProjectConfigurationFile("EDPluginTestPluginFactory")
     strPathToConfigurationFileReference1 = EDUtilsPath.appendListOfPaths(EDUtilsPath.getEdnaHome(),
                                                                               [ "kernel", "tests", "data", "EDFactoryPlugin", \
                                                                                "testProject", "conf", "XSConfiguration_TestSite.xml" ])
     EDAssert.equal(strPathToConfigurationFileReference1, strPathToConfigurationFile1)
     EDUtilsPath.setEdnaSite("NonexistingTestSite")
     strPathToConfigurationFile2 = edConfiguration.getPathToProjectConfigurationFile("EDPluginTestPluginFactory")
     strPathToConfigurationFileReference2 = None
     EDAssert.equal(strPathToConfigurationFileReference2, strPathToConfigurationFile2)
示例#35
0
 def testSendEmail(self):
     pluginMXCuBE = self.createPlugin()
     strPathToTestConfig = os.path.join(self.getPluginTestsDataHome(),
                                        "XSConfiguration.xml")
     edConfiguration = EDConfiguration(strPathToTestConfig)
     edConfiguration.load()
     EDApplication.setConfiguration(edConfiguration)
     pluginMXCuBE.configure()
     pluginMXCuBE.sendEmail(
         "EDTestCasePluginUnitControlInterfaceToMXCuBEv1_2sendEmail: Test subject",
         "EDTestCasePluginUnitControlInterfaceToMXCuBEv1_2sendEmail: Test message"
     )
 def configure(self):
     EDPluginControl.configure(self)
     EDVerbose.DEBUG("EDPluginControlInterfaceToMXCuBEv1_2.configure")
     xsPluginItem = self.getConfiguration()
     if xsPluginItem == None:
         EDVerbose.DEBUG("EDPluginControlInterfaceToMXCuBEv1_2.configure: No plugin item defined.")
     else:
         self.__strEDNAContactEmail = EDConfiguration.getStringParamValue(xsPluginItem, EDPluginControlInterfaceToMXCuBEv1_2.__EDNA_CONTACT_EMAIL)
         EDVerbose.DEBUG("EDPluginControlInterfaceToMXCuBEv1_2.configure: EDNAContactEmail = %s" % self.__strEDNAContactEmail)
         strEDNAEmailSender = EDConfiguration.getStringParamValue(xsPluginItem, self.__EDNA_EMAIL_SENDER)
         if strEDNAEmailSender:
             self.__strEDNAEmailSender = strEDNAEmailSender
 def configure(self):
     EDPluginControl.configure(self)
     EDVerbose.DEBUG("EDPluginControlInterfaceToMXCuBEv1_2.configure")
     xsPluginItem = self.getConfiguration()
     if xsPluginItem == None:
         EDVerbose.DEBUG("EDPluginControlInterfaceToMXCuBEv1_2.configure: No plugin item defined.")
     else:
         self.__strEDNAContactEmail = EDConfiguration.getStringParamValue(xsPluginItem, EDPluginControlInterfaceToMXCuBEv1_2.__EDNA_CONTACT_EMAIL)
         EDVerbose.DEBUG("EDPluginControlInterfaceToMXCuBEv1_2.configure: EDNAContactEmail = %s" % self.__strEDNAContactEmail)
         strEDNAEmailSender = EDConfiguration.getStringParamValue(xsPluginItem, self.__EDNA_EMAIL_SENDER)
         if strEDNAEmailSender:
             self.__strEDNAEmailSender = strEDNAEmailSender
    def testUpdateChemicalCompositionWithNativeSulfurAtom(self):

        edPluginStrategy = self.createPlugin()
        strPathToTestConfigFile = os.path.join(self.getPluginTestsDataHome(),
                                               "XSConfiguration_ESRF.xml")
        edConfiguration = EDConfiguration(strPathToTestConfigFile)
        dictItem = edConfiguration.get(edPluginStrategy.getPluginName())
        edPluginStrategy.setConfig(dictItem)
        edPluginStrategy.configure()

        xsDataStructure = XSDataStructure()
        xsDataComposition = XSDataChemicalCompositionMM()
        xsDataChain = XSDataChain()
        xsDataChain.setType(XSDataString("protein"))
        xsDataChain.setNumberOfCopies(XSDataDouble(2))
        xsDataChain.setNumberOfMonomers(XSDataDouble(60))
        xsDataStructure.addChain(xsDataChain)
        xsDataComposition.setStructure(xsDataStructure)
        updatedChemicalComposition = edPluginStrategy.updateChemicalComposition(
            xsDataComposition)
        EDAssert.equal(
            3,
            updatedChemicalComposition.getStructure().getChain()
            [0].getHeavyAtoms().getAtom()[0].getNumberOf().getValue())
        EDAssert.equal(
            "S",
            updatedChemicalComposition.getStructure().getChain()
            [0].getHeavyAtoms().getAtom()[0].getSymbol().getValue())

        xsDataStructure = XSDataStructure()
        xsDataComposition = XSDataChemicalCompositionMM()
        xsDataChain = XSDataChain()
        xsDataChain.setType(XSDataString("protein"))
        xsDataChain.setNumberOfCopies(XSDataDouble(2))
        xsDataChain.setNumberOfMonomers(XSDataDouble(60))
        xsDataAtom1 = XSDataAtom()
        xsDataAtom1.setSymbol(XSDataString("Se"))
        xsDataAtom1.setNumberOf(XSDataDouble(4))
        xsDataAtomicComposition = XSDataAtomicComposition()
        xsDataAtomicComposition.addAtom(xsDataAtom1)
        xsDataChain.setHeavyAtoms(xsDataAtomicComposition)
        xsDataStructure.addChain(xsDataChain)
        xsDataComposition.setStructure(xsDataStructure)
        updatedChemicalComposition = edPluginStrategy.updateChemicalComposition(
            xsDataComposition)
        heavyAtoms = updatedChemicalComposition.getStructure().getChain(
        )[0].getHeavyAtoms().getAtom()
        for heavyAtom in heavyAtoms:
            self.unitTest(heavyAtom.getSymbol().getValue() + " : " +
                          str(heavyAtom.getNumberOf().getValue()))
            if (heavyAtom.getSymbol().getValue() == "S"):
                EDAssert.equal(3, heavyAtom.getNumberOf().getValue())
示例#39
0
 def testStaticEDConfiguration(self):
     # This test make sure that changing an instatiation of EDConfiguration does not change the
     # corresponding plugin configuration for EDConfigurationStatic
     strPathToTestConfigFile = os.path.join(
         self.strDataPath, "XSConfiguration_testNonStatic.xml")
     edConfiguration = EDConfiguration(strPathToTestConfigFile)
     strParam1 = edConfiguration.getStringValue("EDPluginTestPluginFactory",
                                                "testItemName")
     EDUtilsPath.setEdnaSite("TestStaticConfiguration")
     strParam2 = EDConfigurationStatic.getStringValue(
         "EDPluginTestPluginFactory", "testItemName")
     EDAssert.equal(False, strParam1 == strParam2,
                    "Static config is not equal to local config")
示例#40
0
 def getPluginConfiguration(self, _strConfigurationFileName):
     """
     Returns the plugin configuration from a configuration file
     """
     xsPluginItem = None
     edConfiguration = EDConfiguration(_strConfigurationFileName)
     if(edConfiguration != None):
         xsPluginItem = edConfiguration.getXSConfigurationItem(self.getPluginName())
         if(xsPluginItem == None):
             EDVerbose.warning("EDTestCasePluginUnit.getPluginConfiguration: Could not get configuration plugin item for: " + self.getPluginName())
     else:
         EDVerbose.warning("EDTestCasePluginUnit.getPluginConfiguration: Could not load Configuration: " + _strConfigurationFileName)
     return xsPluginItem
 def testGenerateMOSFLMIntegrationCommands(self):
     strPathToTestConfigFile = os.path.join(self.strUnitTestDataHome, "XSConfiguration_unitTest.xml")
     edConfiguration = EDConfiguration(strPathToTestConfigFile)
     dictItem = edConfiguration.get(self.getPluginName())
     pluginIntegration = self.createPlugin()
     pluginIntegration.setScriptExecutable("cat")
     pluginIntegration.setConfig(dictItem, _bLocal = True)
     pluginIntegration.configure()
     strXMLInputData = self.readAndParseFile (self.strReferenceDataInputFile)
     pluginIntegration.setDataInput(strXMLInputData)
     pluginIntegration.generateMOSFLMCommands()
     listCommandExecution = pluginIntegration.getListCommandExecution()
     listCommandReference = ['WAVELENGTH 0.934', 'DISTANCE 198.440994', 'BEAM 102.478996 104.8862', 'DETECTOR ADSC', 'DIRECTORY ' + self.strDataImagePath, 'TEMPLATE ref-testscale_1_###.img', 'SYMMETRY P222', 'MATRIX ' + pluginIntegration.getScriptBaseName() + '_matrix.mat', 'MOSAIC 0.75', 'HKLOUT process_1_1.mtz', 'PROCESS 1 TO 1 START 0.000000 ANGLE 1.000000', 'BEST ON', 'GO', 'BEST OFF']
     EDAssert.equal(listCommandReference, listCommandExecution)
    def testConfigureOK(self):
        edPluginRaddose = self.createPlugin()
        edConfigurationGood01 = EDConfiguration(os.path.join(self.strDataPath, "XSConfiguration.xml"))
        dictItemGood01 = edConfigurationGood01.get(self.getPluginName())
        edPluginRaddose.setConfig(dictItemGood01, _bLocal = True)
        edPluginRaddose.setScriptExecutable("cat")
        edPluginRaddose.configure()
        EDAssert.equal("/bin/bash", edPluginRaddose.getScriptShell())
        EDAssert.equal("cat", edPluginRaddose.getScriptExecutable())
        EDAssert.equal("/opt/pxsoft/ccp4-6.0.2/include/ccp4.setup-bash.orig", edPluginRaddose.getSetupCCP4())
        EDAssert.equal("Verion of Raddose to be tested", edPluginRaddose.getStringVersion())
        #EDAssert.equal(600, edPluginMessage.getTimeOut())

        self.cleanUp(edPluginRaddose)
 def testSetDataInput(self):
     edPluginControlIntegrationv10 = self.createPlugin()
     strPathToTestConfigFile = os.path.join(self.getPluginTestsDataHome(), "XSConfiguration.xml")
     edConfiguration = EDConfiguration(strPathToTestConfigFile)
     dictItem = edConfiguration.get(edPluginControlIntegrationv10.getPluginName())
     edPluginControlIntegrationv10.setConfig(dictItem)
     edPluginControlIntegrationv10.configure()
     xmlInputReference = self.readAndParseFile(self.strReferenceInputFile)
     from XSDataMXv1 import XSDataIntegrationInput
     xsDataIntegrationInputReference = XSDataIntegrationInput.parseString(xmlInputReference)
     edPluginControlIntegrationv10.setDataInput(xmlInputReference)
     xsDataIntegrationv10Input = edPluginControlIntegrationv10.getDataInput()
     EDAssert.equal(xsDataIntegrationInputReference.marshal(), xsDataIntegrationv10Input.marshal())
     self.cleanUp(edPluginControlIntegrationv10)
示例#44
0
 def configure(self):
     """
     setup two configurations:
     --> MAX_OFFSET_VALUE 
     --> FILL_VALUE 
     
     """
     EDPluginExec.configure(self)
     if not self.__class__.CONFIGURED:
         with self.__class__._clsLock:
             if not self.__class__.CONFIGURED:
                 self.DEBUG("EDPluginExecShiftImagev1_1.configure")
                 xsPluginItem = self.getConfiguration()
                 if (xsPluginItem == None):
                     self.WARNING(
                         "EDPluginExecShiftImagev1_1.configure: No plugin item defined."
                     )
                     xsPluginItem = XSPluginItem()
                 strFill = EDConfiguration.getStringParamValue(
                     xsPluginItem, self.__class__.FILL_KEY)
                 if (strFill == None):
                     self.WARNING("EDPluginExecShiftImagev1_1.configure: No configuration parameter found for: %s using default value: %s\n%s"\
                                 % (self.FILL_KEY, self.FILL_VALUE, xsPluginItem.marshal()))
                 else:
                     strFill = strFill.strip().lower()
                     if strFill in ["min", "max", "mean"]:
                         self.__class__.FILL_VALUE = strFill
                     else:
                         try:
                             self.__class__.FILL_VALUE = float(strFill)
                         except ValueError, error:
                             self.ERROR(
                                 "unable to convert %s to float: %s" %
                                 (strFill, error))
                 strMaxOffset = EDConfiguration.getStringParamValue(
                     xsPluginItem, self.__class__.MAX_OFFSET_KEY)
                 if (strMaxOffset == None):
                     self.WARNING("EDPluginExecShiftImagev1_1.configure: No configuration parameter found for: %s using default value: %s\n%s"\
                                 % (self.MAX_OFFSET_KEY, self.MAX_OFFSET_VALUE, xsPluginItem.marshal()))
                 else:
                     if strMaxOffset.isdigit():
                         try:
                             self.__class__.MAX_OFFSET_VALUE = int(
                                 strMaxOffset)
                         except ValueError, error:
                             self.ERROR("unable to convert %s to int: %s" %
                                        (strMaxOffset, error))
                     else:
                         self.WARNING("EDPluginExecShiftImagev1_1.configure: No configuration parameter found for: %s using default value: %s\n%s"\
                                 % (self.MAX_OFFSET_KEY, self.MAX_OFFSET_VALUE, xsPluginItem.marshal()))
示例#45
0
 def configure(self):
     """
     Configures the plugin from the configuration file with the following parameters
      - Script executable to be invoked
      - number of worker 
      - The 3rd party executable installed version
     """
     EDPluginExecProcess.configure(self)
     self.DEBUG(" EDPluginSPDCorrect.configure")
     xsPluginItem = self.getConfiguration()
     if (xsPluginItem == None):
         self.WARNING(
             "EDPluginSPDCorrect.configure: No plugin item defined.")
         xsPluginItem = XSPluginItem()
     if (self.getExecutable() is None):
         edStringScriptExecutable = EDConfiguration.getStringParamValue(
             xsPluginItem, CONF_EXEC_PROCESS_SCRIPT_EXECUTABLE)
         if (edStringScriptExecutable == None):
             errorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginSPDCorrect.process', self.getClassName(), "Configuration parameter missing: " \
                                                            + CONF_EXEC_PROCESS_SCRIPT_EXECUTABLE)
             self.error(errorMessage)
             self.addErrorMessage(errorMessage)
             raise RuntimeError, errorMessage
         else:
             # Check that the executable file exists
             if not os.path.isfile(edStringScriptExecutable):
                 errorMessage = EDMessage.ERROR_EXECUTION_03 % ('EDPluginSPDCorrect.process', self.getClassName(), "Cannot find configured " \
                                                                + CONF_EXEC_PROCESS_SCRIPT_EXECUTABLE + " : " + edStringScriptExecutable)
                 self.error(errorMessage)
                 self.addErrorMessage(errorMessage)
                 raise RuntimeError, errorMessage
             else:
                 self.setExecutable(edStringScriptExecutable)
     edStringConfigSetupNbWorker = EDConfiguration.getStringParamValue(
         xsPluginItem, CONF_EXEC_MAX_MAX_NUMBER_OF_WORKERS)
     if (edStringConfigSetupNbWorker == None):
         self.DEBUG(
             "EDPluginSPDCorrect.configure: No configuration parameter found for: "
             + CONF_EXEC_MAX_MAX_NUMBER_OF_WORKERS + ", NO default value!")
     else:
         self._iConfigNumberOfWorker = int(edStringConfigSetupNbWorker)
     edStringVersion = EDConfiguration.getStringParamValue(
         xsPluginItem, CONF_EXEC_PROCESS_SCRIPT_VERSION_STRING)
     if (edStringVersion == None):
         self.DEBUG(
             "EDPluginSPDCorrect.configure: No configuration parameter found for: "
             + CONF_EXEC_PROCESS_SCRIPT_VERSION_STRING +
             ", NO default value!")
     else:
         self.setStringVersion(edStringVersion)
示例#46
0
 def testConfigureOK(self):
     edPluginBest = self.createPlugin()
     edConfigurationGood01 = EDConfiguration(os.path.join(self.m_pyStrDataPath, "XSConfiguration.xml"))
     dictItemGood01 = edConfigurationGood01.get(self.getPluginName())
     edPluginBest.setConfig(dictItemGood01, _bLocal = True)
     edPluginBest.setScriptExecutable("cat")
     edPluginBest.configure()
     EDAssert.equal("/bin/bash", edPluginBest.getScriptShell())
     EDAssert.equal("cat", edPluginBest.getScriptExecutable())
     EDAssert.equal("/opt/pxsoft/ccp4-6.0.2/include/ccp4.setup-bash.orig", edPluginBest.getSetupCCP4())
     EDAssert.equal("Version of Best to be tested", edPluginBest.getStringVersion())
     EDAssert.equal(600, edPluginBest.getTimeOut())
     EDAssert.equal("/home/sweet/home", edPluginBest.getBestHome())
     EDAssert.equal("export besthome=/home/sweet/home", edPluginBest.getCommandBestHome())
     self.cleanUp(edPluginBest)
示例#47
0
 def testGetPathToProjectConfigurationFile(self):
     edConfiguration = EDConfiguration()
     strPathToConfigurationFile1 = edConfiguration.getPathToProjectConfigurationFile(
         "EDPluginTestPluginFactory")
     strPathToConfigurationFileReference1 = EDUtilsPath.appendListOfPaths(EDUtilsPath.getEdnaHome(),
                                                                               [ "kernel", "tests", "data", "EDFactoryPlugin", \
                                                                                "testProject", "conf", "XSConfiguration_TestSite.xml" ])
     EDAssert.equal(strPathToConfigurationFileReference1,
                    strPathToConfigurationFile1)
     EDUtilsPath.setEdnaSite("NonexistingTestSite")
     strPathToConfigurationFile2 = edConfiguration.getPathToProjectConfigurationFile(
         "EDPluginTestPluginFactory")
     strPathToConfigurationFileReference2 = None
     EDAssert.equal(strPathToConfigurationFileReference2,
                    strPathToConfigurationFile2)
示例#48
0
 def configure(self):
     """
     setup two configurations:
     --> MAX_OFFSET_VALUE 
     --> FILL_VALUE 
     
     """
     EDPluginExec.configure(self)
     if not self.__class__.CONFIGURED:
         with self.__class__._clsLock:
             if not self.__class__.CONFIGURED:
                 self.DEBUG("EDPluginExecShiftImagev1_1.configure")
                 xsPluginItem = self.getConfiguration()
                 if xsPluginItem == None:
                     self.WARNING("EDPluginExecShiftImagev1_1.configure: No plugin item defined.")
                     xsPluginItem = XSPluginItem()
                 strFill = EDConfiguration.getStringParamValue(xsPluginItem, self.__class__.FILL_KEY)
                 if strFill == None:
                     self.WARNING(
                         "EDPluginExecShiftImagev1_1.configure: No configuration parameter found for: %s using default value: %s\n%s"
                         % (self.FILL_KEY, self.FILL_VALUE, xsPluginItem.marshal())
                     )
                 else:
                     strFill = strFill.strip().lower()
                     if strFill in ["min", "max", "mean"]:
                         self.__class__.FILL_VALUE = strFill
                     else:
                         try:
                             self.__class__.FILL_VALUE = float(strFill)
                         except ValueError, error:
                             self.ERROR("unable to convert %s to float: %s" % (strFill, error))
                 strMaxOffset = EDConfiguration.getStringParamValue(xsPluginItem, self.__class__.MAX_OFFSET_KEY)
                 if strMaxOffset == None:
                     self.WARNING(
                         "EDPluginExecShiftImagev1_1.configure: No configuration parameter found for: %s using default value: %s\n%s"
                         % (self.MAX_OFFSET_KEY, self.MAX_OFFSET_VALUE, xsPluginItem.marshal())
                     )
                 else:
                     if strMaxOffset.isdigit():
                         try:
                             self.__class__.MAX_OFFSET_VALUE = int(strMaxOffset)
                         except ValueError, error:
                             self.ERROR("unable to convert %s to int: %s" % (strMaxOffset, error))
                     else:
                         self.WARNING(
                             "EDPluginExecShiftImagev1_1.configure: No configuration parameter found for: %s using default value: %s\n%s"
                             % (self.MAX_OFFSET_KEY, self.MAX_OFFSET_VALUE, xsPluginItem.marshal())
                         )
示例#49
0
    def configure(self):
        """
        Gets the configuration parameters (if any).
        """
        EDPluginControl.configure(self)
        EDVerbose.DEBUG("EDPluginControlInterfacev2_0.configure")
        pluginConfiguration = self.getConfiguration()
        strUseISPyBPlugin = "false"

        if (pluginConfiguration is None):
            EDVerbose.DEBUG(
                "No plugin configuration found for EDPluginControlInterfacev2_0."
            )
        else:
            if (self.getControlledPluginName("subWedgeAssemblePlugin")
                    is not None):
                self.strEDPluginControlSubWedgeAssembleName = self.getControlledPluginName(
                    "subWedgeAssemblePlugin")
            if (self.getControlledPluginName("characterisationPlugin")
                    is not None):
                self.strEDPluginControlCharacterisationName = self.getControlledPluginName(
                    "characterisationPlugin")
            if (self.getControlledPluginName("ispybPlugin") is not None):
                self.strEDPluginControlISPyBName = self.getControlledPluginName(
                    "ispybPlugin")
            strUseISPyBPlugin = EDConfiguration.getStringParamValue(
                pluginConfiguration, "useISPyBPlugin")

        if (strUseISPyBPlugin.lower() != "true"):
            self.strEDPluginControlISPyBName = None
示例#50
0
    def configure(self):
        """
        """
        EDPluginExecProcessScript.configure(self)
        self.DEBUG("EDPluginBestv1_1.configure")
        self.setRequireCCP4(True)
        strScriptExecutable = self.getScriptExecutable()
        self.DEBUG("EDPluginBestv1_1.configure: Script Executable: " +
                   strScriptExecutable)
        strBestScriptHome = os.path.dirname(strScriptExecutable)
        strBestHome = None

        pluginConfiguration = self.getConfiguration()

        if (pluginConfiguration == None):
            strBestHome = strBestScriptHome
        else:
            strBestHome = EDConfiguration.getStringParamValue(
                pluginConfiguration, self.strCONF_BEST_HOME_LABEL)
            if (strBestHome == None):
                strBestHome = strBestScriptHome

        self.setBestHome(strBestHome)
        self.DEBUG("EDPluginBestv1_1.configure: Best Home: " + strBestHome)
        self.setCommandBestHome("export besthome=" + self.getBestHome())
    def configure(self):
        """
        Gets the configuration parameters (if any). Use the Python name mangling rules for storing the parameters in 
        the private variables of the parent class.
        """
        EDPluginControl.configure(self)
        EDVerbose.DEBUG(
            "EDPluginControlCharForReorientInterfacev2_0.configure")
        pluginConfiguration = self.getConfiguration()
        strUseISPyBPlugin = "false"

        if (pluginConfiguration is None):
            EDVerbose.DEBUG(
                "No plugin configuration found for EDPluginControlCharForReorientInterfacev2_0."
            )
        else:
            if (self.getControlledPluginName("subWedgeAssemblePlugin")
                    is not None):
                self._EDPluginControlInterfacev2_0__strEDPluginControlSubWedgeAssembleName = self.getControlledPluginName(
                    "subWedgeAssemblePlugin")
            if (self.getControlledPluginName("characterisationPlugin")
                    is not None):
                self._EDPluginControlInterfacev2_0__strEDPluginControlCharacterisationName = self.getControlledPluginName(
                    "characterisationPlugin")
            if (self.getControlledPluginName("ispybPlugin") is not None):
                self._EDPluginControlInterfacev2_0__strEDPluginControlISPyBName = self.getControlledPluginName(
                    "ispybPlugin")
            strUseISPyBPlugin = EDConfiguration.getStringParamValue(
                pluginConfiguration, "useISPyBPlugin")

        if (strUseISPyBPlugin.lower() != "true"):
            self._EDPluginControlInterfacev2_0__strEDPluginControlISPyBName = None
 def configure(self, _edPlugin = None):
     EDPluginControl.configure(self)
     self.DEBUG("EDPluginControlReadImageHeaderv10.configure")
     if self.getConfiguration():
         xsDataStringParameter = EDConfiguration.getParamItem(self.getConfiguration(), "waitFileTimeOut")
         if xsDataStringParameter:
             self.fWaitFileTimeOut = float(xsDataStringParameter.getValue())
示例#53
0
 def __init__(self):
     """
     Initializes plugin related attributes described above
     """
     EDAction.__init__(self)
     self.__xsPluginItem = None
     self.__dictXSDataInputClass = {}
     self.__dictXSDataInput = {}
     self.__dictXSDataOutput = {}
     self.__strDefaultInputDataKey = "defaultInputData"
     self.__strDefaultOutputDataKey = "defaultOutputData"
     self.__edSlotExportDataOutput = EDSlot()
     self.__strBaseDirectory = None
     self.__strWorkingDirectory = None
     self.__strBaseName = None
     self.__listExecutiveSummaryLines = []
     self.__strExecutiveSummarySeparator = "-" * 80
     self.__listErrorMessages = []
     self.__listWarningMessages = []
     self.__isRequiredToHaveConfiguration = False
     self.__bWriteDataXMLInputOutput = True
     self.__bWriteDataXMLOutput = True
     self.__bWriteDataXMLInput = True
     self.__strPluginId = "%s-%08i" % (self.getClassName(), self.getId())
     self.strPathDataInput = None
     self.strPathDataOutput = None
     self.__bUseWarningInsteadOfError = False
     self.__edConfiguration = EDConfigurationStatic()
 def preProcess(self):
     """
     Constructs the utilitary EDConfiguration class
     """
     #Loads py module directly using xml configuration file
     self.___edConfiguration = EDConfiguration(os.path.join(self.___strDataPath, "XSConfiguration.xml"))
     self.___edConfiguration.load()
示例#55
0
 def __init__ (self):
     """
     Initializes plugin related attributes described above
     """
     EDAction.__init__(self)
     self.__xsPluginItem = None
     self.__dictXSDataInputClass = {}
     self.__dictXSDataInput = {}
     self.__dictXSDataOutput = {}
     self.__strDefaultInputDataKey = "defaultInputData"
     self.__strDefaultOutputDataKey = "defaultOutputData"
     self.__edSlotExportDataOutput = EDSlot()
     self.__strBaseDirectory = None
     self.__strWorkingDirectory = None
     self.__strBaseName = None
     self.__listExecutiveSummaryLines = []
     self.__strExecutiveSummarySeparator = "-" * 80
     self.__listErrorMessages = []
     self.__listWarningMessages = []
     self.__isRequiredToHaveConfiguration = False
     self.__bWriteDataXMLInputOutput = True
     self.__bWriteDataXMLOutput = True
     self.__bWriteDataXMLInput = True
     self.__strPluginId = "%s-%08i" % (self.getClassName(), self.getId())
     self.strPathDataInput = None
     self.strPathDataOutput = None
     self.__bUseWarningInsteadOfError = False
     self.__edConfiguration = EDConfigurationStatic()
    def configure(self):
        """
        Gets the configuration parameters (if any). Use the Python name mangling rules for storing the parameters in 
        the private variables of the parent class.
        """
        EDPluginControl.configure(self)
        EDVerbose.DEBUG("EDPluginControlCharForReorientInterfacev2_0.configure")
        pluginConfiguration = self.getConfiguration()
        strUseISPyBPlugin = "false"

        if pluginConfiguration is None:
            EDVerbose.DEBUG("No plugin configuration found for EDPluginControlCharForReorientInterfacev2_0.")
        else:
            if self.getControlledPluginName("subWedgeAssemblePlugin") is not None:
                self._EDPluginControlInterfacev2_0__strEDPluginControlSubWedgeAssembleName = self.getControlledPluginName(
                    "subWedgeAssemblePlugin"
                )
            if self.getControlledPluginName("characterisationPlugin") is not None:
                self._EDPluginControlInterfacev2_0__strEDPluginControlCharacterisationName = self.getControlledPluginName(
                    "characterisationPlugin"
                )
            if self.getControlledPluginName("ispybPlugin") is not None:
                self._EDPluginControlInterfacev2_0__strEDPluginControlISPyBName = self.getControlledPluginName(
                    "ispybPlugin"
                )
            strUseISPyBPlugin = EDConfiguration.getStringParamValue(pluginConfiguration, "useISPyBPlugin")

        if strUseISPyBPlugin.lower() != "true":
            self._EDPluginControlInterfacev2_0__strEDPluginControlISPyBName = None
 def configure(self, _edPlugin=None):
     EDPluginControl.configure(self)
     self.DEBUG("EDPluginControlReadImageHeaderv10.configure")
     if self.getConfiguration():
         xsDataStringParameter = EDConfiguration.getParamItem(
             self.getConfiguration(), "waitFileTimeOut")
         if xsDataStringParameter:
             self.fWaitFileTimeOut = float(xsDataStringParameter.getValue())
示例#58
0
    def testGetPluginItem(self):
        """
        Testing Plugin indexingMosflm Configuration
        """
        strPath = os.path.join(self.strDataPath, "XSConfiguration.xml")
        edConfiguration = EDConfiguration()
        edConfiguration.addConfigurationFile(strPath)
        xsPluginItem = edConfiguration.getXSConfigurationItem("indexingMosflm")
        EDAssert.equal("indexingMosflm", xsPluginItem.getName())

        paramList = xsPluginItem.getXSParamList()
        paramItems = paramList.getXSParamItem()

        EDAssert.equal("workingDir", paramItems[0].getName())
        EDAssert.equal("/path/to/working/dir", paramItems[0].getValue())
        EDAssert.equal("number", paramItems[1].getName())
        EDAssert.equal("3", paramItems[1].getValue())
    def testConfigureOK(self):
        edPluginRaddose = self.createPlugin()
        edConfigurationGood01 = EDConfiguration(
            os.path.join(self.strDataPath, "XSConfiguration.xml"))
        dictItemGood01 = edConfigurationGood01.get(self.getPluginName())
        edPluginRaddose.setConfig(dictItemGood01, _bLocal=True)
        edPluginRaddose.setScriptExecutable("cat")
        edPluginRaddose.configure()
        EDAssert.equal("/bin/bash", edPluginRaddose.getScriptShell())
        EDAssert.equal("cat", edPluginRaddose.getScriptExecutable())
        EDAssert.equal("/opt/pxsoft/ccp4-6.0.2/include/ccp4.setup-bash.orig",
                       edPluginRaddose.getSetupCCP4())
        EDAssert.equal("Verion of Raddose to be tested",
                       edPluginRaddose.getStringVersion())
        #EDAssert.equal(600, edPluginMessage.getTimeOut())

        self.cleanUp(edPluginRaddose)