From c1b315173f5be626a8eba98c7a71eebd9e7a10d5 Mon Sep 17 00:00:00 2001 From: Simon Jefford Date: Fri, 16 Mar 2018 17:48:11 +0000 Subject: [PATCH] Squash some warnings (#278) * squash SA1649 warnings (file/type name mismatch) * squash SA1127 warnings (generic constraint on own line) * squash SA1507 warnings (multiple blank lines) * squash package analysis warnings re: summary text It's not actually possible to provide a summary right now as per https://github.com/NuGet/Home/issues/4587 * squash missing castle.core reference warning * squash obsolete method warnings re: AddOcelotBaseUrl --- src/Ocelot/Ocelot.csproj | 3 ++- src/Ocelot/Requester/HttpClientHttpRequester.cs | 3 ++- ...actory.cs => IDelegatingHandlerHandlerFactory.cs} | 0 .../Ocelot.AcceptanceTests.csproj | 5 ----- test/Ocelot.IntegrationTests/RaftTests.cs | 2 ++ .../ConfigurationBuilderExtensionsTests.cs | 3 ++- .../DependencyInjection/OcelotBuilderTests.cs | 12 ++++++++---- .../Request/Mapper/RequestMapperTests.cs | 1 - 8 files changed, 16 insertions(+), 13 deletions(-) rename src/Ocelot/Requester/{IDelegatingHandlerHandlerProviderFactory.cs => IDelegatingHandlerHandlerFactory.cs} (100%) diff --git a/src/Ocelot/Ocelot.csproj b/src/Ocelot/Ocelot.csproj index 89ada54d..3d9b65c7 100644 --- a/src/Ocelot/Ocelot.csproj +++ b/src/Ocelot/Ocelot.csproj @@ -3,6 +3,7 @@ netcoreapp2.0 2.0.0 2.0.0 + true This project is aimed at people using .NET running a micro services / service orientated architecture that need a unified point of entry into their system. In particular I want easy integration with IdentityServer reference and bearer tokens. We have been unable to find this in my current workplace without having to write our own Javascript middlewares to handle the IdentityServer reference tokens. We would rather use the IdentityServer code that already exists to do this. Ocelot is a bunch of middlewares in a specific order. Ocelot manipulates the HttpRequest object into a state specified by its configuration until it reaches a request builder middleware where it creates a HttpRequestMessage object which is used to make a request to a downstream service. The middleware that makes the request is the last thing in the Ocelot pipeline. It does not call the next middleware. The response from the downstream service is stored in a per request scoped repository and retrived as the requests goes back up the Ocelot pipeline. There is a piece of middleware that maps the HttpResponseMessage onto the HttpResponse object and that is returned to the client. That is basically it with a bunch of other features. Ocelot 0.0.0-dev @@ -48,4 +49,4 @@ - \ No newline at end of file + diff --git a/src/Ocelot/Requester/HttpClientHttpRequester.cs b/src/Ocelot/Requester/HttpClientHttpRequester.cs index 29311ead..c6598903 100644 --- a/src/Ocelot/Requester/HttpClientHttpRequester.cs +++ b/src/Ocelot/Requester/HttpClientHttpRequester.cs @@ -75,7 +75,8 @@ namespace Ocelot.Requester } } - public class ReRouteDelegatingHandler where T : DelegatingHandler + public class ReRouteDelegatingHandler + where T : DelegatingHandler { public T DelegatingHandler { get; private set; } } diff --git a/src/Ocelot/Requester/IDelegatingHandlerHandlerProviderFactory.cs b/src/Ocelot/Requester/IDelegatingHandlerHandlerFactory.cs similarity index 100% rename from src/Ocelot/Requester/IDelegatingHandlerHandlerProviderFactory.cs rename to src/Ocelot/Requester/IDelegatingHandlerHandlerFactory.cs diff --git a/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj b/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj index ed09ed96..90d5bc64 100644 --- a/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj +++ b/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj @@ -50,9 +50,4 @@ - - - ..\..\..\..\Users\TGP\.nuget\packages\castle.core\4.2.1\lib\netstandard1.3\Castle.Core.dll - - diff --git a/test/Ocelot.IntegrationTests/RaftTests.cs b/test/Ocelot.IntegrationTests/RaftTests.cs index b8c24d5a..3dc01bb9 100644 --- a/test/Ocelot.IntegrationTests/RaftTests.cs +++ b/test/Ocelot.IntegrationTests/RaftTests.cs @@ -342,7 +342,9 @@ namespace Ocelot.IntegrationTests .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true); config.AddJsonFile("configuration.json"); config.AddJsonFile("peers.json", optional: true, reloadOnChange: true); + #pragma warning disable CS0618 config.AddOcelotBaseUrl(url); + #pragma warning restore CS0618 config.AddEnvironmentVariables(); }) .ConfigureServices(x => diff --git a/test/Ocelot.UnitTests/DependencyInjection/ConfigurationBuilderExtensionsTests.cs b/test/Ocelot.UnitTests/DependencyInjection/ConfigurationBuilderExtensionsTests.cs index 0fcbf66e..5d32b1ed 100644 --- a/test/Ocelot.UnitTests/DependencyInjection/ConfigurationBuilderExtensionsTests.cs +++ b/test/Ocelot.UnitTests/DependencyInjection/ConfigurationBuilderExtensionsTests.cs @@ -22,9 +22,10 @@ namespace Ocelot.UnitTests.DependencyInjection private void GivenTheBaseUrl(string baseUrl) { + #pragma warning disable CS0618 var builder = new ConfigurationBuilder() .AddOcelotBaseUrl(baseUrl); - + #pragma warning restore CS0618 _configuration = builder.Build(); } diff --git a/test/Ocelot.UnitTests/DependencyInjection/OcelotBuilderTests.cs b/test/Ocelot.UnitTests/DependencyInjection/OcelotBuilderTests.cs index df812f70..1cd22388 100644 --- a/test/Ocelot.UnitTests/DependencyInjection/OcelotBuilderTests.cs +++ b/test/Ocelot.UnitTests/DependencyInjection/OcelotBuilderTests.cs @@ -223,12 +223,14 @@ namespace Ocelot.UnitTests.DependencyInjection _ocelotBuilder.AddAdministration("/administration", options); } - private void AddTransientGlobalDelegatingHandler() where T : DelegatingHandler + private void AddTransientGlobalDelegatingHandler() + where T : DelegatingHandler { _ocelotBuilder.AddTransientDelegatingHandler(true); } - private void AddSpecificTransientDelegatingHandler() where T : DelegatingHandler + private void AddSpecificTransientDelegatingHandler() + where T : DelegatingHandler { _ocelotBuilder.AddTransientDelegatingHandler(); } @@ -298,12 +300,14 @@ namespace Ocelot.UnitTests.DependencyInjection } } - private void AddGlobalDelegatingHandler() where T : DelegatingHandler + private void AddGlobalDelegatingHandler() + where T : DelegatingHandler { _ocelotBuilder.AddSingletonDelegatingHandler(true); } - private void AddSpecificDelegatingHandler() where T : DelegatingHandler + private void AddSpecificDelegatingHandler() + where T : DelegatingHandler { _ocelotBuilder.AddSingletonDelegatingHandler(); } diff --git a/test/Ocelot.UnitTests/Request/Mapper/RequestMapperTests.cs b/test/Ocelot.UnitTests/Request/Mapper/RequestMapperTests.cs index ba719a45..22ff9276 100644 --- a/test/Ocelot.UnitTests/Request/Mapper/RequestMapperTests.cs +++ b/test/Ocelot.UnitTests/Request/Mapper/RequestMapperTests.cs @@ -163,7 +163,6 @@ .BDDfy(); } - [Fact] public void should_not_add_content_headers() {