class TestFileNameNormalization(unittest.TestCase):

    def setUp(self):
        self.__fileNormalization = FileNameNormalization()

    def testNormalizeText(self):
        words = self.__fileNormalization.normalizeText('/opt/some dir/file.txt')
        for word in words:
            self.assertIsNotNone(word, "empty word")

        words2 = self.__fileNormalization.normalizeText('C:\\some dir\\file.txt')
        for word in words2:
            self.assertIsNotNone(word, "empty word")

    def testNormalizeTextException(self):
        self.assertRaises(ParamError, self.__fileNormalization.normalizeText, None)
        self.assertRaises(ParamError, self.__fileNormalization.normalizeText, '')
Esempio n. 2
0
class TestFileNameNormalization(unittest.TestCase):
    def setUp(self):
        self.__fileNormalization = FileNameNormalization()

    def testNormalizeText(self):
        words = self.__fileNormalization.normalizeText(
            '/opt/some dir/file.txt')
        for word in words:
            self.assertIsNotNone(word, "empty word")

        words2 = self.__fileNormalization.normalizeText(
            'C:\\some dir\\file.txt')
        for word in words2:
            self.assertIsNotNone(word, "empty word")

    def testNormalizeTextException(self):
        self.assertRaises(ParamError, self.__fileNormalization.normalizeText,
                          None)
        self.assertRaises(ParamError, self.__fileNormalization.normalizeText,
                          '')
 def setUp(self):
     self.__dirPath = os.path.abspath(os.curdir)
     firstPath = os.path.join(self.__dirPath, "resources/first")
     secondPath = os.path.join(self.__dirPath, "resources/second")
     self.__mongoSaveUtils = MongoSaveRetrievalUtils(
         HOST, PORT, USR, PWD, DB, FC_N, FC_DN, MDN)
     self.__mongoReadUtils = MongoReadUtils(HOST, PORT, USR, PWD, DB, FC_N,
                                            FC_DN)
     self.__simN = SimpleNormalization()
     self.__simNamesN = FileNameNormalization()
     self.__ms = StatisticFactory().createStatistic(MONGO_TYPE,
                                                    self.__mongoSaveUtils)
     self.__scc = FSSourceCustomCallback()
     self.__rnFS = ReaderNameFS([firstPath, secondPath])
Esempio n. 4
0
 def setUp(self):
     self.__fileNormalization = FileNameNormalization()
 def setUp(self):
     self.__fileNormalization = FileNameNormalization()
Esempio n. 6
0
 def testCreateSourceNameIndex(self):
     mongoIndex = MongoIndex(self.__mongoUtils, self.__mongoReadUtils)
     simNamesN = FileNameNormalization()
     mongoIndex.createStatistics(self.__fsWorker, self.__rFS, self.__smN,
                                 self.__scc)
     mongoIndex.createSourceNameIndex(self.__fsWorker, simNamesN)