Esempio n. 1
0
        public void SetUp(Action <IHttpService> bootstrap = null)
        {
            _bus = new InMemoryBus($"bus_{_serverEndPoint.Port}");
            var pipelineBus = InMemoryBus.CreateTest();
            var queue       = new QueuedHandlerThreadPool(pipelineBus, "Test", new QueueStatsManager(), true, TimeSpan.FromMilliseconds(50));

            _multiQueuedHandler = new MultiQueuedHandler(new IQueuedHandler[] { queue }, null);
            _multiQueuedHandler.Start();

            _service = new KestrelHttpService(ServiceAccessibility.Private, _bus, new NaiveUriRouter(),
                                              _multiQueuedHandler, false, null, 0, false, _serverEndPoint);
            _internalDispatcher = new InternalDispatcherEndpoint(queue, _multiQueuedHandler);
            _bus.Subscribe(_internalDispatcher);
            KestrelHttpService.CreateAndSubscribePipeline(pipelineBus);
            bootstrap?.Invoke(_service);
            _server = new TestServer(
                new WebHostBuilder()
                .UseStartup(new ClusterVNodeStartup(Array.Empty <ISubsystem>(), queue, _bus, _multiQueuedHandler,
                                                    new TestAuthenticationProvider(),
                                                    new IHttpAuthenticationProvider[] {
                new BasicHttpAuthenticationProvider(new TestAuthenticationProvider()),
                new AnonymousHttpAuthenticationProvider(),
            }, new TestAuthorizationProvider(), new FakeReadIndex(_ => false), 1024 * 1024, _service)));
            _httpMessageHandler = _server.CreateHandler();
            _client             = new HttpAsyncClient(_timeout, _httpMessageHandler);

            HttpBootstrap.Subscribe(_bus, _service);
        }
Esempio n. 2
0
        public void TearDown()
        {
            HttpBootstrap.Unsubscribe(_bus, _service);

            _service.Shutdown();
            _multiQueuedHandler.Stop();
        }
Esempio n. 3
0
        public void SetUp()
        {
            _bus = new InMemoryBus(string.Format("bus_{0}", _serverEndPoint.Port));

            _service = new HttpService(ServiceAccessibility.Private, _bus, new[] { _serverEndPoint.ToHttpUrl() });
            _client  = new HttpAsyncClient();

            HttpBootstrap.Subscribe(_bus, _service);
        }
Esempio n. 4
0
        public void TearDown()
        {
            HttpBootstrap.Unsubscribe(_bus, _service);

            _service.Shutdown();
            _httpMessageHandler?.Dispose();
            _client.Dispose();
            _multiQueuedHandler.Stop();
            _server?.Dispose();
        }
Esempio n. 5
0
        public void SetUp()
        {
            _bus = new InMemoryBus(string.Format("bus_{0}", _serverEndPoint.Port));

            {
                var pipelineBus = InMemoryBus.CreateTest();
                var queue       = new QueuedHandlerThreadPool(pipelineBus, "Test", true, TimeSpan.FromMilliseconds(50));
                _multiQueuedHandler = new MultiQueuedHandler(new IQueuedHandler[] { queue }, null);
                var httpAuthenticationProviders = new HttpAuthenticationProvider[] { new AnonymousHttpAuthenticationProvider() };

                _service = new HttpService(ServiceAccessibility.Private, _bus, new NaiveUriRouter(),
                                           _multiQueuedHandler, false, _serverEndPoint.ToHttpUrl());
                HttpService.CreateAndSubscribePipeline(pipelineBus, httpAuthenticationProviders);
                _client = new HttpAsyncClient();
            }

            HttpBootstrap.Subscribe(_bus, _service);
        }
Esempio n. 6
0
        public void SetUp(Action <IHttpService> bootstrap = null)
        {
            _bus = new InMemoryBus($"bus_{_serverEndPoint.Port}");
            var pipelineBus = InMemoryBus.CreateTest();
            var queue       = new QueuedHandlerThreadPool(pipelineBus, "Test", new QueueStatsManager(), true, TimeSpan.FromMilliseconds(50));

            _multiQueuedHandler = new MultiQueuedHandler(new IQueuedHandler[] { queue }, null);
            _multiQueuedHandler.Start();

            _service = new KestrelHttpService(ServiceAccessibility.Private, _bus, new NaiveUriRouter(),
                                              _multiQueuedHandler, false, null, 0, false, _serverEndPoint);
            KestrelHttpService.CreateAndSubscribePipeline(pipelineBus);
            bootstrap?.Invoke(_service);
            _server = new TestServer(
                new WebHostBuilder()
                .UseStartup(new HttpServiceStartup(_service)));
            _httpMessageHandler = _server.CreateHandler();
            _client             = new HttpAsyncClient(_timeout, _httpMessageHandler);

            HttpBootstrap.Subscribe(_bus, _service);
        }
Esempio n. 7
0
        public void TearDown()
        {
            HttpBootstrap.Unsubscribe(_bus, _service);

            _service.Shutdown();
        }