Пример #1
0
def fake_node(db_manager, fake_pool_cfg, fake_upgrader, fake_restarter, fake_pool_manager):
    wm = WriteRequestManager(database_manager=db_manager)
    rm = ReadRequestManager()
    return FakeSomething(write_manager=wm,
                         read_manager=rm,
                         db_manager=db_manager,
                         write_req_validator=write_auth_req_validator,
                         config=FakeSomething(stewardThreshold=20),
                         poolCfg=fake_pool_cfg,
                         upgrader=fake_upgrader,
                         restarter=fake_restarter,
                         poolManager=fake_pool_manager)
Пример #2
0
def create_test_write_req_manager(name: str,
                                  genesis_txns: List) -> WriteRequestManager:
    db_manager = DatabaseManager()
    write_manager = WriteRequestManager(db_manager)
    read_manager = ReadRequestManager()

    bootstrap = TestLedgersBootstrap(write_req_manager=write_manager,
                                     read_req_manager=read_manager,
                                     action_req_manager=FakeSomething(),
                                     name=name,
                                     config=getConfig(),
                                     ledger_ids=Node.ledger_ids)
    bootstrap.set_genesis_transactions(
        [txn for txn in genesis_txns if get_type(txn) == NODE],
        [txn for txn in genesis_txns if get_type(txn) == NYM])
    bootstrap.init()

    return write_manager
Пример #3
0
def create_test_write_req_manager(name: str,
                                  genesis_txns: List) -> WriteRequestManager:
    db_manager = DatabaseManager()
    write_manager = WriteRequestManager(db_manager)
    read_manager = ReadRequestManager()

    register_test_handler(write_manager)
    db_manager.register_new_store(SEQ_NO_DB_LABEL,
                                  ReqIdrToTxn(KeyValueStorageInMemory()))

    bootstrap = TestLedgersBootstrap(write_req_manager=write_manager,
                                     read_req_manager=read_manager,
                                     action_req_manager=FakeSomething(),
                                     name=name,
                                     config=getConfig(),
                                     ledger_ids=Node.ledger_ids)
    bootstrap.set_genesis_transactions(
        [txn for txn in genesis_txns if get_type(txn) == NODE],
        [txn for txn in genesis_txns if get_type(txn) == NYM])
    bootstrap.init()

    return write_manager
Пример #4
0
def fake_node(db_manager, fake_pool_cfg, fake_upgrader, fake_restarter,
              fake_pool_manager):
    wm = WriteRequestManager(database_manager=db_manager)
    rm = ReadRequestManager()
    am = ActionRequestManager()
    return FakeSomething(
        name="fake_node",
        dataLocation="//place_that_cannot_exist",
        genesis_dir="//place_that_cannot_exist",
        ledger_ids=Node.ledger_ids,
        write_manager=wm,
        read_manager=rm,
        action_manager=am,
        db_manager=db_manager,
        write_req_validator=write_auth_req_validator,
        config=FakeSomething(
            stewardThreshold=20,
            poolTransactionsFile="//pool_genesis_that_cannot_exist",
            domainTransactionsFile="//domain_genesis_that_cannot_exist"),
        poolCfg=fake_pool_cfg,
        upgrader=fake_upgrader,
        restarter=fake_restarter,
        poolManager=fake_pool_manager)