public MockSetup(IDataStore dataStore, IChainCreationService chainCreationService, IChainService chainService, IActorEnvironment actorEnvironment, IChainContextService chainContextService, IFunctionMetadataService functionMetadataService, ISmartContractRunnerFactory smartContractRunnerFactory, ILogger logger, IStateStore stateStore, HashManager hashManager, TransactionManager transactionManager) { _logger = logger; _stateStore = stateStore; ActorEnvironment = actorEnvironment; if (!ActorEnvironment.Initialized) { ActorEnvironment.InitActorSystem(); } _hashManager = hashManager; _transactionManager = transactionManager; _chainCreationService = chainCreationService; _chainService = chainService; ChainContextService = chainContextService; _functionMetadataService = functionMetadataService; _smartContractRunnerFactory = smartContractRunnerFactory; SmartContractManager = new SmartContractManager(dataStore); Task.Factory.StartNew(async() => { await Init(); }).Unwrap().Wait(); SmartContractService = new SmartContractService(SmartContractManager, _smartContractRunnerFactory, stateStore, functionMetadataService); Task.Factory.StartNew(async() => { await DeploySampleContracts(); }).Unwrap().Wait(); ServicePack = new ServicePack() { ChainContextService = chainContextService, SmartContractService = SmartContractService, ResourceDetectionService = new NewMockResourceUsageDetectionService(), StateStore = _stateStore }; // These are only required for workertest // other tests use ActorEnvironment var workers = new[] { "/user/worker1", "/user/worker2" }; Worker1 = Sys.ActorOf(Props.Create <Worker>(), "worker1"); Worker2 = Sys.ActorOf(Props.Create <Worker>(), "worker2"); Router = Sys.ActorOf(Props.Empty.WithRouter(new TrackedGroup(workers)), "router"); Worker1.Tell(new LocalSerivcePack(ServicePack)); Worker2.Tell(new LocalSerivcePack(ServicePack)); Requestor = Sys.ActorOf(AElf.Execution.Execution.Requestor.Props(Router)); }
public WorkerCoordinator(IUnitOfWork uow, Worker1 worker1, Worker2 worker2) { Uow = uow; Worker1 = worker1; Worker2 = worker2; }
public static void Execute <T>(string subor, bool save, bool close, string ulozAko, Worker2 <Workbook, T> worker, T param) { Workbook workbook = Startup(subor); try { worker(workbook, param); } finally { Cleanup(workbook, save, close, ulozAko); } }