diff --git a/.travis.yml b/.travis.yml index aba3d71a..bd3ea077 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ os: # Ubuntu 14.04 sudo: required -dist: trusty +dist: bionic # OS X 10.12 osx_image: xcode9.2 @@ -13,7 +13,7 @@ osx_image: xcode9.2 mono: - 5.10.0 -dotnet: 2.1.500 +dotnet: 2.2.105 before_install: - git fetch --unshallow # Travis always does a shallow clone, but GitVersion needs the full history including branches and tags diff --git a/global.json b/global.json deleted file mode 100644 index 1738b35f..00000000 --- a/global.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "projects": [ "src", "test" ], - "sdk": { - "version": "2.1.500" - } -} diff --git a/samples/OcelotEureka/ApiGateway/ApiGateway.csproj b/samples/OcelotEureka/ApiGateway/ApiGateway.csproj index 8e6acdb8..a1fe22dd 100644 --- a/samples/OcelotEureka/ApiGateway/ApiGateway.csproj +++ b/samples/OcelotEureka/ApiGateway/ApiGateway.csproj @@ -1,7 +1,7 @@ - netcoreapp2.0 + netcoreapp2.2 @@ -15,8 +15,10 @@ - - + + + + diff --git a/samples/OcelotEureka/ApiGateway/Program.cs b/samples/OcelotEureka/ApiGateway/Program.cs index d72d8644..f2cd87f9 100644 --- a/samples/OcelotEureka/ApiGateway/Program.cs +++ b/samples/OcelotEureka/ApiGateway/Program.cs @@ -1,4 +1,7 @@ -namespace ApiGateway +using Ocelot.Provider.Eureka; +using Ocelot.Provider.Polly; + +namespace ApiGateway { using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; @@ -27,7 +30,9 @@ }) .ConfigureServices(s => { - s.AddOcelot(); + s.AddOcelot() + .AddEureka() + .AddPolly(); }) .Configure(a => { diff --git a/samples/OcelotEureka/DownstreamService/DownstreamService.csproj b/samples/OcelotEureka/DownstreamService/DownstreamService.csproj index 5e20116d..3d5689a5 100644 --- a/samples/OcelotEureka/DownstreamService/DownstreamService.csproj +++ b/samples/OcelotEureka/DownstreamService/DownstreamService.csproj @@ -1,7 +1,7 @@ - netcoreapp2.0 + netcoreapp2.2 @@ -9,7 +9,7 @@ - + diff --git a/samples/OcelotGraphQL/OcelotGraphQL.sln b/samples/OcelotGraphQL/OcelotGraphQL.sln new file mode 100644 index 00000000..f6ded47e --- /dev/null +++ b/samples/OcelotGraphQL/OcelotGraphQL.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.28803.452 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OcelotGraphQL", "OcelotGraphQL.csproj", "{5A3220BF-FE0B-4B26-8B2F-37DB7292EEA9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5A3220BF-FE0B-4B26-8B2F-37DB7292EEA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5A3220BF-FE0B-4B26-8B2F-37DB7292EEA9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5A3220BF-FE0B-4B26-8B2F-37DB7292EEA9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5A3220BF-FE0B-4B26-8B2F-37DB7292EEA9}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5762C36C-EA4B-44D9-9DAA-2F7C3FC98692} + EndGlobalSection +EndGlobal diff --git a/samples/OcelotGraphQL/Properties/launchSettings.json b/samples/OcelotGraphQL/Properties/launchSettings.json new file mode 100644 index 00000000..ec10c2c0 --- /dev/null +++ b/samples/OcelotGraphQL/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:53639/", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "OcelotGraphQL": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "http://localhost:53640/" + } + } +} \ No newline at end of file diff --git a/samples/OelotKube/.dockerignore b/samples/OcelotKube/.dockerignore similarity index 100% rename from samples/OelotKube/.dockerignore rename to samples/OcelotKube/.dockerignore diff --git a/samples/OelotKube/ApiGateway/ApiGateway.csproj b/samples/OcelotKube/ApiGateway/ApiGateway.csproj similarity index 68% rename from samples/OelotKube/ApiGateway/ApiGateway.csproj rename to samples/OcelotKube/ApiGateway/ApiGateway.csproj index 0dc4f632..81b47303 100644 --- a/samples/OelotKube/ApiGateway/ApiGateway.csproj +++ b/samples/OcelotKube/ApiGateway/ApiGateway.csproj @@ -1,17 +1,17 @@  - netcoreapp2.1 + netcoreapp2.2 InProcess Linux - - - - + + + + diff --git a/samples/OelotKube/ApiGateway/Dockerfile b/samples/OcelotKube/ApiGateway/Dockerfile similarity index 100% rename from samples/OelotKube/ApiGateway/Dockerfile rename to samples/OcelotKube/ApiGateway/Dockerfile diff --git a/samples/OelotKube/ApiGateway/Program.cs b/samples/OcelotKube/ApiGateway/Program.cs similarity index 100% rename from samples/OelotKube/ApiGateway/Program.cs rename to samples/OcelotKube/ApiGateway/Program.cs diff --git a/samples/OelotKube/ApiGateway/Properties/launchSettings.json b/samples/OcelotKube/ApiGateway/Properties/launchSettings.json similarity index 100% rename from samples/OelotKube/ApiGateway/Properties/launchSettings.json rename to samples/OcelotKube/ApiGateway/Properties/launchSettings.json diff --git a/samples/OelotKube/ApiGateway/Startup.cs b/samples/OcelotKube/ApiGateway/Startup.cs similarity index 85% rename from samples/OelotKube/ApiGateway/Startup.cs rename to samples/OcelotKube/ApiGateway/Startup.cs index 4743e836..d7b2473c 100644 --- a/samples/OelotKube/ApiGateway/Startup.cs +++ b/samples/OcelotKube/ApiGateway/Startup.cs @@ -1,10 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using Ocelot.DependencyInjection; using Ocelot.Middleware; diff --git a/samples/OelotKube/ApiGateway/appsettings.Development.json b/samples/OcelotKube/ApiGateway/appsettings.Development.json similarity index 100% rename from samples/OelotKube/ApiGateway/appsettings.Development.json rename to samples/OcelotKube/ApiGateway/appsettings.Development.json diff --git a/samples/OelotKube/ApiGateway/appsettings.json b/samples/OcelotKube/ApiGateway/appsettings.json similarity index 100% rename from samples/OelotKube/ApiGateway/appsettings.json rename to samples/OcelotKube/ApiGateway/appsettings.json diff --git a/samples/OelotKube/ApiGateway/ocelot.json b/samples/OcelotKube/ApiGateway/ocelot.json similarity index 100% rename from samples/OelotKube/ApiGateway/ocelot.json rename to samples/OcelotKube/ApiGateway/ocelot.json diff --git a/samples/OelotKube/Dockerfile b/samples/OcelotKube/Dockerfile similarity index 100% rename from samples/OelotKube/Dockerfile rename to samples/OcelotKube/Dockerfile diff --git a/samples/OelotKube/DownstreamService/Controllers/ValuesController.cs b/samples/OcelotKube/DownstreamService/Controllers/ValuesController.cs similarity index 100% rename from samples/OelotKube/DownstreamService/Controllers/ValuesController.cs rename to samples/OcelotKube/DownstreamService/Controllers/ValuesController.cs diff --git a/samples/OelotKube/DownstreamService/Dockerfile b/samples/OcelotKube/DownstreamService/Dockerfile similarity index 100% rename from samples/OelotKube/DownstreamService/Dockerfile rename to samples/OcelotKube/DownstreamService/Dockerfile diff --git a/samples/OelotKube/DownstreamService/Dockerfile.develop b/samples/OcelotKube/DownstreamService/Dockerfile.develop similarity index 100% rename from samples/OelotKube/DownstreamService/Dockerfile.develop rename to samples/OcelotKube/DownstreamService/Dockerfile.develop diff --git a/samples/OelotKube/DownstreamService/DownstreamService.csproj b/samples/OcelotKube/DownstreamService/DownstreamService.csproj similarity index 75% rename from samples/OelotKube/DownstreamService/DownstreamService.csproj rename to samples/OcelotKube/DownstreamService/DownstreamService.csproj index c32dd048..88fdbfb7 100644 --- a/samples/OelotKube/DownstreamService/DownstreamService.csproj +++ b/samples/OcelotKube/DownstreamService/DownstreamService.csproj @@ -1,15 +1,15 @@ - netcoreapp2.1 + netcoreapp2.2 InProcess Linux - - + + diff --git a/samples/OelotKube/DownstreamService/Program.cs b/samples/OcelotKube/DownstreamService/Program.cs similarity index 100% rename from samples/OelotKube/DownstreamService/Program.cs rename to samples/OcelotKube/DownstreamService/Program.cs diff --git a/samples/OelotKube/DownstreamService/Properties/launchSettings.json b/samples/OcelotKube/DownstreamService/Properties/launchSettings.json similarity index 100% rename from samples/OelotKube/DownstreamService/Properties/launchSettings.json rename to samples/OcelotKube/DownstreamService/Properties/launchSettings.json diff --git a/samples/OelotKube/DownstreamService/Startup.cs b/samples/OcelotKube/DownstreamService/Startup.cs similarity index 100% rename from samples/OelotKube/DownstreamService/Startup.cs rename to samples/OcelotKube/DownstreamService/Startup.cs diff --git a/samples/OelotKube/DownstreamService/appsettings.Development.json b/samples/OcelotKube/DownstreamService/appsettings.Development.json similarity index 100% rename from samples/OelotKube/DownstreamService/appsettings.Development.json rename to samples/OcelotKube/DownstreamService/appsettings.Development.json diff --git a/samples/OelotKube/DownstreamService/appsettings.json b/samples/OcelotKube/DownstreamService/appsettings.json similarity index 100% rename from samples/OelotKube/DownstreamService/appsettings.json rename to samples/OcelotKube/DownstreamService/appsettings.json diff --git a/samples/OelotKube/OelotKube.sln b/samples/OcelotKube/OcelotKube.sln similarity index 100% rename from samples/OelotKube/OelotKube.sln rename to samples/OcelotKube/OcelotKube.sln diff --git a/src/Ocelot.Administration/IdentityServerConfiguration.cs b/src/Ocelot.Administration/IdentityServerConfiguration.cs index 95e64d01..a560f032 100644 --- a/src/Ocelot.Administration/IdentityServerConfiguration.cs +++ b/src/Ocelot.Administration/IdentityServerConfiguration.cs @@ -5,11 +5,11 @@ namespace Ocelot.Administration public class IdentityServerConfiguration : IIdentityServerConfiguration { public IdentityServerConfiguration( - string apiName, - bool requireHttps, + string apiName, + bool requireHttps, string apiSecret, List allowedScopes, - string credentialsSigningCertificateLocation, + string credentialsSigningCertificateLocation, string credentialsSigningCertificatePassword) { ApiName = apiName; diff --git a/src/Ocelot.Administration/Ocelot.Administration.csproj b/src/Ocelot.Administration/Ocelot.Administration.csproj index ca518938..a4aabbd8 100644 --- a/src/Ocelot.Administration/Ocelot.Administration.csproj +++ b/src/Ocelot.Administration/Ocelot.Administration.csproj @@ -29,10 +29,10 @@ - + all - - + + diff --git a/src/Ocelot.Cache.CacheManager/Ocelot.Cache.CacheManager.csproj b/src/Ocelot.Cache.CacheManager/Ocelot.Cache.CacheManager.csproj index 32271347..7941dcab 100644 --- a/src/Ocelot.Cache.CacheManager/Ocelot.Cache.CacheManager.csproj +++ b/src/Ocelot.Cache.CacheManager/Ocelot.Cache.CacheManager.csproj @@ -28,11 +28,11 @@ - + all - - - + + + diff --git a/src/Ocelot.Provider.Consul/Ocelot.Provider.Consul.csproj b/src/Ocelot.Provider.Consul/Ocelot.Provider.Consul.csproj index e0ae127e..2df87ad4 100644 --- a/src/Ocelot.Provider.Consul/Ocelot.Provider.Consul.csproj +++ b/src/Ocelot.Provider.Consul/Ocelot.Provider.Consul.csproj @@ -30,7 +30,7 @@ - + all diff --git a/src/Ocelot.Provider.Eureka/Ocelot.Provider.Eureka.csproj b/src/Ocelot.Provider.Eureka/Ocelot.Provider.Eureka.csproj index 6373e90a..d25efc5a 100644 --- a/src/Ocelot.Provider.Eureka/Ocelot.Provider.Eureka.csproj +++ b/src/Ocelot.Provider.Eureka/Ocelot.Provider.Eureka.csproj @@ -30,7 +30,7 @@ - + all diff --git a/src/Ocelot.Provider.Kubernetes/Ocelot.Provider.Kubernetes.csproj b/src/Ocelot.Provider.Kubernetes/Ocelot.Provider.Kubernetes.csproj index 13a73143..436585da 100644 --- a/src/Ocelot.Provider.Kubernetes/Ocelot.Provider.Kubernetes.csproj +++ b/src/Ocelot.Provider.Kubernetes/Ocelot.Provider.Kubernetes.csproj @@ -30,8 +30,8 @@ - - + + diff --git a/src/Ocelot.Provider.Polly/Ocelot.Provider.Polly.csproj b/src/Ocelot.Provider.Polly/Ocelot.Provider.Polly.csproj index e4512cec..fa15a189 100644 --- a/src/Ocelot.Provider.Polly/Ocelot.Provider.Polly.csproj +++ b/src/Ocelot.Provider.Polly/Ocelot.Provider.Polly.csproj @@ -29,9 +29,9 @@ - + all - + diff --git a/src/Ocelot.Provider.Polly/PollyQoSProvider.cs b/src/Ocelot.Provider.Polly/PollyQoSProvider.cs index 3d34195f..4344f1b9 100644 --- a/src/Ocelot.Provider.Polly/PollyQoSProvider.cs +++ b/src/Ocelot.Provider.Polly/PollyQoSProvider.cs @@ -10,8 +10,8 @@ namespace Ocelot.Provider.Polly public class PollyQoSProvider { - private readonly CircuitBreakerPolicy _circuitBreakerPolicy; - private readonly TimeoutPolicy _timeoutPolicy; + private readonly AsyncCircuitBreakerPolicy _circuitBreakerPolicy; + private readonly AsyncTimeoutPolicy _timeoutPolicy; private readonly IOcelotLogger _logger; public PollyQoSProvider(DownstreamReRoute reRoute, IOcelotLoggerFactory loggerFactory) diff --git a/src/Ocelot.Provider.Rafty/Ocelot.Provider.Rafty.csproj b/src/Ocelot.Provider.Rafty/Ocelot.Provider.Rafty.csproj index 1e21afc3..f7e0996c 100644 --- a/src/Ocelot.Provider.Rafty/Ocelot.Provider.Rafty.csproj +++ b/src/Ocelot.Provider.Rafty/Ocelot.Provider.Rafty.csproj @@ -30,9 +30,9 @@ - - - + + + all diff --git a/src/Ocelot/Ocelot.csproj b/src/Ocelot/Ocelot.csproj index 3b0b9b34..b9d9d2ce 100644 --- a/src/Ocelot/Ocelot.csproj +++ b/src/Ocelot/Ocelot.csproj @@ -26,14 +26,14 @@ True - - - - - + + + + + NU1701 - + all diff --git a/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj b/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj index 96223e52..762448e7 100644 --- a/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj +++ b/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj @@ -1,7 +1,7 @@  0.0.0-dev - netcoreapp2.1 + netcoreapp2.2 Ocelot.AcceptanceTests Exe Ocelot.AcceptanceTests @@ -37,32 +37,35 @@ - - - - + + + + all - - - - - - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + - + - + - - + + - - - + + + - + \ No newline at end of file diff --git a/test/Ocelot.AcceptanceTests/Steps.cs b/test/Ocelot.AcceptanceTests/Steps.cs index 1aefdbc0..dd1fdab8 100644 --- a/test/Ocelot.AcceptanceTests/Steps.cs +++ b/test/Ocelot.AcceptanceTests/Steps.cs @@ -141,7 +141,6 @@ await _ocelotHost.StartAsync(); } - public void GivenThereIsAConfiguration(FileConfiguration fileConfiguration) { var configurationPath = TestConfiguration.ConfigurationPath; @@ -150,7 +149,14 @@ if (File.Exists(configurationPath)) { - File.Delete(configurationPath); + try + { + File.Delete(configurationPath); + } + catch (Exception e) + { + Console.WriteLine(e); + } } File.WriteAllText(configurationPath, jsonConfiguration); @@ -162,7 +168,14 @@ if (File.Exists(configurationPath)) { - File.Delete(configurationPath); + try + { + File.Delete(configurationPath); + } + catch (Exception e) + { + Console.WriteLine(e); + } } File.WriteAllText(configurationPath, jsonConfiguration); @@ -190,7 +203,7 @@ }) .ConfigureServices(s => { - s.AddOcelot(); + s.AddOcelot(); }) .Configure(app => { @@ -261,7 +274,6 @@ _ocelotClient = _ocelotServer.CreateClient(); } - public void ThenTheTraceHeaderIsSet(string key) { var header = _response.Headers.GetValues(key); @@ -306,7 +318,6 @@ _ocelotClient = _ocelotServer.CreateClient(); } - public void GivenOcelotIsRunningUsingConsulToStoreConfigAndJsonSerializedCache() { _webHostBuilder = new WebHostBuilder(); @@ -339,7 +350,7 @@ .Configure(app => { app.UseOcelot().Wait(); - }); + }); _ocelotServer = new TestServer(_webHostBuilder); @@ -376,7 +387,8 @@ public void WhenIGetUrlOnTheApiGatewayWaitingForTheResponseToBeOk(string url) { - var result = Wait.WaitFor(2000).Until(() => { + var result = Wait.WaitFor(2000).Until(() => + { try { _response = _ocelotClient.GetAsync(url).Result; @@ -392,7 +404,6 @@ result.ShouldBeTrue(); } - public void GivenOcelotIsRunningUsingJsonSerializedCache() { _webHostBuilder = new WebHostBuilder(); @@ -423,7 +434,7 @@ .Configure(app => { app.UseOcelot().Wait(); - }); + }); _ocelotServer = new TestServer(_webHostBuilder); @@ -559,7 +570,7 @@ _ocelotClient = _ocelotServer.CreateClient(); } - public void GivenOcelotIsRunningWithGlobalHandlersRegisteredInDi() + public void GivenOcelotIsRunningWithGlobalHandlersRegisteredInDi() where TOne : DelegatingHandler where TWo : DelegatingHandler { @@ -592,7 +603,7 @@ _ocelotClient = _ocelotServer.CreateClient(); } - public void GivenOcelotIsRunningWithGlobalHandlerRegisteredInDi() + public void GivenOcelotIsRunningWithGlobalHandlerRegisteredInDi() where TOne : DelegatingHandler { _webHostBuilder = new WebHostBuilder(); @@ -623,7 +634,7 @@ _ocelotClient = _ocelotServer.CreateClient(); } - public void GivenOcelotIsRunningWithGlobalHandlersRegisteredInDi(FakeDependency dependency) + public void GivenOcelotIsRunningWithGlobalHandlersRegisteredInDi(FakeDependency dependency) where TOne : DelegatingHandler { _webHostBuilder = new WebHostBuilder(); @@ -884,8 +895,6 @@ _ocelotClient = _ocelotServer.CreateClient(); } - - public void WhenIGetUrlOnTheApiGateway(string url) { _response = _ocelotClient.GetAsync(url).Result; @@ -1004,7 +1013,7 @@ { _response.Content.ReadAsStringAsync().Result.ShouldBe(expectedBody); } - + public void ThenTheContentLengthIs(int expected) { _response.Content.Headers.ContentLength.ShouldBe(expected); @@ -1111,7 +1120,6 @@ _ocelotServer = new TestServer(_webHostBuilder); _ocelotClient = _ocelotServer.CreateClient(); - } } } diff --git a/test/Ocelot.Benchmarks/AllTheThingsBenchmarks.cs b/test/Ocelot.Benchmarks/AllTheThingsBenchmarks.cs index 8db90a24..c6b12356 100644 --- a/test/Ocelot.Benchmarks/AllTheThingsBenchmarks.cs +++ b/test/Ocelot.Benchmarks/AllTheThingsBenchmarks.cs @@ -1,9 +1,8 @@ -using System; -using System.Collections.Generic; -using System.IO; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Columns; using BenchmarkDotNet.Configs; +using BenchmarkDotNet.Diagnosers; +using BenchmarkDotNet.Validators; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; @@ -11,14 +10,13 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using Newtonsoft.Json; using Ocelot.Configuration.File; -using Ocelot.DownstreamRouteFinder.UrlMatcher; -using Ocelot.Middleware; using Ocelot.DependencyInjection; +using Ocelot.Middleware; +using System; +using System.Collections.Generic; +using System.IO; using System.Net.Http; using System.Threading.Tasks; -using BenchmarkDotNet.Attributes.Jobs; -using BenchmarkDotNet.Diagnosers; -using BenchmarkDotNet.Validators; namespace Ocelot.Benchmarks { @@ -76,16 +74,16 @@ namespace Ocelot.Benchmarks response.EnsureSuccessStatusCode(); } -/* * Summary* - BenchmarkDotNet = v0.10.13, OS = macOS 10.12.6 (16G1212) [Darwin 16.7.0] - Intel Core i5-4278U CPU 2.60GHz(Haswell), 1 CPU, 4 logical cores and 2 physical cores - .NET Core SDK = 2.1.4 + /* * Summary* + BenchmarkDotNet = v0.10.13, OS = macOS 10.12.6 (16G1212) [Darwin 16.7.0] + Intel Core i5-4278U CPU 2.60GHz(Haswell), 1 CPU, 4 logical cores and 2 physical cores + .NET Core SDK = 2.1.4 - [Host] : .NET Core 2.0.6 (CoreCLR 4.6.0.0, CoreFX 4.6.26212.01), 64bit RyuJIT - DefaultJob : .NET Core 2.0.6 (CoreCLR 4.6.0.0, CoreFX 4.6.26212.01), 64bit RyuJIT - Method | Mean | Error | StdDev | StdErr | Min | Q1 | Median | Q3 | Max | Op/s | Scaled | Gen 0 | Gen 1 | Allocated | - --------- |---------:|----------:|----------:|----------:|---------:|---------:|---------:|---------:|---------:|------:|-------:|--------:|-------:|----------:| - Baseline | 2.102 ms | 0.0292 ms | 0.0273 ms | 0.0070 ms | 2.063 ms | 2.080 ms | 2.093 ms | 2.122 ms | 2.152 ms | 475.8 | 1.00 | 31.2500 | 3.9063 | 1.63 KB |*/ + [Host] : .NET Core 2.0.6 (CoreCLR 4.6.0.0, CoreFX 4.6.26212.01), 64bit RyuJIT + DefaultJob : .NET Core 2.0.6 (CoreCLR 4.6.0.0, CoreFX 4.6.26212.01), 64bit RyuJIT + Method | Mean | Error | StdDev | StdErr | Min | Q1 | Median | Q3 | Max | Op/s | Scaled | Gen 0 | Gen 1 | Allocated | + --------- |---------:|----------:|----------:|----------:|---------:|---------:|---------:|---------:|---------:|------:|-------:|--------:|-------:|----------:| + Baseline | 2.102 ms | 0.0292 ms | 0.0273 ms | 0.0070 ms | 2.063 ms | 2.080 ms | 2.093 ms | 2.122 ms | 2.152 ms | 475.8 | 1.00 | 31.2500 | 3.9063 | 1.63 KB |*/ private void GivenOcelotIsRunning(string url) { @@ -102,7 +100,8 @@ namespace Ocelot.Benchmarks .AddJsonFile("ocelot.json", false, false) .AddEnvironmentVariables(); }) - .ConfigureServices(s => { + .ConfigureServices(s => + { s.AddOcelot(); }) .ConfigureLogging((hostingContext, logging) => @@ -132,7 +131,7 @@ namespace Ocelot.Benchmarks File.WriteAllText(configurationPath, jsonConfiguration); } - + private void GivenThereIsAServiceRunningOn(string baseUrl, string basePath, int statusCode, string responseBody) { _service = new WebHostBuilder() @@ -144,7 +143,7 @@ namespace Ocelot.Benchmarks { app.UsePathBase(basePath); app.Run(async context => - { + { context.Response.StatusCode = statusCode; await context.Response.WriteAsync(responseBody); }); diff --git a/test/Ocelot.Benchmarks/DownstreamRouteFinderMiddlewareBenchmarks.cs b/test/Ocelot.Benchmarks/DownstreamRouteFinderMiddlewareBenchmarks.cs index 484e91d3..57f7386a 100644 --- a/test/Ocelot.Benchmarks/DownstreamRouteFinderMiddlewareBenchmarks.cs +++ b/test/Ocelot.Benchmarks/DownstreamRouteFinderMiddlewareBenchmarks.cs @@ -1,33 +1,21 @@ -using System; -using System.Collections.Generic; -using System.IO; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Columns; using BenchmarkDotNet.Configs; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Http; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; -using Ocelot.Configuration.File; -using Ocelot.DownstreamRouteFinder.UrlMatcher; -using Ocelot.Middleware; -using Ocelot.DependencyInjection; -using System.Net.Http; -using System.Threading.Tasks; -using BenchmarkDotNet.Attributes.Jobs; -using Ocelot.Configuration.Repository; -using Ocelot.Infrastructure.RequestData; -using Ocelot.Logging; -using Ocelot.Errors.Middleware; -using Microsoft.Extensions.DependencyInjection; using BenchmarkDotNet.Diagnosers; using BenchmarkDotNet.Validators; -using Ocelot.DownstreamRouteFinder.Middleware; -using Ocelot.DownstreamRouteFinder.Finder; -using Ocelot.Middleware.Multiplexer; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; using Ocelot.Configuration; +using Ocelot.DependencyInjection; +using Ocelot.DownstreamRouteFinder.Finder; +using Ocelot.DownstreamRouteFinder.Middleware; +using Ocelot.Logging; +using Ocelot.Middleware; +using Ocelot.Middleware.Multiplexer; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; namespace Ocelot.Benchmarks { @@ -57,17 +45,18 @@ namespace Ocelot.Benchmarks var drpf = services.GetService(); var multiplexer = services.GetService(); - _next = async context => { + _next = async context => + { await Task.CompletedTask; throw new Exception("BOOM"); }; - + _middleware = new DownstreamRouteFinderMiddleware(_next, loggerFactory, drpf, multiplexer); var httpContext = new DefaultHttpContext(); httpContext.Request.Path = new PathString("/test"); httpContext.Request.QueryString = new QueryString("?a=b"); httpContext.Request.Headers.Add("Host", "most"); - + _downstreamContext = new DownstreamContext(httpContext) { Configuration = new InternalConfiguration(new List(), null, null, null, null, null, null, null) diff --git a/test/Ocelot.Benchmarks/ExceptionHandlerMiddlewareBenchmarks.cs b/test/Ocelot.Benchmarks/ExceptionHandlerMiddlewareBenchmarks.cs index 9b1f3312..995efea5 100644 --- a/test/Ocelot.Benchmarks/ExceptionHandlerMiddlewareBenchmarks.cs +++ b/test/Ocelot.Benchmarks/ExceptionHandlerMiddlewareBenchmarks.cs @@ -1,29 +1,20 @@ -using System; -using System.Collections.Generic; -using System.IO; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Columns; using BenchmarkDotNet.Configs; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Http; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; -using Ocelot.Configuration.File; -using Ocelot.DownstreamRouteFinder.UrlMatcher; -using Ocelot.Middleware; -using Ocelot.DependencyInjection; -using System.Net.Http; -using System.Threading.Tasks; -using BenchmarkDotNet.Attributes.Jobs; -using Ocelot.Configuration.Repository; -using Ocelot.Infrastructure.RequestData; -using Ocelot.Logging; -using Ocelot.Errors.Middleware; -using Microsoft.Extensions.DependencyInjection; using BenchmarkDotNet.Diagnosers; using BenchmarkDotNet.Validators; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Ocelot.Configuration.Repository; +using Ocelot.DependencyInjection; +using Ocelot.Errors.Middleware; +using Ocelot.Infrastructure.RequestData; +using Ocelot.Logging; +using Ocelot.Middleware; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; namespace Ocelot.Benchmarks { @@ -52,7 +43,8 @@ namespace Ocelot.Benchmarks var loggerFactory = services.GetService(); var configRepo = services.GetService(); var repo = services.GetService(); - _next = async context => { + _next = async context => + { await Task.CompletedTask; throw new Exception("BOOM"); }; @@ -66,4 +58,4 @@ namespace Ocelot.Benchmarks await _middleware.Invoke(_downstreamContext); } } -} +} diff --git a/test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj b/test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj index e7d255c9..32f4f556 100644 --- a/test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj +++ b/test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj @@ -2,7 +2,7 @@ 0.0.0-dev - netcoreapp2.1 + netcoreapp2.2 Ocelot.Benchmarks Exe Ocelot.Benchmarks @@ -18,10 +18,9 @@ - - + + all - - + \ No newline at end of file diff --git a/test/Ocelot.IntegrationTests/Ocelot.IntegrationTests.csproj b/test/Ocelot.IntegrationTests/Ocelot.IntegrationTests.csproj index 3bb8f732..81c50e05 100644 --- a/test/Ocelot.IntegrationTests/Ocelot.IntegrationTests.csproj +++ b/test/Ocelot.IntegrationTests/Ocelot.IntegrationTests.csproj @@ -1,7 +1,7 @@  0.0.0-dev - netcoreapp2.1 + netcoreapp2.2 Ocelot.IntegrationTests Exe Ocelot.IntegrationTests @@ -30,26 +30,29 @@ - - - - + + + + all - - - - - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + - - + + - - - + + + - + \ No newline at end of file diff --git a/test/Ocelot.ManualTest/Ocelot.ManualTest.csproj b/test/Ocelot.ManualTest/Ocelot.ManualTest.csproj index c868886f..478d425f 100644 --- a/test/Ocelot.ManualTest/Ocelot.ManualTest.csproj +++ b/test/Ocelot.ManualTest/Ocelot.ManualTest.csproj @@ -1,7 +1,7 @@  0.0.0-dev - netcoreapp2.1 + netcoreapp2.2 true Ocelot.ManualTest Exe @@ -28,16 +28,16 @@ - - - - - - - - - + + + + + + + + + all - + \ No newline at end of file diff --git a/test/Ocelot.UnitTests/Ocelot.UnitTests.csproj b/test/Ocelot.UnitTests/Ocelot.UnitTests.csproj index f4222635..0809d120 100644 --- a/test/Ocelot.UnitTests/Ocelot.UnitTests.csproj +++ b/test/Ocelot.UnitTests/Ocelot.UnitTests.csproj @@ -2,7 +2,7 @@ 0.0.0-dev - netcoreapp2.1 + netcoreapp2.2 Ocelot.UnitTests Ocelot.UnitTests Exe @@ -36,10 +36,10 @@ - + - + PreserveNewest @@ -49,38 +49,41 @@ - - - - + + + + all - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + - - - - - - - - - + + + + + + + + + - + - - - + + + - - - - + + + + - + \ No newline at end of file