コード例 #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)
コード例 #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)
コード例 #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
コード例 #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
コード例 #5
0
 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)
コード例 #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)
コード例 #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)
コード例 #8
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)
コード例 #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)
コード例 #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)
コード例 #11
0
 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)
コード例 #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)
コード例 #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)
コード例 #14
0
 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")