Ejemplo n.º 1
0
    def appendPath(self, _strPluginTestLocation):
        """
        For the tests, both the plugin directory and its corresponding "src" directory must
        be on the python path (see the class documentation for EDFactoryPluginTest).
        This method appends the plugin "src" directory to the system path, if it's not already present.

        @param _strModuleLocation: Path to the module location
        @type _strModuleLocation: python string
        """
        EDFactoryPlugin.appendPath(self, _strPluginTestLocation)

        strSrcDirectory = EDUtilsPath.appendListOfPaths(
            _strPluginTestLocation, ["..", "..", "..", "..", "src"])
        if os.path.exists(strSrcDirectory):
            if (not strSrcDirectory in sys.path):
                sys.path.append(strSrcDirectory)

        strSrcDirectory = EDUtilsPath.appendListOfPaths(
            _strPluginTestLocation, ["..", "..", "src"])
        if os.path.exists(strSrcDirectory):
            if (not strSrcDirectory in sys.path):
                sys.path.append(strSrcDirectory)

        strPluginDirectory = EDUtilsPath.appendListOfPaths(
            _strPluginTestLocation, ["..", "..", "plugins"])
        if os.path.exists(strPluginDirectory):
            if (not strPluginDirectory in sys.path):
                sys.path.append(strPluginDirectory)
Ejemplo n.º 2
0
    def appendPath(self, _strPluginTestLocation):
        """
        For the tests, both the plugin directory and its corresponding "src" directory must
        be on the python path (see the class documentation for EDFactoryPluginTest).
        This method appends the plugin "src" directory to the system path, if it's not already present.

        @param _strModuleLocation: Path to the module location
        @type _strModuleLocation: python string
        """
        EDFactoryPlugin.appendPath(self, _strPluginTestLocation)

        strSrcDirectory = EDUtilsPath.appendListOfPaths(_strPluginTestLocation, [ "..", "..", "..", "..", "src" ])
        if os.path.exists(strSrcDirectory):
            if (not strSrcDirectory in sys.path):
                sys.path.append(strSrcDirectory)

        strSrcDirectory = EDUtilsPath.appendListOfPaths(_strPluginTestLocation, [ "..", "..", "src" ])
        if os.path.exists(strSrcDirectory):
            if (not strSrcDirectory in sys.path):
                sys.path.append(strSrcDirectory)

        strPluginDirectory = EDUtilsPath.appendListOfPaths(_strPluginTestLocation, [ "..", "..", "plugins" ])
        if os.path.exists(strPluginDirectory):
            if (not strPluginDirectory in sys.path):
                sys.path.append(strPluginDirectory)
Ejemplo n.º 3
0
 def getConfigurationHome(cls, _strPluginTestName):
     """
     Returns the configuration directory path for a given test module
     """
     strModuleLocation = cls.getFactoryPluginTest().getModuleLocation(_strPluginTestName)
     strConfigurationHome = EDUtilsPath.appendListOfPaths(strModuleLocation, [ "..", "..", "..", "..", "conf" ])
     return strConfigurationHome
Ejemplo n.º 4
0
 def getPluginTestDataDirectory(cls, _strPluginTestName):
     """
     Given a test case name, returns the corresponding test data directory.
     """
     strModuleLocation = cls.getFactoryPluginTest().getModuleLocation(_strPluginTestName)
     strPluginTestDataDirectory = EDUtilsPath.appendListOfPaths(strModuleLocation, [ "..", "data" ])
     return strPluginTestDataDirectory
 def testGetProjectRootDirectory(self):
     edFactoryPluginTest = EDFactoryPluginTest()
     strEdnaHome = EDUtilsPath.getEdnaHome()
     strTestProjectRootDirectoryReference = EDUtilsPath.appendListOfPaths(strEdnaHome, [ "edna-kernel", "tests", "data", "EDFactoryPlugin", "testProject" ])
     strTestProjectRootDirectory1 = edFactoryPluginTest.getProjectRootDirectory("EDTestCasePluginUnitTestPluginFactory")
     EDAssert.equal(strTestProjectRootDirectoryReference, strTestProjectRootDirectory1)
     strTestProjectRootDirectory2 = edFactoryPluginTest.getProjectRootDirectory("EDTestSuitePluginUnitTestProject")
     EDAssert.equal(strTestProjectRootDirectoryReference, strTestProjectRootDirectory2)
