Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

Commit

Permalink
React to aspnet/Congifuration #195,#198
Browse files Browse the repository at this point in the history
  • Loading branch information
kirthik committed May 20, 2015
1 parent 1566f72 commit b75a855
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNet.FeatureModel;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.Configuration;

namespace Microsoft.AspNet.Hosting.Server
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNet.FeatureModel": "1.0.0-*",
"Microsoft.Framework.ConfigurationModel.Abstractions": "1.0.0-*"
"Microsoft.Framework.Configuration.Abstractions": "1.0.0-*"
},

"frameworks": {
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.AspNet.Hosting/Internal/HostingEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
using Microsoft.AspNet.Hosting.Startup;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Features;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.Configuration;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Internal;
using Microsoft.Framework.Logging;
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.AspNet.Hosting/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNet.Hosting.Internal;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.Configuration;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Runtime;

Expand All @@ -25,7 +25,7 @@ public Program(IServiceProvider serviceProvider)

public void Main(string[] args)
{
var config = new Configuration();
var config = new ConfigurationSection();
if (File.Exists(HostingIniFile))
{
config.AddIniFile(HostingIniFile);
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.AspNet.Hosting/WebHostBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Microsoft.AspNet.Hosting.Internal;
using Microsoft.AspNet.Hosting.Server;
using Microsoft.AspNet.Hosting.Startup;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.Configuration;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Internal;
using Microsoft.Framework.Logging;
Expand Down Expand Up @@ -42,7 +42,7 @@ public class WebHostBuilder
private string _serverFactoryLocation;
private IServerFactory _serverFactory;

public WebHostBuilder([NotNull] IServiceProvider services) : this(services, config: new Configuration()) { }
public WebHostBuilder([NotNull] IServiceProvider services) : this(services, config: new ConfigurationSection()) { }

public WebHostBuilder([NotNull] IServiceProvider services, [NotNull] IConfiguration config)
{
Expand Down
5 changes: 4 additions & 1 deletion src/Microsoft.AspNet.Hosting/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
"Microsoft.AspNet.Hosting.Server.Abstractions": "1.0.0-*",
"Microsoft.AspNet.Http": "1.0.0-*",
"Microsoft.AspNet.Http.Extensions": "1.0.0-*",
"Microsoft.Framework.ConfigurationModel": "1.0.0-*",
"Microsoft.Framework.Configuration": "1.0.0-*",
"Microsoft.Framework.Configuration.CommandLine": "1.0.0-*",
"Microsoft.Framework.Configuration.EnvironmentVariables": "1.0.0-*",
"Microsoft.Framework.Configuration.Ini": "1.0.0-*",
"Microsoft.Framework.DependencyInjection": "1.0.0-*",
"Microsoft.Framework.Logging": "1.0.0-*",
"Microsoft.Framework.Runtime.Abstractions": "1.0.0-*",
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.AspNet.TestHost/TestServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using Microsoft.AspNet.Hosting.Server;
using Microsoft.AspNet.Hosting.Startup;
using Microsoft.AspNet.Http;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.Configuration;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Runtime.Infrastructure;

Expand Down Expand Up @@ -79,7 +79,7 @@ public static WebHostBuilder CreateBuilder(IServiceProvider services, IConfigura
{
return new WebHostBuilder(
services ?? CallContextServiceLocator.Locator.ServiceProvider,
config ?? new Configuration());
config ?? new ConfigurationSection());
}

public static WebHostBuilder CreateBuilder()
Expand Down
14 changes: 8 additions & 6 deletions test/Microsoft.AspNet.Hosting.Tests/HostingEngineTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Features;
using Microsoft.AspNet.Testing.xunit;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.Configuration;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Logging;
using Microsoft.Framework.OptionsModel;
Expand Down Expand Up @@ -50,7 +50,7 @@ public void CanStartWithOldServerConfig()
{ "server", "Microsoft.AspNet.Hosting.Tests" }
};

var config = new Configuration()
var config = new ConfigurationSection()
.Add(new MemoryConfigurationSource(vals));
var host = CreateBuilder(config).Build();
host.Start();
Expand All @@ -65,7 +65,7 @@ public void CanStartWithServerConfig()
{ "Hosting:Server", "Microsoft.AspNet.Hosting.Tests" }
};

var config = new Configuration()
var config = new ConfigurationSection()
.Add(new MemoryConfigurationSource(vals));
var host = CreateBuilder(config).Build();
host.Start();
Expand Down Expand Up @@ -155,7 +155,7 @@ public void EnvDefaultsToConfigValueIfSpecifiedWithOldKey()
{ "ASPNET_ENV", "Staging" }
};

var config = new Configuration()
var config = new ConfigurationSection()
.Add(new MemoryConfigurationSource(vals));

var engine = CreateBuilder(config).Build();
Expand All @@ -171,7 +171,7 @@ public void EnvDefaultsToConfigValueIfSpecified()
{ "Hosting:Environment", "Staging" }
};

var config = new Configuration()
var config = new ConfigurationSection()
.Add(new MemoryConfigurationSource(vals));

var engine = CreateBuilder(config).Build();
Expand Down Expand Up @@ -380,7 +380,9 @@ private void RunMapPath(string virtualPath, string expectedSuffix)

private WebHostBuilder CreateBuilder(IConfiguration config = null)
{
return new WebHostBuilder(CallContextServiceLocator.Locator.ServiceProvider, config ?? new Configuration());
return new WebHostBuilder(
CallContextServiceLocator.Locator.ServiceProvider,
config ?? new ConfigurationSection());
}

public IServerInformation Initialize(IConfiguration configuration)
Expand Down
7 changes: 5 additions & 2 deletions test/Microsoft.AspNet.TestHost.Tests/TestServerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Http;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.Configuration;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Logging;
using Microsoft.Framework.Runtime.Infrastructure;
Expand All @@ -34,7 +34,10 @@ public void ThrowsIfNoApplicationEnvironmentIsRegisteredWithTheProvider()
var services = new ServiceCollection().BuildServiceProvider();

// Act & Assert
Assert.Throws<InvalidOperationException>(() => TestServer.Create(services, new Configuration(), new Startup().Configure, configureServices: null));
Assert.Throws<InvalidOperationException>(
() => TestServer.Create(
services,
new ConfigurationSection(), new Startup().Configure, configureServices: null));
}

[Fact]
Expand Down

0 comments on commit b75a855

Please sign in to comment.