def testCreateBaseName(self): # Test 1 : naming of working directory edPlugin = EDPlugin() edPlugin.setBaseName("EDPlugin_testCreateBaseName") edPlugin.configure() strWorkingDir = edPlugin.getWorkingDirectory() EDAssert.equal(True, os.path.exists(strWorkingDir), "Test 1 : naming of working directory")
def configure(self): """ Gets the EDPluginControl parameters from the configuration file and stores them in class member attributes. """ EDPlugin.configure(self) EDVerbose.DEBUG("EDPluginControl.configure") strControlledPlugins = self.config.get("controlledPlugins", None) if (strControlledPlugins != None): pyListControlledPlugins = strControlledPlugins.split(",") for strControlledPlugin in pyListControlledPlugins: strControlledPluginName = self.getStringConfigurationParameterValue(strControlledPlugin) if strControlledPluginName != None: self.setControlledPluginName(strControlledPlugin, strControlledPluginName) EDVerbose.DEBUG("EDPluginControl.configure: setting controlled plugin %s to specific plugin %s" % (strControlledPlugin, strControlledPluginName)) clusterSize = self.config.get("clusterSize", None) if (clusterSize != None): self.__iClusterSize = int(strClusterSize) EDVerbose.DEBUG("EDPluginControl.configure: setting cluster size to %d" % self.__iClusterSize)
def testWarningIfNoOutputData(self): # Test warning in case of no output data edPlugin = EDPlugin() edPlugin.configure() edPlugin.executeSynchronous() xsDataResultReference = XSDataResult() listOfWarningMessages = edPlugin.getListOfWarningMessages() EDAssert.equal(1, len(listOfWarningMessages), "Test warning in case of no output data, no warning messages = 1") EDAssert.equal(xsDataResultReference.marshal(), edPlugin.dataOutput.marshal(), "Test warning in case of no output data, default XSDataResult") # Test warning in case of named output data edPlugin = EDPlugin() edPlugin.configure() xsDataStringTest = XSDataString("Test1") edPlugin.setDataOutput(xsDataStringTest, "test") edPlugin.executeSynchronous() xsDataResultReference = XSDataResult() listOfWarningMessages = edPlugin.getListOfWarningMessages() EDAssert.equal(0, len(listOfWarningMessages), "Test warning in case of named output data, no warning messages = 0")
def testWriteDataOutput(self): # Test 1: default Output with XML edPlugin = EDPlugin() edPlugin.configure() xsDataStringTest = XSDataString("Test") edPlugin.setDataOutput(xsDataStringTest) edPlugin.writeDataOutput() EDAssert.equal(True, os.path.exists(os.path.join(edPlugin.getWorkingDirectory(), "_dataOutput.xml")), "Test 1: default Output with XML") # Test 2: named Output with XML edPlugin = EDPlugin() edPlugin.configure() xsDataStringTest = XSDataString("Test") edPlugin.setDataOutput(xsDataStringTest, "testData") edPlugin.writeDataOutput() EDAssert.equal(True, os.path.exists(os.path.join(edPlugin.getWorkingDirectory(), "_testData_0_dataOutput.xml")), "Test 2: named Output with XML") # Test 3: several Outputs with the same name, XML Output edPlugin = EDPlugin() edPlugin.configure() xsDataStringTest1 = XSDataString("Test1") xsDataStringTest2 = XSDataString("Test2") edPlugin.setDataOutput(xsDataStringTest1, "testData") edPlugin.setDataOutput(xsDataStringTest2, "testData") edPlugin.writeDataOutput() EDAssert.equal(True, os.path.exists(os.path.join(edPlugin.getWorkingDirectory(), "_testData_0_dataOutput.xml")), "Test 3: several Outputs with the same name, XML Output, 1") EDAssert.equal(True, os.path.exists(os.path.join(edPlugin.getWorkingDirectory(), "_testData_1_dataOutput.xml")), "Test 3: several Outputs with the same name, XML Output, 2")
def testWriteDataInput(self): # Test 1: default input with XML edPlugin = EDPlugin() edPlugin.configure() edPlugin.setXSDataInputClass(XSDataString) xsDataStringTest = XSDataString("Test") edPlugin.setDataInput(xsDataStringTest.marshal()) edPlugin.writeDataInput() EDAssert.equal(True, os.path.exists(os.path.join(edPlugin.getWorkingDirectory(), "_dataInput.xml")), "Test 1: default input with XML") # Test 2: named input with XML edPlugin = EDPlugin() edPlugin.configure() edPlugin.setXSDataInputClass(XSDataString, "testData") xsDataStringTest = XSDataString("Test") edPlugin.setDataInput(xsDataStringTest.marshal(), "testData") edPlugin.writeDataInput() EDAssert.equal(True, os.path.exists(os.path.join(edPlugin.getWorkingDirectory(), "_testData_0_dataInput.xml")), "Test 2: named input with XML") # Test 3: several inputs with the same name, XML input edPlugin = EDPlugin() edPlugin.configure() edPlugin.setXSDataInputClass(XSDataString, "testData") xsDataStringTest1 = XSDataString("Test1") xsDataStringTest2 = XSDataString("Test2") edPlugin.setDataInput(xsDataStringTest1.marshal(), "testData") edPlugin.setDataInput(xsDataStringTest2.marshal(), "testData") edPlugin.writeDataInput() EDAssert.equal(True, os.path.exists(os.path.join(edPlugin.getWorkingDirectory(), "_testData_0_dataInput.xml")), "Test 3: several inputs with the same name, XML input, 1") EDAssert.equal(True, os.path.exists(os.path.join(edPlugin.getWorkingDirectory(), "_testData_1_dataInput.xml")), "Test 3: several inputs with the same name, XML input, 2")
def configure(self): """ Gets the EDPluginControl parameters from the configuration file and stores them in class member attributes. """ EDPlugin.configure(self) pluginConfiguration = self.getConfiguration() if(pluginConfiguration == None): EDVerbose.DEBUG("EDPluginControl.configure: pluginConfiguration is None, using default settings") else: EDVerbose.DEBUG("EDPluginControl.configure: pluginConfiguration found, using settings from there") strControlledPlugins = EDConfiguration.getStringParamValue(pluginConfiguration, "controlledPlugins") if (strControlledPlugins != None): pyListControlledPlugins = strControlledPlugins.split(",") for strControlledPlugin in pyListControlledPlugins: strControlledPluginName = EDConfiguration.getStringParamValue(pluginConfiguration, strControlledPlugin) if strControlledPluginName != None: self.setControlledPluginName(strControlledPlugin, strControlledPluginName) EDVerbose.DEBUG("EDPluginControl.configure: setting controlled plugin %s to specific plugin %s" % (strControlledPlugin, strControlledPluginName)) strClusterSize = EDConfiguration.getStringParamValue(pluginConfiguration, "clusterSize") if (strClusterSize != None): self.__iClusterSize = int(strClusterSize) EDVerbose.DEBUG("EDPluginControl.configure: setting cluster size to %d" % self.__iClusterSize)
def configure(self): """ Gets the EDPluginControl parameters from the configuration file and stores them in class member attributes. """ EDPlugin.configure(self) self.DEBUG("EDPluginControl.configure") strControlledPlugins = self.config.get("controlledPlugins", None) if strControlledPlugins is not None: pyListControlledPlugins = strControlledPlugins.split(",") for strControlledPlugin in pyListControlledPlugins: strControlledPluginName = self.config.get(strControlledPlugin) if strControlledPluginName != None: self.setControlledPluginName(strControlledPlugin, strControlledPluginName) self.DEBUG( "EDPluginControl.configure: setting controlled plugin %s to specific plugin %s" % (strControlledPlugin, strControlledPluginName)) strClusterSize = self.config.get("clusterSize", None) if strClusterSize is not None: self.__iClusterSize = int(strClusterSize) self.DEBUG( "EDPluginControl.configure: setting cluster size to %d" % self.__iClusterSize)
def testDataInputOutputProperties(self): # Test dataInput property with XSDataObject edPlugin = EDPlugin() edPlugin.setXSDataInputClass(XSDataString) edPlugin.configure() xsDataStringTest = XSDataString("Test1") edPlugin.dataInput = xsDataStringTest EDAssert.equal(xsDataStringTest.marshal(), edPlugin.dataInput.marshal(), "Test dataInput property with XSDataObject") # Test dataInput property with XML edPlugin = EDPlugin() edPlugin.setXSDataInputClass(XSDataString) edPlugin.configure() xsDataStringTest = XSDataString("Test1") edPlugin.dataInput = xsDataStringTest.marshal() EDAssert.equal(xsDataStringTest.marshal(), edPlugin.dataInput.marshal(), "Test dataInput property with XML") # Test dataOutput property with XSDataObject edPlugin = EDPlugin() edPlugin.configure() xsDataStringTest = XSDataString("Test1") edPlugin.dataOutput = xsDataStringTest EDAssert.equal(xsDataStringTest.marshal(), edPlugin.dataOutput.marshal(), "Test dataOutput property with XSDataObject")