示例#1
0
        public static void DoWork2()
        {
            Console.WriteLine("Just creates an instance of demo class and call it's method");
            Worker1 w1 = new Worker1();

            w1.printMsg();
            Console.WriteLine(w1.addNumbers(5, 2));
            Console.WriteLine("Press any key to continue");
            Console.ReadLine();
        }
示例#2
0
文件: MockSetup.cs 项目: wyk125/AElf
        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 WorkerCoordinator(IUnitOfWork uow, Worker1 worker1, Worker2 worker2)
 {
     Uow = uow;
     Worker1 = worker1;
     Worker2 = worker2;
 }
 public TestCaseMultiBase(ITestOutputHelper testOutputHelper)
 {
     Worker = new Worker1(this, testOutputHelper);
 }
 public MonitorJob(Worker1 worker1)
 {
     this._worker1 = worker1;
 }
示例#7
0
        public static void Execute(string subor, bool save, bool close, string ulozAko, Worker1 <Workbook> worker)
        {
            Workbook workbook = Startup(subor);

            try     { worker(workbook); }
            finally { Cleanup(workbook, save, close, ulozAko); }
        }