Ejemplo n.º 6
0
 def testGetProjectRootDirectory(self):
     edFactoryPlugin = EDFactoryPlugin()
     strEdnaHome = EDUtilsPath.getEdnaHome()
     strTestProjectRootDirectoryReference = EDUtilsPath.appendListOfPaths(strEdnaHome, [ "kernel", "tests", "data", "EDFactoryPlugin", "testProject" ])
     strTestProjectRootDirectory1 = edFactoryPlugin.getProjectRootDirectory("EDPluginTestPluginFactory")
     EDAssert.equal(strTestProjectRootDirectoryReference, strTestProjectRootDirectory1)
     strTestProjectRootDirectory2 = edFactoryPlugin.getProjectRootDirectory("XSDataTestProject")
     EDAssert.equal(strTestProjectRootDirectoryReference, strTestProjectRootDirectory2)
     strTestProjectRootDirectory3 = edFactoryPlugin.getProjectRootDirectory("PluginThatNotExists")
     EDAssert.equal(None, strTestProjectRootDirectory3)
Ejemplo n.º 7
0
    def appendPath(self, _strModuleLocation):
        """
        This method appends the plugin "src" directory to the system path, if it's not already present.

        @param _strModuleLocation: Path to the module location
        @type _strModuleLocation: python string
        """
        strSrcDirectory = EDUtilsPath.appendListOfPaths(_strModuleLocation, [ "..", "..", "..", "src" ])
        if (os.path.exists(strSrcDirectory)):
            if (not strSrcDirectory in sys.path):
                sys.path.append(strSrcDirectory)
 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)
Ejemplo n.º 9
0
    def appendPath(self, _strModuleLocation):
        """
        This method appends the plugin "src" directory to the system path, if it's not already present.

        @param _strModuleLocation: Path to the module location
        @type _strModuleLocation: python string
        """
        strSrcDirectory = EDUtilsPath.appendListOfPaths(_strModuleLocation, [ "..", "..", "..", "src" ])
        if (os.path.exists(strSrcDirectory)):
            if (not strSrcDirectory in sys.path):
                sys.path.append(strSrcDirectory)
Ejemplo n.º 10
0
 def testGetProjectRootDirectory(self):
     edFactoryPluginTest = EDFactoryPluginTest()
     strEdnaHome = EDUtilsPath.getEdnaHome()
     strTestProjectRootDirectoryReference = EDUtilsPath.appendListOfPaths(
         strEdnaHome,
         ["kernel", "tests", "data", "EDFactoryPlugin", "testProject"])
     strTestProjectRootDirectory1 = edFactoryPluginTest.getProjectRootDirectory(
         "EDTestCasePluginUnitTestPluginFactory")
     EDAssert.equal(strTestProjectRootDirectoryReference,
                    strTestProjectRootDirectory1)
     strTestProjectRootDirectory2 = edFactoryPluginTest.getProjectRootDirectory(
         "EDTestSuitePluginUnitTestProject")
     EDAssert.equal(strTestProjectRootDirectoryReference,
                    strTestProjectRootDirectory2)
 def testGetPathToProjectConfigurationFile(self):
     EDUtilsPath.setEdnaSite("TestSite")
     edFactoryPlugin = EDFactoryPlugin()
     strPathToConfigurationFile1 = edFactoryPlugin.getPathToProjectConfigurationFile("EDPluginTestPluginFactory")
     strPathToConfigurationFileReference1 = EDUtilsPath.appendListOfPaths(EDUtilsPath.getEdnaHome(),
                                                                               [ "edna-kernel", "tests", "data", "EDFactoryPlugin", \
                                                                                "testProject", "conf", "XSConfiguration_TestSite.xml" ])
     EDAssert.equal(strPathToConfigurationFileReference1, strPathToConfigurationFile1)
     EDUtilsPath.setEdnaSite("NonexistingTestSite")
     strPathToConfigurationFile2 = edFactoryPlugin.getPathToProjectConfigurationFile("EDPluginTestPluginFactory")
     strPathToConfigurationFileReference2 = None
     EDAssert.equal(strPathToConfigurationFileReference2, strPathToConfigurationFile2)
     # Since this is a static variable we need to reset it to None in order not to break any other tests...
     EDUtilsPath.setEdnaSite(None)
Ejemplo n.º 12
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)
Ejemplo n.º 13
0
 def testGetProjectRootDirectory(self):
     edFactoryPlugin = EDFactoryPlugin()
     strEdnaHome = EDUtilsPath.getEdnaHome()
     strTestProjectRootDirectoryReference = EDUtilsPath.appendListOfPaths(
         strEdnaHome,
         ["kernel", "tests", "data", "EDFactoryPlugin", "testProject"])
     strTestProjectRootDirectory1 = edFactoryPlugin.getProjectRootDirectory(
         "EDPluginTestPluginFactory")
     EDAssert.equal(strTestProjectRootDirectoryReference,
                    strTestProjectRootDirectory1)
     strTestProjectRootDirectory2 = edFactoryPlugin.getProjectRootDirectory(
         "XSDataTestProject")
     EDAssert.equal(strTestProjectRootDirectoryReference,
                    strTestProjectRootDirectory2)
     strTestProjectRootDirectory3 = edFactoryPlugin.getProjectRootDirectory(
         "PluginThatNotExists")
     EDAssert.equal(None, strTestProjectRootDirectory3)
 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")