public CompositeRootControllerBase()
        {
            RootConfiguration = GetConfiguration();
            var config = CompositeRootHttpServerConfiguration.Create(RootConfiguration);

            CompositeRootConfiguration = config.ServerRootConfigurations.RootConfigurations.Values.First();
        }
示例#2
0
        public static void Setup(TestContext testContext)
        {
            _tester = new CompositeRootHttpServerTester(JsonConvert.DeserializeObject <RootHttpServerConfiguration>(File.ReadAllText(Path.Combine(Environment.CurrentDirectory, "BlogServerMonitorConfig.json"))));
            _tester.Initialize();

            _blogServerMonitorConfiguration = _tester.Configuration.ServerRootConfigurations.RootConfigurations.Values.First();
            _blogServerHttpServerConfig     = CompositeRootHttpServerConfiguration.Create(JsonConvert.DeserializeObject <RootHttpServerConfiguration>(File.ReadAllText(Path.Combine(Environment.CurrentDirectory, "BlogServerConfig.json"))));
            _blogServerConfig = _blogServerHttpServerConfig.ServerRootConfigurations.RootConfigurations.Values.First();
        }
        private void Initialize()
        {
            var configurationFile       = System.IO.Path.Combine(Environment.CurrentDirectory, "BlogServerConfig.json");
            var blogServerConfiguration = JsonConvert.DeserializeObject <RootHttpServerConfiguration>(File.ReadAllText(configurationFile));

            var serverConfiguration = CompositeRootHttpServerConfiguration.Create(blogServerConfiguration);

            BlogServer             = serverConfiguration.CreateServer() as BlogApplicationServer;
            BlogServer.BlogMonitor = this;
            BlogServer.Start();
        }
示例#4
0
        static void Main(string[] args)
        {
            var blogMonitorConfiguration = JsonConvert.DeserializeObject <RootHttpServerConfiguration>(File.ReadAllText(Path.Combine(Environment.CurrentDirectory, "BlogServerMonitorConfig.json")));
            var blogServerConfiguration  = JsonConvert.DeserializeObject <RootHttpServerConfiguration>(File.ReadAllText(Path.Combine(Environment.CurrentDirectory, "BlogServerConfig.json")));

            using (var server = CompositeRootHttpServerConfiguration.Create(blogMonitorConfiguration).CreateServer())
            {
                server.Start();
                OpenBrowser(blogServerConfiguration.RootConfigurations.First().Value.Endpoint);
                Console.ReadLine();
            }
        }
示例#5
0
        static void Main(string[] args)
        {
            var serverUrl = "http://localhost:8002/Chat/";

            using (var server = CompositeRootHttpServerConfiguration.Create(serverUrl,
                                                                            typeof(ChatRoot),
                                                                            CompositeRootMode.SingleHost)
                                .CreateServer())
            {
                server.Start();
                Console.WriteLine("Navigate to: " + serverUrl);
                Console.ReadLine();
            }
        }
        private CompositeRootHttpServerConfiguration Setup(RootHttpServerConfiguration rootHttpServerConfiguration)
        {
            if (rootHttpServerConfiguration == null)
            {
                throw new ArgumentNullException(nameof(rootHttpServerConfiguration));
            }

            foreach (var rootConfiguration in rootHttpServerConfiguration.RootConfigurations.Values)
            {
                if (string.IsNullOrEmpty(rootConfiguration.Endpoint))
                {
                    rootConfiguration.Endpoint = string.Format(CultureInfo.InvariantCulture, "http://{0}:{1}/{2}/", IPAddress.Loopback.ToString(), GetFreePortNumber(), GetType().Name);
                }
            }

            var serverConfiguration = new CompositeRootHttpServerConfiguration(rootHttpServerConfiguration);

            Configuration = serverConfiguration;
            return(serverConfiguration);
        }
        private CompositeRootHttpServerConfiguration Setup(Type compositeRootHttpServerType, Type compositeRootType, Type compositeRootAuthenticatorType)
        {
            if (compositeRootHttpServerType == null)
            {
                throw new ArgumentNullException(nameof(compositeRootHttpServerType));
            }

            if (compositeRootType == null)
            {
                throw new ArgumentNullException(nameof(compositeRootType));
            }

            if (compositeRootAuthenticatorType == null)
            {
                throw new ArgumentNullException(nameof(compositeRootAuthenticatorType));
            }

            if (!compositeRootHttpServerType.IsAssignableFrom(typeof(CompositeRootHttpServer)) && !compositeRootHttpServerType.IsSubclassOf(typeof(CompositeRootHttpServer)))
            {
                throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, Resources.MustBeOfType, compositeRootHttpServerType.Name, nameof(CompositeRootHttpServer)));
            }

            var port = GetFreePortNumber();

            var serverConfiguration = new CompositeRootHttpServerConfiguration(new RootHttpServerConfiguration {
                ServerType = compositeRootHttpServerType
            })
            {
                ServerBackgroundTaskInterval = TimeSpan.FromSeconds(15),
                ServerTypeName = compositeRootHttpServerType.AssemblyQualifiedName
            };

            serverConfiguration.ServerRootConfigurations.CreateNewRootConfiguration(string.Format(CultureInfo.InvariantCulture, "http://{0}:{1}/{2}/", IPAddress.Loopback.ToString(), port, GetType().Name),
                                                                                    compositeRootType, compositeRootAuthenticatorType, CompositeRootMode.MultipleHost, TimeSpan.FromMinutes(20));
            Configuration = serverConfiguration;
            return(serverConfiguration);
        }
示例#8
0
 public BlogServerMonitorServer(CompositeRootHttpServerConfiguration configuration, IEnumerable <Assembly> serviceAssemblies) : base(configuration, serviceAssemblies)
 {
 }
示例#9
0
 public BlogServerMonitorServer(CompositeRootHttpServerConfiguration configuration) : base(configuration)
 {
 }
 public CompositeRootHttpServerTester(CompositeRootHttpServerConfiguration configuration)
 {
     Server        = configuration.CreateServer();
     Configuration = configuration;
 }
 public BlogApplicationServer(CompositeRootHttpServerConfiguration configuration, IEnumerable <IService> services) : base(configuration, services)
 {
 }
 public BlogApplicationServer(CompositeRootHttpServerConfiguration configuration) : base(configuration)
 {
 }