mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-22 06:42:50 +08:00
got sidetracked and downgraded to .net core app 1.1 that actually exists no idea why i had 1.4 :(
This commit is contained in:
parent
9c9315a94f
commit
7900aa3f49
@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Ocelot.Values;
|
||||||
|
|
||||||
|
namespace Ocelot.ServiceDiscovery
|
||||||
|
{
|
||||||
|
public class ConsulServiceDiscoveryProvider : IServiceDiscoveryProvider
|
||||||
|
{
|
||||||
|
public List<Service> Get()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -7,6 +7,11 @@ namespace Ocelot.ServiceDiscovery
|
|||||||
{
|
{
|
||||||
public IServiceDiscoveryProvider Get(ServiceProviderConfiguraion serviceConfig)
|
public IServiceDiscoveryProvider Get(ServiceProviderConfiguraion serviceConfig)
|
||||||
{
|
{
|
||||||
|
if (serviceConfig.UseServiceDiscovery)
|
||||||
|
{
|
||||||
|
return GetServiceDiscoveryProvider(serviceConfig.ServiceName, serviceConfig.ServiceDiscoveryProvider);
|
||||||
|
}
|
||||||
|
|
||||||
var services = new List<Service>()
|
var services = new List<Service>()
|
||||||
{
|
{
|
||||||
new Service(serviceConfig.ServiceName, new HostAndPort(serviceConfig.DownstreamHost, serviceConfig.DownstreamPort))
|
new Service(serviceConfig.ServiceName, new HostAndPort(serviceConfig.DownstreamHost, serviceConfig.DownstreamPort))
|
||||||
@ -14,5 +19,10 @@ namespace Ocelot.ServiceDiscovery
|
|||||||
|
|
||||||
return new ConfigurationServiceProvider(services);
|
return new ConfigurationServiceProvider(services);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IServiceDiscoveryProvider GetServiceDiscoveryProvider(string serviceName, string serviceProviderName)
|
||||||
|
{
|
||||||
|
return new ConsulServiceDiscoveryProvider();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,41 +1,42 @@
|
|||||||
{
|
{
|
||||||
"version": "0.0.0-dev",
|
"version": "0.0.0-dev",
|
||||||
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
|
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
|
||||||
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
|
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
|
||||||
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
|
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
|
||||||
"Microsoft.Extensions.Configuration.Json": "1.1.0",
|
"Microsoft.Extensions.Configuration.Json": "1.1.0",
|
||||||
"Microsoft.Extensions.Logging": "1.1.0",
|
"Microsoft.Extensions.Logging": "1.1.0",
|
||||||
"Microsoft.Extensions.Logging.Console": "1.1.0",
|
"Microsoft.Extensions.Logging.Console": "1.1.0",
|
||||||
"Microsoft.Extensions.Logging.Debug": "1.1.0",
|
"Microsoft.Extensions.Logging.Debug": "1.1.0",
|
||||||
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
|
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
|
||||||
"Microsoft.AspNetCore.Http": "1.1.0",
|
"Microsoft.AspNetCore.Http": "1.1.0",
|
||||||
"System.Text.RegularExpressions": "4.3.0",
|
"System.Text.RegularExpressions": "4.3.0",
|
||||||
"Microsoft.AspNetCore.Authentication.OAuth": "1.1.0",
|
"Microsoft.AspNetCore.Authentication.OAuth": "1.1.0",
|
||||||
"Microsoft.AspNetCore.Authentication.JwtBearer": "1.1.0",
|
"Microsoft.AspNetCore.Authentication.JwtBearer": "1.1.0",
|
||||||
"Microsoft.AspNetCore.Authentication.OpenIdConnect": "1.1.0",
|
"Microsoft.AspNetCore.Authentication.OpenIdConnect": "1.1.0",
|
||||||
"Microsoft.AspNetCore.Authentication.Cookies": "1.1.0",
|
"Microsoft.AspNetCore.Authentication.Cookies": "1.1.0",
|
||||||
"Microsoft.AspNetCore.Authentication.Google": "1.1.0",
|
"Microsoft.AspNetCore.Authentication.Google": "1.1.0",
|
||||||
"Microsoft.AspNetCore.Authentication.Facebook": "1.1.0",
|
"Microsoft.AspNetCore.Authentication.Facebook": "1.1.0",
|
||||||
"Microsoft.AspNetCore.Authentication.Twitter": "1.1.0",
|
"Microsoft.AspNetCore.Authentication.Twitter": "1.1.0",
|
||||||
"Microsoft.AspNetCore.Authentication.MicrosoftAccount": "1.1.0",
|
"Microsoft.AspNetCore.Authentication.MicrosoftAccount": "1.1.0",
|
||||||
"Microsoft.AspNetCore.Authentication": "1.1.0",
|
"Microsoft.AspNetCore.Authentication": "1.1.0",
|
||||||
"IdentityServer4.AccessTokenValidation": "1.0.2",
|
"IdentityServer4.AccessTokenValidation": "1.0.2",
|
||||||
"Microsoft.AspNetCore.Mvc": "1.1.0",
|
"Microsoft.AspNetCore.Mvc": "1.1.0",
|
||||||
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
|
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
|
||||||
"Microsoft.NETCore.App": "1.1.0",
|
"Microsoft.NETCore.App": "1.1.0",
|
||||||
"CacheManager.Core": "0.9.2",
|
"CacheManager.Core": "0.9.2",
|
||||||
"CacheManager.Microsoft.Extensions.Configuration": "0.9.2",
|
"CacheManager.Microsoft.Extensions.Configuration": "0.9.2",
|
||||||
"CacheManager.Microsoft.Extensions.Logging": "0.9.2"
|
"CacheManager.Microsoft.Extensions.Logging": "0.9.2",
|
||||||
},
|
"Consul": "0.7.2.1"
|
||||||
|
},
|
||||||
"runtimes": {
|
"runtimes": {
|
||||||
"win10-x64": {},
|
"win10-x64": {},
|
||||||
"osx.10.11-x64":{},
|
"osx.10.11-x64":{},
|
||||||
"win7-x64": {}
|
"win7-x64": {}
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"netcoreapp1.4": {
|
"netcoreapp1.1": {
|
||||||
"imports": [
|
"imports": [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -4,15 +4,13 @@
|
|||||||
|
|
||||||
public static class TestConfiguration
|
public static class TestConfiguration
|
||||||
{
|
{
|
||||||
public static double Version => 1.4;
|
public static double Version => 1.1;
|
||||||
public static string ConfigurationPath => GetConfigurationPath();
|
public static string ConfigurationPath => GetConfigurationPath();
|
||||||
|
|
||||||
public static string GetConfigurationPath()
|
public static string GetConfigurationPath()
|
||||||
{
|
{
|
||||||
var osArchitecture = RuntimeInformation.OSArchitecture.ToString();
|
var osArchitecture = RuntimeInformation.OSArchitecture.ToString();
|
||||||
|
|
||||||
var oSDescription = string.Empty;
|
|
||||||
|
|
||||||
if(RuntimeInformation.OSDescription.ToLower().Contains("darwin"))
|
if(RuntimeInformation.OSDescription.ToLower().Contains("darwin"))
|
||||||
{
|
{
|
||||||
return FormatConfigurationPath("osx.10.11", osArchitecture);
|
return FormatConfigurationPath("osx.10.11", osArchitecture);
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
"win7-x64": {}
|
"win7-x64": {}
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"netcoreapp1.4": {
|
"netcoreapp1.1": {
|
||||||
"imports": [
|
"imports": [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Ocelot": "0.0.0-dev",
|
"Ocelot": "0.0.0-dev",
|
||||||
"BenchmarkDotNet": "0.10.1"
|
"BenchmarkDotNet": "0.10.2"
|
||||||
},
|
},
|
||||||
"runtimes": {
|
"runtimes": {
|
||||||
"win10-x64": {},
|
"win10-x64": {},
|
||||||
@ -14,7 +14,7 @@
|
|||||||
"win7-x64": {}
|
"win7-x64": {}
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"netcoreapp1.4": {
|
"netcoreapp1.1": {
|
||||||
"imports": [
|
"imports": [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
"win7-x64": {}
|
"win7-x64": {}
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"netcoreapp1.4": {
|
"netcoreapp1.1": {
|
||||||
"imports": [
|
"imports": [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,17 @@ namespace Ocelot.UnitTests.ServiceDiscovery
|
|||||||
.BDDfy();
|
.BDDfy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void should_return_consul_service_provider()
|
||||||
|
{
|
||||||
|
var serviceConfig = new ServiceProviderConfiguraion("product", string.Empty, 0, true, "Consul");
|
||||||
|
|
||||||
|
this.Given(x => x.GivenTheReRoute(serviceConfig))
|
||||||
|
.When(x => x.WhenIGetTheServiceProvider())
|
||||||
|
.Then(x => x.ThenTheServiceProviderIs<ConsulServiceDiscoveryProvider>())
|
||||||
|
.BDDfy();
|
||||||
|
}
|
||||||
|
|
||||||
private void GivenTheReRoute(ServiceProviderConfiguraion serviceConfig)
|
private void GivenTheReRoute(ServiceProviderConfiguraion serviceConfig)
|
||||||
{
|
{
|
||||||
_serviceConfig = serviceConfig;
|
_serviceConfig = serviceConfig;
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
"win7-x64": {}
|
"win7-x64": {}
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"netcoreapp1.4": {
|
"netcoreapp1.1": {
|
||||||
"imports": [
|
"imports": [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user