public void EstablishContext()
        {
            _service = new TestService();
            _service2 = new TestService2();

            _serviceCoordinator = new ServiceCoordinator(x => { }, x => { }, x => { });
            IList<Func<IServiceController>> services = new List<Func<IServiceController>>
                                                       {
                                                           () =>
                                                           new ServiceController<TestService>("test")
                                                           {
                                                               BuildService = s=> _service,
                                                               StartAction = x => x.Start(),
                                                               StopAction = x => x.Stop(),
                                                               ContinueAction = x => x.Continue(),
                                                               PauseAction = x => x.Pause()
                                                           },
                                                           () =>
                                                           new ServiceController<TestService2>("test2")
                                                           {
                                                               BuildService = s=> _service2,
                                                               StartAction = x => x.Start(),
                                                               StopAction = x => x.Stop(),
                                                               ContinueAction = x => x.Continue(),
                                                               PauseAction = x => x.Pause()
                                                           }
                                                       };

            _serviceCoordinator.RegisterServices(services);
            _serviceCoordinator.Start();

            Thread.Sleep(2.Seconds());
        }
        public void EstablishContext()
        {
            _service = new TestService();
            _service2 = new TestService2();

            _serviceCoordinator = new ServiceCoordinator(new PoolFiber(), x => { }, x => { }, x => { }, 1.Minutes());
            _serviceCoordinator.CreateService("test",
                                              (inbox,coordinator) =>
                                              new LocalServiceController<TestService>("test", inbox, coordinator,
                                                                                 x => x.Start(),
                                                                                 x => x.Stop(),
                                                                                 x => x.Pause(),
                                                                                 x => x.Continue(),
                                                                                 (x, c) => _service));
            _serviceCoordinator.CreateService("test2",
                                              (inbox, coordinator) =>
                                              new LocalServiceController<TestService>("test2", inbox, coordinator,
                                                                                 x => x.Start(),
                                                                                 x => x.Stop(),
                                                                                 x => x.Pause(),
                                                                                 x =>
                                                                                 x.Continue(),
                                                                                 (x, c) =>
                                                                                 _service2));
            _serviceCoordinator.Start();

            _service.Running.WaitUntilCompleted(10.Seconds());
            _service2.Running.WaitUntilCompleted(10.Seconds());
        }
        public void EstablishContext()
        {
            _service  = new TestService();
            _service2 = new TestService2();

            _serviceCoordinator = new ServiceCoordinator(new PoolFiber(), x => { }, x => { }, x => { }, 1.Minutes());
            _serviceCoordinator.CreateService("test",
                                              (inbox, coordinator) =>
                                              new LocalServiceController <TestService>("test", inbox, coordinator,
                                                                                       x => x.Start(),
                                                                                       x => x.Stop(),
                                                                                       x => x.Pause(),
                                                                                       x => x.Continue(),
                                                                                       (x, c) => _service));
            _serviceCoordinator.CreateService("test2",
                                              (inbox, coordinator) =>
                                              new LocalServiceController <TestService>("test2", inbox, coordinator,
                                                                                       x => x.Start(),
                                                                                       x => x.Stop(),
                                                                                       x => x.Pause(),
                                                                                       x =>
                                                                                       x.Continue(),
                                                                                       (x, c) =>
                                                                                       _service2));
            _serviceCoordinator.Start();

            _service.Running.WaitUntilCompleted(10.Seconds());
            _service2.Running.WaitUntilCompleted(10.Seconds());
        }
        public void EstablishContext()
        {
            _service = new TestService();
            _service2 = new TestService2();

            _serviceCoordinator = new ServiceCoordinator(new ThreadPoolFiber(), x => { }, x => { }, x => { }, 1.Minutes());
            _serviceCoordinator.CreateService("test",
                                              n =>
                                              new ServiceController<TestService>("test", null,
                                                                                 AddressRegistry.GetOutboundCoordinatorChannel(),
                                                                                 x => x.Start(),
                                                                                 x => x.Stop(),
                                                                                 x => x.Pause(),
                                                                                 x => x.Continue(),
                                                                                 (x, c) => _service));
            _serviceCoordinator.CreateService("test2",
                                              n =>
                                              new ServiceController<TestService>("test2", null,
                                                                                 AddressRegistry.GetOutboundCoordinatorChannel(),
                                                                                 x => x.Start(),
                                                                                 x => x.Stop(),
                                                                                 x => x.Pause(),
                                                                                 x =>
                                                                                 x.Continue(),
                                                                                 (x, c) =>
                                                                                 _service2));
            _serviceCoordinator.Start();

            _service.Running.WaitUntilCompleted(10.Seconds());
            _service2.Running.WaitUntilCompleted(10.Seconds());
        }
        public void EstablishContext()
        {
            _service = new TestService();
            _service2 = new TestService2();

            _beforeStartingServicesInvoked = false;
            _afterStartingServicesInvoked = false;
            _afterStoppingServicesInvoked = false;

            _serviceCoordinator = new ServiceCoordinator(x => { _beforeStartingServicesInvoked = true; }, x => { _afterStartingServicesInvoked = true; }, x => { _afterStoppingServicesInvoked = true; });
            IList<Func<IServiceController>> services = new List<Func<IServiceController>>
                                                       {
                                                           () => new ServiceController<TestService>
                                                                 {
                                                                     Name = "test",
                                                                     BuildService = s => _service,
                                                                     StartAction = x => x.Start(),
                                                                     StopAction = x => x.Stop(),
                                                                     ContinueAction = x => x.Continue(),
                                                                     PauseAction = x => x.Pause()
                                                                 },
                                                           () => new ServiceController<TestService2>
                                                                 {
                                                                     Name = "test2",
                                                                     BuildService = s => _service2,
                                                                     StartAction = x => x.Start(),
                                                                     StopAction = x => x.Stop(),
                                                                     ContinueAction = x => x.Continue(),
                                                                     PauseAction = x => x.Pause()
                                                                 }
                                                       };

            _serviceCoordinator.RegisterServices(services);
        }
