Ejemplo n.º 1
0
 def __setup_configs(self, database_config):
     metadata = open(METADATA_FILE, "rt")
     dep = open(DEP_FILE, "rt")
     complete_conf = configinitializer.unify_configs([metadata, dep],
                                                     database_config)
     metadata.close()
     dep.close()
     return complete_conf
    def setUp(self):

        # transform string to file mode
        write_file(TEST_METADATA_FILE_PATH, self.metadata_config)
        write_file(TEST_DEPENDENCIES_FILE_PATH, self.dependencies_config)

        # define environment variables
        os.environ["MXRUNTIME_DatabaseType"] = "PostgreSQL"
        os.environ["MXRUNTIME_DatabaseHost"] = "localhost:5432"
        os.environ["MXRUNTIME_DatabaseUserName"] = "******"
        os.environ["MXRUNTIME_DatabaseName"] = "mendix"
        os.environ["MXRUNTIME_DatabasePassword"] = "******"
        # environment variable will overwrite the defautl constant value
        os.environ["MX_MyFirstModule.Kafka_broker_url"] = TEST_BROKER_URL

        metadata_file = open(TEST_METADATA_FILE_PATH, "rt")
        dependencies_file = open(TEST_DEPENDENCIES_FILE_PATH, "rt")

        database_config = {}
        self.complete_producer_conf = configinitializer.unify_configs(
            [metadata_file, dependencies_file], database_config)

        metadata_file.close()
        dependencies_file.close()