Ejemplo n.º 1
0
 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])
Ejemplo n.º 2
0
    def __init__(self, mongoSaveUtils, mongoReadUtils):
        """
        Инициализация

        :param mongoSaveUtils:  параметры для записи данных в mongodb
        :param mongoReadUtils:  параметры для чтения данных из mongodb
        """
        if not mongoSaveUtils:
            raise ParamError("mongoUtils cannot be the None-object")
        if not isinstance(mongoSaveUtils, MongoSaveUtils):
            raise TypeError("mongoUtils can be the list MongoSaveUtils")
        if not ISaveRetrievalUtils.providedBy(mongoSaveUtils):
            raise TypeError(
                "mongoUtils is not provided by ISaveRetrievalUtils")

        if not mongoReadUtils:
            raise ParamError("mongoReadUtils cannot be the None-object")
        if not isinstance(mongoReadUtils, MongoReadUtils):
            raise TypeError("mongoReadUtils can be the list MongoReadUtils")

        self.__mongoSaveUtils = mongoSaveUtils
        self.__mongoReadUtils = mongoReadUtils
        self.__ms = StatisticFactory().createStatistic(MONGO_TYPE,
                                                       self.__mongoSaveUtils)