def create_worker_registry_instance(self, blockchain_type, config): # create worker registry instance for direct/proxy model if blockchain_type == 'fabric': return FabricWorkerRegistryImpl(config) elif blockchain_type == 'ethereum': return EthereumWorkerRegistryImpl(config) else: return JRPCWorkerRegistryImpl(config)
def __init__(self, config_file): super(TestFabricWorkerRegistryImpl, self).__init__() if not path.isfile(config_file): raise FileNotFoundError("File not found at path: {0}".format( path.realpath(config_file))) try: with open(config_file) as fd: self.__config = toml.load(fd) except IOError as e: if e.errno != errno.ENOENT: raise Exception("Could not open config file: %s", e) self.__eth_conn = FabricWorkerRegistryImpl(self.__config)
def __init__(self, listener_url): tcf_home = environ.get("TCF_HOME", "../../../") config_file = tcf_home + "/sdk/avalon_sdk/tcf_connector.toml" if not path.isfile(config_file): raise FileNotFoundError("File not found at path: {0}".format( path.realpath(config_file))) try: with open(config_file) as fd: self.__config = toml.load(fd) except IOError as e: if e.errno != errno.ENOENT: raise Exception("Could not open config file: %s", e) self.__config['tcf']['json_rpc_uri'] = listener_url self.__fabric_worker = FabricWorkerRegistryImpl(self.__config) self.__fabric_work_order = FabricWorkOrderImpl(self.__config) self.__jrpc_worker = JRPCWorkerRegistryImpl(self.__config) self.__jrpc_work_order = JRPCWorkOrderImpl(self.__config) # Wait time in sec self.WAIT_TIME = 31536000 nest_asyncio.apply()