public BackChannelWebHost(IJobbrServiceProvider jobbrServiceProvider, ForkedExecutionConfiguration configuration)
        {
            Logger.Debug("Constructing new BackChannelWebHost");

            this.jobbrServiceProvider = jobbrServiceProvider;
            this.configuration        = configuration;
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="JobRunContext"/> class.
        /// </summary>
        public JobRunContext(JobRunInfo jobRunInfoIfo, ForkedExecutionConfiguration configuration, IJobRunProgressChannel progressChannel)
        {
            this.jobRunInfo      = jobRunInfoIfo;
            this.configuration   = configuration;
            this.progressChannel = progressChannel;

            this.serviceMessageParser = new ServiceMessageParser();
        }
Esempio n. 3
0
        private void GivenAStartedBackChannelHost(ForkedExecutionConfiguration config)
        {
            config.BackendAddress = string.Empty;

            var backChannelHost = new BackChannelWebHost(new JobbrServiceProviderMock(this.jobRunInformationService, this.storedProgressUpdates), config);

            backChannelHost.Start();
        }
        protected ForkedJobExecutor GivenAMockedExecutor(ForkedExecutionConfiguration forkedExecutionConfiguration)
        {
            this.jobRunContextMockFactory = new JobRunContextMockFactory(this.ProgressChannelStore);

            this.periodicTimerMock  = new PeriodicTimerMock();
            this.manualTimeProvider = new ManualTimeProvider();

            var executor = new ForkedJobExecutor(this.jobRunContextMockFactory, this.jobRunInformationService, this.ProgressChannelStore, this.periodicTimerMock, this.manualTimeProvider, forkedExecutionConfiguration);

            return(executor);
        }
Esempio n. 5
0
        public ForkedJobExecutor(IJobRunContextFactory jobRunContextFactory, IJobRunInformationService jobRunInformationService, IJobRunProgressChannel progressChannel, IPeriodicTimer periodicTimer, IDateTimeProvider dateTimeProvider, ForkedExecutionConfiguration configuration)
        {
            this.jobRunContextFactory     = jobRunContextFactory;
            this.jobRunInformationService = jobRunInformationService;
            this.configuration            = configuration;
            this.progressChannel          = progressChannel;
            this.periodicTimer            = periodicTimer;
            this.dateTimeProvider         = dateTimeProvider;

            this.periodicTimer.Setup(this.StartReadyJobsFromQueue, StartNewJobsEverySeconds);
        }
        private void GivenARunningServer()
        {
            var config = new ForkedExecutionConfiguration()
            {
                BackendAddress = this.configBackendAddress
            };

            var webHost = new BackChannelWebHost(new JobbrServiceProviderMock(new JobRunInfoServiceMock(this.fakeStore), this.channelFakeStore), config);

            webHost.Start();
        }
        protected static ForkedExecutionConfiguration GivenAMinimalConfiguration()
        {
            var forkedExecutionConfiguration = new ForkedExecutionConfiguration()
            {
                BackendAddress         = "notNeeded",
                JobRunDirectory        = Path.GetTempPath(),
                JobRunnerExecutable    = "Jobbr.Server.ForkedExecution.TestEcho.exe",
                MaxConcurrentProcesses = 4
            };

            return(forkedExecutionConfiguration);
        }
Esempio n. 8
0
        public void BackChannel_StartedTwice_RaisesException()
        {
            var forkedExecutionConfiguration = new ForkedExecutionConfiguration
            {
                BackendAddress = "http://localhost:" + TcpPortHelper.NextFreeTcpPort()
            };

            var host = new BackChannelWebHost(new JobbrServiceProviderMock(null, null), forkedExecutionConfiguration);

            host.Start();
            host.Start();
        }
Esempio n. 9
0
        public void BackChannel_StartWebHost_StatusUrlIsAvailable()
        {
            var forkedExecutionConfiguration = new ForkedExecutionConfiguration
            {
                BackendAddress = "http://localhost:" + TcpPortHelper.NextFreeTcpPort()
            };

            var host = new BackChannelWebHost(new JobbrServiceProviderMock(null, null), forkedExecutionConfiguration);

            host.Start();

            var response = new HttpClient().GetAsync(forkedExecutionConfiguration.BackendAddress + "/fex/status").Result;

            Assert.IsTrue(response.IsSuccessStatusCode);
        }
Esempio n. 10
0
        public void BackChannel_PortInUse_RaisesException()
        {
            var nextFreeTcpPort = TcpPortHelper.NextFreeTcpPort();

            // intentionally block port
            new TcpListener(IPAddress.Any, nextFreeTcpPort).Start();


            var forkedExecutionConfiguration = new ForkedExecutionConfiguration
            {
                BackendAddress = "http://localhost:" + nextFreeTcpPort
            };

            var host = new BackChannelWebHost(new JobbrServiceProviderMock(null, null), forkedExecutionConfiguration);

            host.Start();
        }
Esempio n. 11
0
        public async Task BackChannel_AfterDisposal_IsNotAvailable()
        {
            var forkedExecutionConfiguration = new ForkedExecutionConfiguration
            {
                BackendAddress = "http://localhost:" + TcpPortHelper.NextFreeTcpPort()
            };

            var host = new BackChannelWebHost(new JobbrServiceProviderMock(null, null), forkedExecutionConfiguration);

            host.Start();
            host.Dispose();
            try
            {
                await new HttpClient().GetAsync(forkedExecutionConfiguration.BackendAddress + "/fex/status");
            }
            catch (Exception ex)
            {
                if (ex.InnerException is WebException == false)
                {
                    Assert.Fail("Exception thrown was " + ex.InnerException + ", which is not the expected exception");
                }
            }
        }
 public JobRunContextFactory(ForkedExecutionConfiguration configuration, IJobRunProgressChannel progressChannel)
 {
     this.configuration   = configuration;
     this.progressChannel = progressChannel;
 }