Exemple #6
0
        private IRunConfiguration Create()
        {
            var serviceCoordinator = new ServiceCoordinator(_beforeStartingServices, _beforeStart, _afterStop);

            serviceCoordinator.RegisterServices(_serviceConfigurators);
            var cfg = new RunConfiguration
            {
                WinServiceSettings = _winServiceSettings,
                Credentials        = _credentials,
                Coordinator        = serviceCoordinator
            };

            cfg.SetRunnerAction(_runnerAction, _winForm);
            return(cfg);
        }
        public void EstablishContext()
        {
            _service = new TestService();
            _service2 = new TestService2();

            _beforeStartingServicesInvoked = false;
            _afterStartingServicesInvoked = false;
            _afterStoppingServicesInvoked = false;

            _serviceCoordinator = new ServiceCoordinator(x => { _beforeStartingServicesInvoked = true; },
                                                         x => { _afterStartingServicesInvoked = true; },
                                                         x => { _afterStoppingServicesInvoked = true; },
                                                         10.Seconds());

            IList<Func<IServiceController>> services = new List<Func<IServiceController>>
                                                       {
                                                           () => new ServiceController<TestService>("test", WellknownAddresses.GetServiceCoordinatorProxy())
                                                                 {
                                                                     BuildService = s => _service,
                                                                     StartAction = x => x.Start(),
                                                                     StopAction = x => x.Stop(),
                                                                     ContinueAction = x => x.Continue(),
                                                                     PauseAction = x => x.Pause()
                                                                 },
                                                           () => new ServiceController<TestService2>("test2", WellknownAddresses.GetServiceCoordinatorProxy())
                                                                 {
                                                                     BuildService = s => _service2,
                                                                     StartAction = x => x.Start(),
                                                                     StopAction = x => x.Stop(),
                                                                     ContinueAction = x => x.Continue(),
                                                                     PauseAction = x => x.Pause()
                                                                 }
                                                       };

            _serviceCoordinator.RegisterServices(services);
        }
 public void A_service_coordinator()
 {
     ServiceCoordinator = new ServiceCoordinator(x => { }, x => { }, x => { }, 10.Seconds());
 }
Exemple #9
0
 public void CleanUp()
 {
     Coordinator.Dispose();
     Coordinator = null;
 }
Exemple #10
0
 public void A_service_coordinator()
 {
     Coordinator = new ServiceCoordinator(new PoolFiber(), Ignored, Ignored, Ignored, 10.Seconds());
 }