예제 #1
0
        private void GivenAStartedBackChannelHost(ForkedExecutionConfiguration config)
        {
            config.BackendAddress = string.Empty;

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

            backChannelHost.Start();
        }
        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();
        }
예제 #3
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();
        }
예제 #4
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);
        }
예제 #5
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();
        }
예제 #6
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");
                }
            }
        }