mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 10:35:28 +08:00 
			
		
		
		
	Upgrade Pivotal.Discovery.Client to Pivotal.Discovery.ClientCore (#369)
This commit is contained in:
		
				
					committed by
					
						
						Tom Pallister
					
				
			
			
				
	
			
			
			
						parent
						
							d01720c349
						
					
				
				
					commit
					32a258fd3f
				
			@@ -45,8 +45,9 @@ namespace Ocelot.DependencyInjection
 | 
				
			|||||||
    using Ocelot.Infrastructure.Consul;
 | 
					    using Ocelot.Infrastructure.Consul;
 | 
				
			||||||
    using Butterfly.Client.Tracing;
 | 
					    using Butterfly.Client.Tracing;
 | 
				
			||||||
    using Ocelot.Middleware.Multiplexer;
 | 
					    using Ocelot.Middleware.Multiplexer;
 | 
				
			||||||
    using Pivotal.Discovery.Client;
 | 
					 | 
				
			||||||
    using ServiceDiscovery.Providers;
 | 
					    using ServiceDiscovery.Providers;
 | 
				
			||||||
 | 
					    using Steeltoe.Common.Discovery;
 | 
				
			||||||
 | 
					    using Pivotal.Discovery.Client;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public class OcelotBuilder : IOcelotBuilder
 | 
					    public class OcelotBuilder : IOcelotBuilder
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -54,8 +54,8 @@
 | 
				
			|||||||
    <PackageReference Include="CacheManager.Microsoft.Extensions.Logging" Version="1.1.2" />
 | 
					    <PackageReference Include="CacheManager.Microsoft.Extensions.Logging" Version="1.1.2" />
 | 
				
			||||||
    <PackageReference Include="Consul" Version="0.7.2.4" />
 | 
					    <PackageReference Include="Consul" Version="0.7.2.4" />
 | 
				
			||||||
    <PackageReference Include="Polly" Version="6.0.1" />
 | 
					    <PackageReference Include="Polly" Version="6.0.1" />
 | 
				
			||||||
    <PackageReference Include="Pivotal.Discovery.Client" Version="1.1.0" />
 | 
					 | 
				
			||||||
    <PackageReference Include="IdentityServer4" Version="2.2.0" />
 | 
					    <PackageReference Include="IdentityServer4" Version="2.2.0" />
 | 
				
			||||||
    <PackageReference Include="Rafty" Version="0.4.3" />
 | 
					    <PackageReference Include="Rafty" Version="0.4.3" />
 | 
				
			||||||
 | 
					    <PackageReference Include="Pivotal.Discovery.ClientCore" Version="2.0.1" />
 | 
				
			||||||
  </ItemGroup>
 | 
					  </ItemGroup>
 | 
				
			||||||
</Project>
 | 
					</Project>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,7 +3,7 @@
 | 
				
			|||||||
    using System.Collections.Generic;
 | 
					    using System.Collections.Generic;
 | 
				
			||||||
    using System.Linq;
 | 
					    using System.Linq;
 | 
				
			||||||
    using System.Threading.Tasks;
 | 
					    using System.Threading.Tasks;
 | 
				
			||||||
    using Pivotal.Discovery.Client;
 | 
					    using Steeltoe.Common.Discovery;
 | 
				
			||||||
    using Values;
 | 
					    using Values;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public class EurekaServiceDiscoveryProvider : IServiceDiscoveryProvider
 | 
					    public class EurekaServiceDiscoveryProvider : IServiceDiscoveryProvider
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,7 +2,7 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    using System.Collections.Generic;
 | 
					    using System.Collections.Generic;
 | 
				
			||||||
    using System.Threading.Tasks;
 | 
					    using System.Threading.Tasks;
 | 
				
			||||||
    using Pivotal.Discovery.Client;
 | 
					    using Steeltoe.Common.Discovery;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public class FakeEurekaDiscoveryClient : IDiscoveryClient
 | 
					    public class FakeEurekaDiscoveryClient : IDiscoveryClient
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@ using Ocelot.Values;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace Ocelot.ServiceDiscovery
 | 
					namespace Ocelot.ServiceDiscovery
 | 
				
			||||||
{    
 | 
					{    
 | 
				
			||||||
    using Pivotal.Discovery.Client;
 | 
					    using Steeltoe.Common.Discovery;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public class ServiceDiscoveryProviderFactory : IServiceDiscoveryProviderFactory
 | 
					    public class ServiceDiscoveryProviderFactory : IServiceDiscoveryProviderFactory
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,7 +14,7 @@ namespace Ocelot.AcceptanceTests
 | 
				
			|||||||
    using TestStack.BDDfy;
 | 
					    using TestStack.BDDfy;
 | 
				
			||||||
    using Xunit;
 | 
					    using Xunit;
 | 
				
			||||||
    using Newtonsoft.Json;
 | 
					    using Newtonsoft.Json;
 | 
				
			||||||
    using Pivotal.Discovery.Client;
 | 
					    using Steeltoe.Common.Discovery;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public class ServiceDiscoveryTests : IDisposable
 | 
					    public class ServiceDiscoveryTests : IDisposable
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,6 +7,8 @@ namespace Ocelot.UnitTests.Middleware
 | 
				
			|||||||
    using Ocelot.Middleware.Pipeline;
 | 
					    using Ocelot.Middleware.Pipeline;
 | 
				
			||||||
    using Pivotal.Discovery.Client;
 | 
					    using Pivotal.Discovery.Client;
 | 
				
			||||||
    using Shouldly;
 | 
					    using Shouldly;
 | 
				
			||||||
 | 
					    using Steeltoe.Common.Discovery;
 | 
				
			||||||
 | 
					    using Steeltoe.Discovery.Eureka;
 | 
				
			||||||
    using TestStack.BDDfy;
 | 
					    using TestStack.BDDfy;
 | 
				
			||||||
    using Xunit;
 | 
					    using Xunit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -40,7 +42,16 @@ namespace Ocelot.UnitTests.Middleware
 | 
				
			|||||||
            var root = test.Build();
 | 
					            var root = test.Build();
 | 
				
			||||||
            var services = new ServiceCollection();
 | 
					            var services = new ServiceCollection();
 | 
				
			||||||
            services.AddSingleton<IConfiguration>(root);
 | 
					            services.AddSingleton<IConfiguration>(root);
 | 
				
			||||||
            services.AddDiscoveryClient(new DiscoveryOptions {ClientType = DiscoveryClientType.EUREKA});
 | 
					            services.AddDiscoveryClient(new DiscoveryOptions 
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                ClientType = DiscoveryClientType.EUREKA,
 | 
				
			||||||
 | 
					                //options can not be null
 | 
				
			||||||
 | 
					                ClientOptions = new EurekaClientOptions()
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    ShouldFetchRegistry = false,
 | 
				
			||||||
 | 
					                    ShouldRegisterWithEureka = false
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
            services.AddOcelot();
 | 
					            services.AddOcelot();
 | 
				
			||||||
            var provider = services.BuildServiceProvider();
 | 
					            var provider = services.BuildServiceProvider();
 | 
				
			||||||
            _builder = new OcelotPipelineBuilder(provider);
 | 
					            _builder = new OcelotPipelineBuilder(provider);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,6 +7,7 @@
 | 
				
			|||||||
    using Ocelot.ServiceDiscovery.Providers;
 | 
					    using Ocelot.ServiceDiscovery.Providers;
 | 
				
			||||||
    using Pivotal.Discovery.Client;
 | 
					    using Pivotal.Discovery.Client;
 | 
				
			||||||
    using Shouldly;
 | 
					    using Shouldly;
 | 
				
			||||||
 | 
					    using Steeltoe.Common.Discovery;
 | 
				
			||||||
    using TestStack.BDDfy;
 | 
					    using TestStack.BDDfy;
 | 
				
			||||||
    using Values;
 | 
					    using Values;
 | 
				
			||||||
    using Xunit;
 | 
					    using Xunit;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,6 +14,7 @@ using Xunit;
 | 
				
			|||||||
namespace Ocelot.UnitTests.ServiceDiscovery
 | 
					namespace Ocelot.UnitTests.ServiceDiscovery
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    using Pivotal.Discovery.Client;
 | 
					    using Pivotal.Discovery.Client;
 | 
				
			||||||
 | 
					    using Steeltoe.Common.Discovery;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public class ServiceProviderFactoryTests
 | 
					    public class ServiceProviderFactoryTests
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user