mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 20:30:50 +08:00 
			
		
		
		
	Add ability to specify scheme of ServiceProviderConfiguration
This commit is contained in:
		@@ -105,7 +105,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
                GlobalConfiguration = new FileGlobalConfiguration()
 | 
			
		||||
            };
 | 
			
		||||
            _reRoutes = new List<ReRoute>();
 | 
			
		||||
            _spc = new ServiceProviderConfiguration("", "", 1, "", "", 1);
 | 
			
		||||
            _spc = new ServiceProviderConfiguration("", "", "", 1, "", "", 1);
 | 
			
		||||
            _lbo = new LoadBalancerOptionsBuilder().Build();
 | 
			
		||||
            _qoso = new QoSOptions(1, 1, 1, "");
 | 
			
		||||
            _hho = new HttpHandlerOptionsBuilder().Build();
 | 
			
		||||
 
 | 
			
		||||
@@ -139,6 +139,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
        private void ThenTheConfigurationIsStoredAs(FileConfiguration expecteds)
 | 
			
		||||
        {
 | 
			
		||||
            _result.GlobalConfiguration.RequestIdKey.ShouldBe(expecteds.GlobalConfiguration.RequestIdKey);
 | 
			
		||||
            _result.GlobalConfiguration.ServiceDiscoveryProvider.Scheme.ShouldBe(expecteds.GlobalConfiguration.ServiceDiscoveryProvider.Scheme);
 | 
			
		||||
            _result.GlobalConfiguration.ServiceDiscoveryProvider.Host.ShouldBe(expecteds.GlobalConfiguration.ServiceDiscoveryProvider.Host);
 | 
			
		||||
            _result.GlobalConfiguration.ServiceDiscoveryProvider.Port.ShouldBe(expecteds.GlobalConfiguration.ServiceDiscoveryProvider.Port);
 | 
			
		||||
 | 
			
		||||
@@ -196,6 +197,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
        private void ThenTheFollowingIsReturned(FileConfiguration expecteds)
 | 
			
		||||
        {
 | 
			
		||||
            _result.GlobalConfiguration.RequestIdKey.ShouldBe(expecteds.GlobalConfiguration.RequestIdKey);
 | 
			
		||||
            _result.GlobalConfiguration.ServiceDiscoveryProvider.Scheme.ShouldBe(expecteds.GlobalConfiguration.ServiceDiscoveryProvider.Scheme);
 | 
			
		||||
            _result.GlobalConfiguration.ServiceDiscoveryProvider.Host.ShouldBe(expecteds.GlobalConfiguration.ServiceDiscoveryProvider.Host);
 | 
			
		||||
            _result.GlobalConfiguration.ServiceDiscoveryProvider.Port.ShouldBe(expecteds.GlobalConfiguration.ServiceDiscoveryProvider.Port);
 | 
			
		||||
 | 
			
		||||
@@ -243,6 +245,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
            {
 | 
			
		||||
                ServiceDiscoveryProvider = new FileServiceDiscoveryProvider
 | 
			
		||||
                {
 | 
			
		||||
                    Scheme = "https",
 | 
			
		||||
                    Port = 198,
 | 
			
		||||
                    Host = "blah"
 | 
			
		||||
                }
 | 
			
		||||
@@ -278,6 +281,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
            {
 | 
			
		||||
                ServiceDiscoveryProvider = new FileServiceDiscoveryProvider
 | 
			
		||||
                {
 | 
			
		||||
                    Scheme = "https",
 | 
			
		||||
                    Port = 198,
 | 
			
		||||
                    Host = "blah"
 | 
			
		||||
                }
 | 
			
		||||
 
 | 
			
		||||
@@ -26,6 +26,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
            {
 | 
			
		||||
                ServiceDiscoveryProvider = new FileServiceDiscoveryProvider
 | 
			
		||||
                {
 | 
			
		||||
                    Scheme = "https",
 | 
			
		||||
                    Host = "127.0.0.1",
 | 
			
		||||
                    Port = 1234,
 | 
			
		||||
                    Type = "ServiceFabric",
 | 
			
		||||
@@ -36,6 +37,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            var expected = new ServiceProviderConfigurationBuilder()
 | 
			
		||||
                .WithScheme("https")
 | 
			
		||||
                .WithHost("127.0.0.1")
 | 
			
		||||
                .WithPort(1234)
 | 
			
		||||
                .WithType("ServiceFabric")
 | 
			
		||||
@@ -62,6 +64,7 @@ namespace Ocelot.UnitTests.Configuration
 | 
			
		||||
 | 
			
		||||
        private void ThenTheConfigIs(ServiceProviderConfiguration expected)
 | 
			
		||||
        {
 | 
			
		||||
            _result.Scheme.ShouldBe(expected.Scheme);
 | 
			
		||||
            _result.Host.ShouldBe(expected.Host);
 | 
			
		||||
            _result.Port.ShouldBe(expected.Port);
 | 
			
		||||
            _result.Token.ShouldBe(expected.Token);
 | 
			
		||||
 
 | 
			
		||||
@@ -57,6 +57,7 @@
 | 
			
		||||
                {
 | 
			
		||||
                    ServiceDiscoveryProvider = new FileServiceDiscoveryProvider
 | 
			
		||||
                    {
 | 
			
		||||
                        Scheme = "https",
 | 
			
		||||
                        Host = "localhost",
 | 
			
		||||
                        Type = "ServiceFabric",
 | 
			
		||||
                        Port = 8500
 | 
			
		||||
@@ -90,6 +91,7 @@
 | 
			
		||||
                {
 | 
			
		||||
                    ServiceDiscoveryProvider = new FileServiceDiscoveryProvider
 | 
			
		||||
                    {
 | 
			
		||||
                        Scheme = "https",
 | 
			
		||||
                        Host = "localhost",
 | 
			
		||||
                        Type = "FakeServiceDiscoveryProvider",
 | 
			
		||||
                        Port = 8500
 | 
			
		||||
@@ -113,6 +115,7 @@
 | 
			
		||||
                {
 | 
			
		||||
                    ServiceDiscoveryProvider = new FileServiceDiscoveryProvider
 | 
			
		||||
                    {
 | 
			
		||||
                        Scheme = "https",
 | 
			
		||||
                        Host = "localhost",
 | 
			
		||||
                        Type = "FakeServiceDiscoveryProvider",
 | 
			
		||||
                        Port = 8500
 | 
			
		||||
@@ -147,6 +150,7 @@
 | 
			
		||||
                {
 | 
			
		||||
                    ServiceDiscoveryProvider = new FileServiceDiscoveryProvider
 | 
			
		||||
                    {
 | 
			
		||||
                        Scheme = "https",
 | 
			
		||||
                        Host = "localhost",
 | 
			
		||||
                        Type = "FakeServiceDiscoveryProvider",
 | 
			
		||||
                        Port = 8500
 | 
			
		||||
@@ -171,6 +175,7 @@
 | 
			
		||||
                {
 | 
			
		||||
                    ServiceDiscoveryProvider = new FileServiceDiscoveryProvider
 | 
			
		||||
                    {
 | 
			
		||||
                        Scheme = "https",
 | 
			
		||||
                        Host = "localhost",
 | 
			
		||||
                        Type = "FakeServiceDiscoveryProvider",
 | 
			
		||||
                        Port = 8500
 | 
			
		||||
@@ -206,6 +211,7 @@
 | 
			
		||||
                {
 | 
			
		||||
                    ServiceDiscoveryProvider = new FileServiceDiscoveryProvider
 | 
			
		||||
                    {
 | 
			
		||||
                        Scheme = "https",
 | 
			
		||||
                        Host = "localhost",
 | 
			
		||||
                        Type = "consul",
 | 
			
		||||
                        Port = 8500
 | 
			
		||||
@@ -1197,6 +1203,7 @@
 | 
			
		||||
                {
 | 
			
		||||
                    ServiceDiscoveryProvider = new FileServiceDiscoveryProvider
 | 
			
		||||
                    {
 | 
			
		||||
                        Scheme = "https",
 | 
			
		||||
                        Type = "servicefabric",
 | 
			
		||||
                        Host = "localhost",
 | 
			
		||||
                        Port = 1234
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user