From 59b63eab9c2cd2ab33c5752bbc3bd00a079cd74c Mon Sep 17 00:00:00 2001 From: Raman Maksimchuk Date: Fri, 12 Apr 2024 18:30:24 +0300 Subject: [PATCH] #2034 More rapid CircleCI builds (Part 1) (#2045) * Override `DefaultRequestTimeoutSeconds` by new property * Build using .NET 8 SDK only * Build all 3 SDKs if target is Release * Run "dotnet tool restore" to make the "dotnet-cake" command available * Update GitVersion.Tool package * GitVersion.Tool 5.12.0 * Newtonsoft.Json * Review packages * Prepare folder structure for samples * samples Administration * Move Docker files * samples solution folder * Move ServiceFabric folders * Rename ServiceFabric folders * Re-add OcelotApplication of ServiceFabric sample * New Samples view in Visual Studio * Add Ocelot.Samples.sln * Add Ocelot.Release.sln * Remove Samples projects from main solution * log settings of Compile task * Remove legacy build settings file * queue/block_workflow * resource_class * Update .editorconfig * CS8936: Feature 'primary constructors' is not available in C# 10, 11. Feature 'primary constructors' is available in C# 12.0 or greater. But we use `net6.0` and `net7.0` * CS8936 Feature 'collection expressions' is not available in C# 10, 11. CS8936: Feature 'primary constructors' is not available in C# 10, 11. * CS0618: 'member' is obsolete: 'text'. https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/cs0618 Switch off the warning CS0618 for testing projects. * Fix warnings. xUnit1013 Public method 'GivenThereIsAnIdentityServerOn' on test class 'AuthenticationTests' should be marked as a Theory. Reduce the visibility of the method, or add a Theory attribute to the method. CS0618 'FileAuthenticationOptions.AuthenticationProviderKey' is obsolete: 'Use the AuthenticationProviderKeys property!'. * Don't restore and don't build in RunUnitTests target * --verbosity:detailed * Disable BDDfy console report * enable * Inherit from `UnitTest` --- .circleci/config.yml | 15 +- .editorconfig | 249 ++++++++++++++- Directory.Build.props | 15 - Ocelot.Release.sln | 231 ++++++++++++++ Ocelot.sln | 155 ++------- build.cake | 66 ++-- .../Issue645.postman_collection.json | 298 +++++++++--------- .../Ocelot.Samples.AdministrationApi.csproj} | 0 .../Program.cs | 0 .../Properties/launchSettings.json | 0 .../README.md | 188 +++++------ .../appsettings.json | 0 .../ocelot.json | 34 +- .../tempkey.rsa | 0 .../Ocelot.Samples.Basic.ApiGateway.csproj} | 0 samples/{OcelotBasic => Basic}/Program.cs | 56 ++-- .../Properties/launchSettings.json | 0 samples/{OcelotBasic => Basic}/Startup.cs | 0 .../appsettings.Development.json | 0 .../ApiGateway => Basic}/appsettings.json | 0 samples/{OcelotBasic => Basic}/ocelot.json | 40 +-- samples/Docker/README.md | 0 .../Ocelot.Samples.Eureka.ApiGateway.csproj} | 0 .../ApiGateway/Program.cs | 0 .../ApiGateway/Properties/launchSettings.json | 0 .../ApiGateway/appsettings.json | 0 .../ApiGateway/ocelot.json | 44 +-- .../Controllers/CategoryController.cs | 0 ...t.Samples.Eureka.DownstreamService.csproj} | 0 .../DownstreamService/Program.cs | 0 .../Properties/launchSettings.json | 0 .../DownstreamService/Startup.cs | 0 .../appsettings.Development.json | 0 .../DownstreamService/appsettings.json | 0 .../{OcelotEureka => Eureka}/OcelotEureka.sln | 0 samples/{OcelotEureka => Eureka}/README.md | 0 .../Ocelot.Samples.GraphQL.csproj} | 0 .../OcelotGraphQL.sln | 0 samples/{OcelotGraphQL => GraphQL}/Program.cs | 268 ++++++++-------- .../Properties/launchSettings.json | 0 samples/{OcelotGraphQL => GraphQL}/README.md | 140 ++++---- .../{OcelotGraphQL => GraphQL}/ocelot.json | 36 +-- .../{OcelotKube => Kubernetes}/.dockerignore | 0 .../ApiGateway/Dockerfile | 0 ...elot.Samples.Kubernetes.ApiGateway.csproj} | 0 .../ApiGateway/Program.cs | 0 .../ApiGateway/Properties/launchSettings.json | 0 .../ApiGateway/Startup.cs | 0 .../ApiGateway/appsettings.Development.json | 0 .../ApiGateway}/appsettings.json | 0 .../ApiGateway/ocelot.json | 40 +-- samples/{OcelotKube => Kubernetes}/Dockerfile | 0 .../Controllers/ValuesController.cs | 0 .../Controllers/WeatherForecastController.cs | 0 .../DownstreamService/Dockerfile | 0 .../Models/WeatherForecast.cs | 0 ...mples.Kubernetes.DownstreamService.csproj} | 2 +- .../DownstreamService/Program.cs | 0 .../Properties/launchSettings.json | 0 .../appsettings.Development.json | 0 .../DownstreamService}/appsettings.json | 16 +- .../{OcelotKube => Kubernetes}/OcelotKube.sln | 0 samples/Ocelot.Samples.sln | 91 ++++++ .../DownstreamService/.dockerignore | 25 -- .../DownstreamService/Dockerfile | 22 -- ....ServiceDiscovery.DownstreamService.csproj | 17 - .../Ocelot.Samples.OpenTracing.csproj} | 0 .../Program.cs | 0 .../appsettings.Development.json | 0 .../appsettings.json | 0 .../ocelot.json | 0 .../.dockerignore | 0 ...Samples.ServiceDiscovery.ApiGateway.csproj | 4 +- .../ApiGateway/Program.cs | 0 .../ApiGateway/Properties/launchSettings.json | 0 .../MyServiceDiscoveryProvider.cs | 0 .../MyServiceDiscoveryProviderFactory.cs | 0 .../ApiGateway/appsettings.json | 0 .../ApiGateway/ocelot.json | 0 .../Controllers/CategoriesController.cs | 0 .../Controllers/HealthController.cs | 0 .../Controllers/WeatherForecastController.cs | 0 .../DownstreamService/Models/HealthResult.cs | 0 .../Models/MicroserviceResult.cs | 0 .../DownstreamService/Models/ReadyResult.cs | 0 .../Models/WeatherForecast.cs | 0 ....ServiceDiscovery.DownstreamService.csproj | 13 + .../DownstreamService/Program.cs | 0 .../Properties/launchSettings.json | 0 .../DownstreamService/Startup.cs | 0 .../appsettings.Development.json | 0 .../DownstreamService/appsettings.json | 0 .../Ocelot.Samples.ServiceDiscovery.sln | 0 .../README.md | 0 .../.gitignore | 0 ...t.Samples.ServiceFabric.ApiGateway.csproj} | 2 +- .../OcelotApplicationApiGateway.cs | 0 .../ApiGateway}/Program.cs | 0 .../Properties/launchSettings.json | 0 .../ApiGateway}/ServiceEventListener.cs | 0 .../ApiGateway}/ServiceEventSource.cs | 0 .../ApiGateway}/WebCommunicationListener.cs | 0 .../ApiGateway}/appsettings.json | 0 .../ApiGateway}/ocelot.json | 42 +-- .../CONTRIBUTING.md | 0 .../DownstreamService}/ApiGateway.cs | 0 .../Controllers/ValuesController.cs | 0 ...es.ServiceFabric.DownstreamService.csproj} | 0 .../DownstreamService}/Program.cs | 0 .../Properties/launchSettings.json | 0 .../DownstreamService}/ServiceEventSource.cs | 0 .../DownstreamService}/Startup.cs | 0 .../LICENSE.md | 0 .../OcelotApplication/ApplicationManifest.xml | 0 .../Code/entryPoint.cmd | 0 .../Code/entryPoint.sh | 0 .../Config/Settings.xml | 0 .../Config/_readme.txt | 0 .../Data/_readme.txt | 0 .../ServiceManifest-Linux.xml | 0 .../ServiceManifest-Windows.xml | 0 .../ServiceManifest.xml | 0 .../Code/entryPoint.cmd | 0 .../Code/entryPoint.sh | 0 .../Config/Settings.xml | 0 .../Config/_readme.txt | 0 .../Data/_readme.txt | 0 .../ServiceManifest-Linux.xml | 0 .../ServiceManifest-Windows.xml | 0 .../ServiceManifest.xml | 0 .../README.md | 0 .../build.bat | 0 .../build.sh | 0 .../dotnet-include.sh | 0 .../install.ps1 | 0 .../install.sh | 0 .../uninstall.ps1 | 0 .../uninstall.sh | 0 .../PollyQoSProviderBase.cs | 6 +- .../v7/PollyQoSProvider.cs | 2 +- .../Configuration/AuthenticationOptions.cs | 13 +- .../Builder/AuthenticationOptionsBuilder.cs | 2 +- .../File/FileAuthenticationOptions.cs | 6 +- .../LoadBalancers/LoadBalancerHouse.cs | 7 +- src/Ocelot/Middleware/HttpItemsExtensions.cs | 2 +- .../Multiplexer/MultiplexingMiddleware.cs | 2 +- .../DownstreamRequestInitialiserMiddleware.cs | 2 +- src/Ocelot/Requester/MessageInvokerPool.cs | 28 +- test/Ocelot.AcceptanceTests/AggregateTests.cs | 247 +++++++-------- .../Authentication/AuthenticationSteps.cs | 30 +- .../Authentication/AuthenticationTests.cs | 8 + .../MultipleAuthSchemesFeatureTests.cs | 6 +- .../Caching/CachingTests.cs | 14 +- test/Ocelot.AcceptanceTests/ContentTests.cs | 14 +- .../Ocelot.AcceptanceTests.csproj | 4 +- test/Ocelot.AcceptanceTests/PollyQoSTests.cs | 182 ++++++----- .../Request/RequestMapperTests.cs | 8 +- .../Request/StreamContentTests.cs | 27 +- .../Requester/PayloadTooLargeTests.cs | 8 +- test/Ocelot.AcceptanceTests/RoutingTests.cs | 2 +- .../ServiceDiscoveryTests.cs | 14 +- .../ServiceFabricTests.cs | 6 +- test/Ocelot.AcceptanceTests/Steps.cs | 31 +- .../Ocelot.Benchmarks.csproj | 4 +- test/Ocelot.Benchmarks/PayloadBenchmarks.cs | 20 +- test/Ocelot.Benchmarks/ResponseBenchmarks.cs | 22 +- .../Ocelot.IntegrationTests.csproj | 4 +- .../Ocelot.ManualTest}/Dockerfile | 94 +++--- .../Ocelot.ManualTest.csproj | 4 +- .../Ocelot.ManualTest}/docker-compose.yaml | 48 +-- .../OcelotAdministrationBuilderTests.cs | 4 +- .../AuthenticationMiddlewareTests.cs | 6 +- .../AuthorizationMiddlewareTests.cs | 2 +- .../Authorization/ClaimsAuthorizerTests.cs | 2 +- .../Cache/AspMemoryCacheTests.cs | 2 +- .../Cache/DefaultCacheKeyGeneratorTests.cs | 2 +- .../Cache/OutputCacheMiddlewareTests.cs | 2 +- .../Cache/RegionCreatorTests.cs | 2 +- .../OcelotBuilderExtensionsTests.cs | 2 +- .../CacheManager/OcelotCacheManagerCache.cs | 2 +- .../OutputCacheMiddlewareRealCacheTests.cs | 2 +- .../Claims/AddClaimsToRequestTests.cs | 2 +- .../Claims/ClaimsToClaimsMiddlewareTests.cs | 2 +- .../Configuration/AggregatesCreatorTests.cs | 2 +- .../AuthenticationOptionsCreatorTests.cs | 2 +- ...elotConfigurationChangeTokenSourceTests.cs | 2 +- .../OcelotConfigurationChangeTokenTests.cs | 2 +- .../ClaimToThingConfigurationParserTests.cs | 2 +- .../ClaimsToThingCreatorTests.cs | 2 +- .../ConfigurationCreatorTests.cs | 2 +- .../DiskFileConfigurationRepositoryTests.cs | 2 +- .../DownstreamAddressesCreatorTests.cs | 2 +- .../Configuration/DynamicsCreatorTests.cs | 2 +- .../FileConfigurationPollerTests.cs | 2 +- .../FileConfigurationSetterTests.cs | 2 +- .../FileInternalConfigurationCreatorTests.cs | 2 +- .../HeaderFindAndReplaceCreatorTests.cs | 2 +- .../HttpHandlerOptionsCreatorTests.cs | 2 +- .../InMemoryConfigurationRepositoryTests.cs | 2 +- .../LoadBalancerOptionsCreatorTests.cs | 2 +- .../Configuration/QoSOptionsCreatorTests.cs | 2 +- .../RateLimitOptionsCreatorTests.cs | 2 +- .../Configuration/RequestIdKeyCreatorTests.cs | 2 +- .../Configuration/RouteKeyCreatorTests.cs | 22 +- .../Configuration/RouteOptionsCreatorTests.cs | 4 +- .../Configuration/RoutesCreatorTests.cs | 2 +- .../SecurityOptionsCreatorTests.cs | 2 +- .../ServiceProviderCreatorTests.cs | 2 +- .../UpstreamTemplatePatternCreatorTests.cs | 2 +- .../FileConfigurationFluentValidatorTests.cs | 132 +++----- .../FileQoSOptionsFluentValidatorTests.cs | 2 +- .../Validation/HostAndPortValidatorTests.cs | 2 +- .../Validation/RouteFluentValidatorTests.cs | 2 +- .../Configuration/VersionCreatorTests.cs | 2 +- .../ConsulFileConfigurationRepositoryTests.cs | 2 +- .../ConsulServiceDiscoveryProviderTests.cs | 2 +- .../Consul/OcelotBuilderExtensionsTests.cs | 2 +- ...lingConsulServiceDiscoveryProviderTests.cs | 2 +- .../FileConfigurationControllerTests.cs | 2 +- .../Controllers/OutputCacheControllerTests.cs | 2 +- .../ConfigurationBuilderExtensionsTests.cs | 22 +- .../DependencyInjection/OcelotBuilderTests.cs | 2 +- .../ServiceCollectionExtensionsTests.cs | 2 +- .../ChangeDownstreamPathTemplateTests.cs | 2 +- .../ClaimsToDownstreamPathMiddlewareTests.cs | 2 +- .../DownstreamRouteCreatorTests.cs | 2 +- .../DownstreamRouteFinderMiddlewareTests.cs | 2 +- .../DownstreamRouteFinderTests.cs | 2 +- .../DownstreamRouteProviderFactoryTests.cs | 2 +- .../UrlMatcher/RegExUrlMatcherTests.cs | 2 +- ...lPathPlaceholderNameAndValueFinderTests.cs | 2 +- .../DownstreamPathPlaceholderReplacerTests.cs | 2 +- .../DownstreamUrlCreatorMiddlewareTests.cs | 2 +- .../Errors/ExceptionHandlerMiddlewareTests.cs | 2 +- .../EurekaServiceDiscoveryProviderTests.cs | 2 +- test/Ocelot.UnitTests/FileUnitTest.cs | 9 +- .../AddHeadersToRequestClaimToThingTests.cs | 2 +- .../Headers/AddHeadersToRequestPlainTests.cs | 2 +- .../Headers/AddHeadersToResponseTests.cs | 2 +- .../Headers/ClaimsToHeadersMiddlewareTests.cs | 2 +- .../HttpContextRequestHeaderReplacerTests.cs | 2 +- ...ttpHeadersTransformationMiddlewareTests.cs | 2 +- .../HttpResponseHeaderReplacerTests.cs | 2 +- .../Headers/RemoveHeadersTests.cs | 2 +- .../Infrastructure/ClaimParserTests.cs | 2 +- .../Infrastructure/HttpDataRepositoryTests.cs | 2 +- .../IScopedRequestDataRepository.cs | 1 - .../Infrastructure/ScopesAuthorizerTests.cs | 2 +- test/Ocelot.UnitTests/Kubernetes/KubeTests.cs | 2 +- .../OcelotBuilderExtensionsTests.cs | 2 +- .../Kubernetes/PollKubeTests.cs | 2 +- .../CookieStickySessionsCreatorTests.cs | 2 +- .../LoadBalancer/CookieStickySessionsTests.cs | 2 +- ...elegateInvokingLoadBalancerCreatorTests.cs | 2 +- .../LeastConnectionCreatorTests.cs | 2 +- .../LoadBalancer/LeastConnectionTests.cs | 2 +- .../LoadBalancer/LoadBalancerFactoryTests.cs | 2 +- .../LoadBalancer/LoadBalancerHouseTests.cs | 2 +- .../LoadBalancerMiddlewareTests.cs | 2 +- .../NoLoadBalancerCreatorTests.cs | 2 +- .../LoadBalancer/NoLoadBalancerTests.cs | 2 +- .../LoadBalancer/RoundRobinCreatorTests.cs | 2 +- .../LoadBalancer/RoundRobinTests.cs | 2 +- .../Logging/OcelotDiagnosticListenerTests.cs | 2 +- .../Middleware/BaseUrlFinderTests.cs | 2 +- .../OcelotPipelineExtensionsTests.cs | 2 +- .../Middleware/OcelotPiplineBuilderTests.cs | 2 +- .../DefinedAggregatorProviderTests.cs | 2 +- .../MultiplexingMiddlewareTests.cs | 16 +- .../ResponseAggregatorFactoryTests.cs | 2 +- .../SimpleJsonResponseAggregatorTests.cs | 2 +- .../UserDefinedResponseAggregatorTests.cs | 2 +- test/Ocelot.UnitTests/Ocelot.UnitTests.csproj | 3 +- ...esiliencePipelineDelegatingHandlerTests.cs | 2 +- .../QueryStrings/AddQueriesToRequestTests.cs | 2 +- .../ClaimsToQueryStringMiddlewareTests.cs | 2 +- .../ClientRateLimitMiddlewareTests.cs | 2 +- .../ScopedRequestDataRepositoryTests.cs | 2 +- .../Creator/DownstreamRequestCreatorTests.cs | 2 +- ...streamRequestInitialiserMiddlewareTests.cs | 2 +- .../Request/Mapper/RequestMapperTests.cs | 7 +- .../Request/Mapper/StreamHttpContentTests.cs | 15 +- .../RequestId/RequestIdMiddlewareTests.cs | 2 +- ...atingHandlerHandlerProviderFactoryTests.cs | 2 +- .../Requester/HttpRequesterMiddlewareTests.cs | 2 +- .../Requester/MessageInvokerPoolTests.cs | 6 +- .../ErrorsToHttpStatusCodeMapperTests.cs | 4 +- .../Responder/ResponderMiddlewareTests.cs | 2 +- .../Security/IPSecurityPolicyTests.cs | 2 +- .../Security/SecurityMiddlewareTests.cs | 2 +- .../ConfigurationServiceProviderTests.cs | 2 +- .../ServiceDiscoveryProviderFactoryTests.cs | 2 +- ...viceFabricServiceDiscoveryProviderTests.cs | 2 +- .../ServiceDiscovery/ServiceRegistryTests.cs | 2 +- test/Ocelot.UnitTests/UnitTest.cs | 9 +- .../WebSocketsProxyMiddlewareTests.cs | 2 +- 296 files changed, 1913 insertions(+), 1545 deletions(-) delete mode 100644 Directory.Build.props create mode 100644 Ocelot.Release.sln rename samples/{AdministrationApi => Administration}/Issue645.postman_collection.json (97%) rename samples/{AdministrationApi/AdministrationApi.csproj => Administration/Ocelot.Samples.AdministrationApi.csproj} (100%) rename samples/{AdministrationApi => Administration}/Program.cs (100%) rename samples/{AdministrationApi => Administration}/Properties/launchSettings.json (100%) rename samples/{AdministrationApi => Administration}/README.md (96%) rename samples/{AdministrationApi => Administration}/appsettings.json (100%) rename samples/{AdministrationApi => Administration}/ocelot.json (95%) rename samples/{AdministrationApi => Administration}/tempkey.rsa (100%) rename samples/{OcelotBasic/Ocelot.Samples.OcelotBasic.ApiGateway.csproj => Basic/Ocelot.Samples.Basic.ApiGateway.csproj} (100%) rename samples/{OcelotBasic => Basic}/Program.cs (97%) rename samples/{OcelotBasic => Basic}/Properties/launchSettings.json (100%) rename samples/{OcelotBasic => Basic}/Startup.cs (100%) rename samples/{OcelotBasic => Basic}/appsettings.Development.json (100%) rename samples/{OcelotKube/ApiGateway => Basic}/appsettings.json (100%) rename samples/{OcelotBasic => Basic}/ocelot.json (95%) delete mode 100644 samples/Docker/README.md rename samples/{OcelotEureka/ApiGateway/ApiGateway.csproj => Eureka/ApiGateway/Ocelot.Samples.Eureka.ApiGateway.csproj} (100%) rename samples/{OcelotEureka => Eureka}/ApiGateway/Program.cs (100%) rename samples/{OcelotEureka => Eureka}/ApiGateway/Properties/launchSettings.json (100%) rename samples/{OcelotEureka => Eureka}/ApiGateway/appsettings.json (100%) rename samples/{OcelotEureka => Eureka}/ApiGateway/ocelot.json (96%) rename samples/{OcelotEureka => Eureka}/DownstreamService/Controllers/CategoryController.cs (100%) rename samples/{OcelotEureka/DownstreamService/DownstreamService.csproj => Eureka/DownstreamService/Ocelot.Samples.Eureka.DownstreamService.csproj} (100%) rename samples/{OcelotEureka => Eureka}/DownstreamService/Program.cs (100%) rename samples/{OcelotEureka => Eureka}/DownstreamService/Properties/launchSettings.json (100%) rename samples/{OcelotEureka => Eureka}/DownstreamService/Startup.cs (100%) rename samples/{OcelotEureka => Eureka}/DownstreamService/appsettings.Development.json (100%) rename samples/{OcelotEureka => Eureka}/DownstreamService/appsettings.json (100%) rename samples/{OcelotEureka => Eureka}/OcelotEureka.sln (100%) rename samples/{OcelotEureka => Eureka}/README.md (100%) rename samples/{OcelotGraphQL/OcelotGraphQL.csproj => GraphQL/Ocelot.Samples.GraphQL.csproj} (100%) rename samples/{OcelotGraphQL => GraphQL}/OcelotGraphQL.sln (100%) rename samples/{OcelotGraphQL => GraphQL}/Program.cs (96%) rename samples/{OcelotGraphQL => GraphQL}/Properties/launchSettings.json (100%) rename samples/{OcelotGraphQL => GraphQL}/README.md (96%) rename samples/{OcelotGraphQL => GraphQL}/ocelot.json (96%) rename samples/{OcelotKube => Kubernetes}/.dockerignore (100%) rename samples/{OcelotKube => Kubernetes}/ApiGateway/Dockerfile (100%) rename samples/{OcelotKube/ApiGateway/Ocelot.Samples.OcelotKube.ApiGateway.csproj => Kubernetes/ApiGateway/Ocelot.Samples.Kubernetes.ApiGateway.csproj} (100%) rename samples/{OcelotKube => Kubernetes}/ApiGateway/Program.cs (100%) rename samples/{OcelotKube => Kubernetes}/ApiGateway/Properties/launchSettings.json (100%) rename samples/{OcelotKube => Kubernetes}/ApiGateway/Startup.cs (100%) rename samples/{OcelotKube => Kubernetes}/ApiGateway/appsettings.Development.json (100%) rename samples/{OcelotKube/DownstreamService => Kubernetes/ApiGateway}/appsettings.json (100%) rename samples/{OcelotKube => Kubernetes}/ApiGateway/ocelot.json (95%) rename samples/{OcelotKube => Kubernetes}/Dockerfile (100%) rename samples/{OcelotKube => Kubernetes}/DownstreamService/Controllers/ValuesController.cs (100%) rename samples/{OcelotKube => Kubernetes}/DownstreamService/Controllers/WeatherForecastController.cs (100%) rename samples/{OcelotKube => Kubernetes}/DownstreamService/Dockerfile (100%) rename samples/{OcelotKube => Kubernetes}/DownstreamService/Models/WeatherForecast.cs (100%) rename samples/{OcelotKube/DownstreamService/Ocelot.Samples.OcelotKube.DownstreamService.csproj => Kubernetes/DownstreamService/Ocelot.Samples.Kubernetes.DownstreamService.csproj} (86%) rename samples/{OcelotKube => Kubernetes}/DownstreamService/Program.cs (100%) rename samples/{OcelotKube => Kubernetes}/DownstreamService/Properties/launchSettings.json (100%) rename samples/{OcelotKube => Kubernetes}/DownstreamService/appsettings.Development.json (100%) rename samples/{OcelotBasic => Kubernetes/DownstreamService}/appsettings.json (92%) rename samples/{OcelotKube => Kubernetes}/OcelotKube.sln (100%) create mode 100644 samples/Ocelot.Samples.sln delete mode 100644 samples/OcelotServiceDiscovery/DownstreamService/.dockerignore delete mode 100644 samples/OcelotServiceDiscovery/DownstreamService/Dockerfile delete mode 100644 samples/OcelotServiceDiscovery/DownstreamService/Ocelot.Samples.ServiceDiscovery.DownstreamService.csproj rename samples/{OcelotOpenTracing/OcelotOpenTracing.csproj => OpenTracing/Ocelot.Samples.OpenTracing.csproj} (100%) rename samples/{OcelotOpenTracing => OpenTracing}/Program.cs (100%) rename samples/{OcelotOpenTracing => OpenTracing}/appsettings.Development.json (100%) rename samples/{OcelotOpenTracing => OpenTracing}/appsettings.json (100%) rename samples/{OcelotOpenTracing => OpenTracing}/ocelot.json (100%) rename samples/{OcelotServiceDiscovery => ServiceDiscovery}/.dockerignore (100%) rename samples/{OcelotServiceDiscovery => ServiceDiscovery}/ApiGateway/Ocelot.Samples.ServiceDiscovery.ApiGateway.csproj (59%) rename samples/{OcelotServiceDiscovery => ServiceDiscovery}/ApiGateway/Program.cs (100%) rename samples/{OcelotServiceDiscovery => ServiceDiscovery}/ApiGateway/Properties/launchSettings.json (100%) rename samples/{OcelotServiceDiscovery => ServiceDiscovery}/ApiGateway/ServiceDiscovery/MyServiceDiscoveryProvider.cs (100%) rename samples/{OcelotServiceDiscovery => ServiceDiscovery}/ApiGateway/ServiceDiscovery/MyServiceDiscoveryProviderFactory.cs (100%) rename samples/{OcelotServiceDiscovery => ServiceDiscovery}/ApiGateway/appsettings.json (100%) rename samples/{OcelotServiceDiscovery => ServiceDiscovery}/ApiGateway/ocelot.json (100%) rename samples/{OcelotServiceDiscovery => ServiceDiscovery}/DownstreamService/Controllers/CategoriesController.cs (100%) rename samples/{OcelotServiceDiscovery => ServiceDiscovery}/DownstreamService/Controllers/HealthController.cs (100%) rename samples/{OcelotServiceDiscovery => ServiceDiscovery}/DownstreamService/Controllers/WeatherForecastController.cs (100%) rename samples/{OcelotServiceDiscovery => ServiceDiscovery}/DownstreamService/Models/HealthResult.cs (100%) rename samples/{OcelotServiceDiscovery => ServiceDiscovery}/DownstreamService/Models/MicroserviceResult.cs (100%) rename samples/{OcelotServiceDiscovery => ServiceDiscovery}/DownstreamService/Models/ReadyResult.cs (100%) rename samples/{OcelotServiceDiscovery => ServiceDiscovery}/DownstreamService/Models/WeatherForecast.cs (100%) create mode 100644 samples/ServiceDiscovery/DownstreamService/Ocelot.Samples.ServiceDiscovery.DownstreamService.csproj rename samples/{OcelotServiceDiscovery => ServiceDiscovery}/DownstreamService/Program.cs (100%) rename samples/{OcelotServiceDiscovery => ServiceDiscovery}/DownstreamService/Properties/launchSettings.json (100%) rename samples/{OcelotServiceDiscovery => ServiceDiscovery}/DownstreamService/Startup.cs (100%) rename samples/{OcelotServiceDiscovery => ServiceDiscovery}/DownstreamService/appsettings.Development.json (100%) rename samples/{OcelotServiceDiscovery => ServiceDiscovery}/DownstreamService/appsettings.json (100%) rename samples/{OcelotServiceDiscovery => ServiceDiscovery}/Ocelot.Samples.ServiceDiscovery.sln (100%) rename samples/{OcelotServiceDiscovery => ServiceDiscovery}/README.md (100%) rename samples/{OcelotServiceFabric => ServiceFabric}/.gitignore (100%) rename samples/{OcelotServiceFabric/src/OcelotApplicationApiGateway/OcelotApplicationApiGateway.csproj => ServiceFabric/ApiGateway/Ocelot.Samples.ServiceFabric.ApiGateway.csproj} (92%) rename samples/{OcelotServiceFabric/src/OcelotApplicationApiGateway => ServiceFabric/ApiGateway}/OcelotApplicationApiGateway.cs (100%) rename samples/{OcelotServiceFabric/src/OcelotApplicationApiGateway => ServiceFabric/ApiGateway}/Program.cs (100%) rename samples/{OcelotServiceFabric/src/OcelotApplicationApiGateway => ServiceFabric/ApiGateway}/Properties/launchSettings.json (100%) rename samples/{OcelotServiceFabric/src/OcelotApplicationApiGateway => ServiceFabric/ApiGateway}/ServiceEventListener.cs (100%) rename samples/{OcelotServiceFabric/src/OcelotApplicationApiGateway => ServiceFabric/ApiGateway}/ServiceEventSource.cs (100%) rename samples/{OcelotServiceFabric/src/OcelotApplicationApiGateway => ServiceFabric/ApiGateway}/WebCommunicationListener.cs (100%) rename samples/{OcelotServiceFabric/src/OcelotApplicationApiGateway => ServiceFabric/ApiGateway}/appsettings.json (100%) rename samples/{OcelotServiceFabric/src/OcelotApplicationApiGateway => ServiceFabric/ApiGateway}/ocelot.json (95%) rename samples/{OcelotServiceFabric => ServiceFabric}/CONTRIBUTING.md (100%) rename samples/{OcelotServiceFabric/src/OcelotApplicationService => ServiceFabric/DownstreamService}/ApiGateway.cs (100%) rename samples/{OcelotServiceFabric/src/OcelotApplicationService => ServiceFabric/DownstreamService}/Controllers/ValuesController.cs (100%) rename samples/{OcelotServiceFabric/src/OcelotApplicationService/OcelotApplicationService.csproj => ServiceFabric/DownstreamService/Ocelot.Samples.ServiceFabric.DownstreamService.csproj} (100%) rename samples/{OcelotServiceFabric/src/OcelotApplicationService => ServiceFabric/DownstreamService}/Program.cs (100%) rename samples/{OcelotServiceFabric/src/OcelotApplicationService => ServiceFabric/DownstreamService}/Properties/launchSettings.json (100%) rename samples/{OcelotServiceFabric/src/OcelotApplicationService => ServiceFabric/DownstreamService}/ServiceEventSource.cs (100%) rename samples/{OcelotServiceFabric/src/OcelotApplicationService => ServiceFabric/DownstreamService}/Startup.cs (100%) rename samples/{OcelotServiceFabric => ServiceFabric}/LICENSE.md (100%) rename samples/{OcelotServiceFabric => ServiceFabric}/OcelotApplication/ApplicationManifest.xml (100%) rename samples/{OcelotServiceFabric => ServiceFabric}/OcelotApplication/OcelotApplicationApiGatewayPkg/Code/entryPoint.cmd (100%) rename samples/{OcelotServiceFabric => ServiceFabric}/OcelotApplication/OcelotApplicationApiGatewayPkg/Code/entryPoint.sh (100%) rename samples/{OcelotServiceFabric => ServiceFabric}/OcelotApplication/OcelotApplicationApiGatewayPkg/Config/Settings.xml (100%) rename samples/{OcelotServiceFabric => ServiceFabric}/OcelotApplication/OcelotApplicationApiGatewayPkg/Config/_readme.txt (100%) rename samples/{OcelotServiceFabric => ServiceFabric}/OcelotApplication/OcelotApplicationApiGatewayPkg/Data/_readme.txt (100%) rename samples/{OcelotServiceFabric => ServiceFabric}/OcelotApplication/OcelotApplicationApiGatewayPkg/ServiceManifest-Linux.xml (100%) rename samples/{OcelotServiceFabric => ServiceFabric}/OcelotApplication/OcelotApplicationApiGatewayPkg/ServiceManifest-Windows.xml (100%) rename samples/{OcelotServiceFabric => ServiceFabric}/OcelotApplication/OcelotApplicationApiGatewayPkg/ServiceManifest.xml (100%) rename samples/{OcelotServiceFabric => ServiceFabric}/OcelotApplication/OcelotApplicationServicePkg/Code/entryPoint.cmd (100%) rename samples/{OcelotServiceFabric => ServiceFabric}/OcelotApplication/OcelotApplicationServicePkg/Code/entryPoint.sh (100%) rename samples/{OcelotServiceFabric => ServiceFabric}/OcelotApplication/OcelotApplicationServicePkg/Config/Settings.xml (100%) rename samples/{OcelotServiceFabric => ServiceFabric}/OcelotApplication/OcelotApplicationServicePkg/Config/_readme.txt (100%) rename samples/{OcelotServiceFabric => ServiceFabric}/OcelotApplication/OcelotApplicationServicePkg/Data/_readme.txt (100%) rename samples/{OcelotServiceFabric => ServiceFabric}/OcelotApplication/OcelotApplicationServicePkg/ServiceManifest-Linux.xml (100%) rename samples/{OcelotServiceFabric => ServiceFabric}/OcelotApplication/OcelotApplicationServicePkg/ServiceManifest-Windows.xml (100%) rename samples/{OcelotServiceFabric => ServiceFabric}/OcelotApplication/OcelotApplicationServicePkg/ServiceManifest.xml (100%) rename samples/{OcelotServiceFabric => ServiceFabric}/README.md (100%) rename samples/{OcelotServiceFabric => ServiceFabric}/build.bat (100%) rename samples/{OcelotServiceFabric => ServiceFabric}/build.sh (100%) rename samples/{OcelotServiceFabric => ServiceFabric}/dotnet-include.sh (100%) rename samples/{OcelotServiceFabric => ServiceFabric}/install.ps1 (100%) rename samples/{OcelotServiceFabric => ServiceFabric}/install.sh (100%) rename samples/{OcelotServiceFabric => ServiceFabric}/uninstall.ps1 (100%) rename samples/{OcelotServiceFabric => ServiceFabric}/uninstall.sh (100%) rename {samples/Docker => test/Ocelot.ManualTest}/Dockerfile (98%) rename {samples/Docker-Compose => test/Ocelot.ManualTest}/docker-compose.yaml (95%) delete mode 100644 test/Ocelot.UnitTests/Infrastructure/IScopedRequestDataRepository.cs diff --git a/.circleci/config.yml b/.circleci/config.yml index cbdcf7c9d..876d46b5c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,10 +1,11 @@ version: 2.1 orbs: - queue: eddiewebb/queue@2.2.1 + queue: eddiewebb/queue@3.1.4 jobs: build: docker: - image: ocelot2/circleci-build:latest + resource_class: medium+ steps: - checkout - run: dotnet tool restore && dotnet cake @@ -18,12 +19,12 @@ workflows: version: 2 main: jobs: - - queue/block_workflow: - time: '20' - only-on-branch: main + # - queue/block_workflow: + # time: '20' + # only-on-branch: main - release: - requires: - - queue/block_workflow + # requires: + # - queue/block_workflow filters: branches: only: main @@ -33,7 +34,7 @@ workflows: filters: branches: only: develop - pr: + PR: jobs: - build: filters: diff --git a/.editorconfig b/.editorconfig index e4e769b52..e8766a5e0 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,15 +1,246 @@ +# Remove the line below if you want to inherit .editorconfig settings from higher directories root = true -[*] -end_of_line = lf -insert_final_newline = true +# XML files +[*.xml] +indent_style = space +indent_size = 2 +# C# files [*.cs] -end_of_line = lf -indent_style = space -indent_size = 4 -# XML files -[*.xml] +#### Core EditorConfig Options #### + +# Indentation and spacing +indent_size = 4 indent_style = space -indent_size = 2 +tab_width = 4 + +# New line preferences +end_of_line = crlf +insert_final_newline = true + +#### .NET Coding Conventions #### + +# Organize usings +dotnet_separate_import_directive_groups = false +dotnet_sort_system_directives_first = false +file_header_template = unset + +# this. and Me. preferences +dotnet_style_qualification_for_event = false +dotnet_style_qualification_for_field = false +dotnet_style_qualification_for_method = false +dotnet_style_qualification_for_property = false + +# Language keywords vs BCL types preferences +dotnet_style_predefined_type_for_locals_parameters_members = true +dotnet_style_predefined_type_for_member_access = true + +# Parentheses preferences +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity +dotnet_style_parentheses_in_other_operators = never_if_unnecessary +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity + +# Modifier preferences +dotnet_style_require_accessibility_modifiers = for_non_interface_members + +# Expression-level preferences +dotnet_style_coalesce_expression = true +dotnet_style_collection_initializer = true +dotnet_style_explicit_tuple_names = true +dotnet_style_namespace_match_folder = true +dotnet_style_null_propagation = true +dotnet_style_object_initializer = true +dotnet_style_operator_placement_when_wrapping = beginning_of_line +dotnet_style_prefer_auto_properties = true +dotnet_style_prefer_collection_expression = false:suggestion +dotnet_style_prefer_compound_assignment = true +dotnet_style_prefer_conditional_expression_over_assignment = true +dotnet_style_prefer_conditional_expression_over_return = true +dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed +dotnet_style_prefer_inferred_anonymous_type_member_names = true +dotnet_style_prefer_inferred_tuple_names = true +dotnet_style_prefer_is_null_check_over_reference_equality_method = true +dotnet_style_prefer_simplified_boolean_expressions = true +dotnet_style_prefer_simplified_interpolation = true + +# Field preferences +dotnet_style_readonly_field = true + +# Parameter preferences +dotnet_code_quality_unused_parameters = all + +# Suppression preferences +dotnet_remove_unnecessary_suppression_exclusions = none + +# New line preferences +dotnet_style_allow_multiple_blank_lines_experimental = true +dotnet_style_allow_statement_immediately_after_block_experimental = true + +#### C# Coding Conventions #### + +# var preferences +csharp_style_var_elsewhere = false +csharp_style_var_for_built_in_types = false +csharp_style_var_when_type_is_apparent = false + +# Expression-bodied members +csharp_style_expression_bodied_accessors = true:silent +csharp_style_expression_bodied_constructors = false:silent +csharp_style_expression_bodied_indexers = true:silent +csharp_style_expression_bodied_lambdas = true:silent +csharp_style_expression_bodied_local_functions = false:silent +csharp_style_expression_bodied_methods = false:silent +csharp_style_expression_bodied_operators = false:silent +csharp_style_expression_bodied_properties = true:silent + +# Pattern matching preferences +csharp_style_pattern_matching_over_as_with_null_check = true +csharp_style_pattern_matching_over_is_with_cast_check = true +csharp_style_prefer_extended_property_pattern = true +csharp_style_prefer_not_pattern = true +csharp_style_prefer_pattern_matching = true +csharp_style_prefer_switch_expression = true + +# Null-checking preferences +csharp_style_conditional_delegate_call = true + +# Modifier preferences +csharp_prefer_static_local_function = true +csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async +csharp_style_prefer_readonly_struct = true +csharp_style_prefer_readonly_struct_member = true + +# Code-block preferences +csharp_prefer_braces = true:silent +csharp_prefer_simple_using_statement = true:suggestion +csharp_style_namespace_declarations = block_scoped:silent +csharp_style_prefer_method_group_conversion = true:silent +csharp_style_prefer_primary_constructors = false:suggestion +csharp_style_prefer_top_level_statements = true:silent + +# Expression-level preferences +csharp_prefer_simple_default_expression = true +csharp_style_deconstructed_variable_declaration = true +csharp_style_implicit_object_creation_when_type_is_apparent = true +csharp_style_inlined_variable_declaration = true +csharp_style_prefer_index_operator = true +csharp_style_prefer_local_over_anonymous_function = true +csharp_style_prefer_null_check_over_type_check = true +csharp_style_prefer_range_operator = true +csharp_style_prefer_tuple_swap = true +csharp_style_prefer_utf8_string_literals = true +csharp_style_throw_expression = true +csharp_style_unused_value_assignment_preference = discard_variable +csharp_style_unused_value_expression_statement_preference = discard_variable + +# 'using' directive preferences +csharp_using_directive_placement = outside_namespace:silent + +# New line preferences +csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true +csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true +csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true +csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true +csharp_style_allow_embedded_statements_on_same_line_experimental = true + +#### C# Formatting Rules #### + +# New line preferences +csharp_new_line_before_catch = true +csharp_new_line_before_else = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_open_brace = all +csharp_new_line_between_query_expression_clauses = true + +# Indentation preferences +csharp_indent_block_contents = true +csharp_indent_braces = false +csharp_indent_case_contents = true +csharp_indent_case_contents_when_block = true +csharp_indent_labels = one_less_than_current +csharp_indent_switch_labels = true + +# Space preferences +csharp_space_after_cast = false +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_after_comma = true +csharp_space_after_dot = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_after_semicolon_in_for_statement = true +csharp_space_around_binary_operators = before_and_after +csharp_space_around_declaration_statements = false +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_before_comma = false +csharp_space_before_dot = false +csharp_space_before_open_square_brackets = false +csharp_space_before_semicolon_in_for_statement = false +csharp_space_between_empty_square_brackets = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_name_and_open_parenthesis = false +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_parentheses = false +csharp_space_between_square_brackets = false + +# Wrapping preferences +csharp_preserve_single_line_blocks = true +csharp_preserve_single_line_statements = true + +#### Naming styles #### + +# Naming rules + +dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion +dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface +dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i + +dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.types_should_be_pascal_case.symbols = types +dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case + +dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members +dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case + +# Symbol specifications + +dotnet_naming_symbols.interface.applicable_kinds = interface +dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.interface.required_modifiers = + +dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum +dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.types.required_modifiers = + +dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method +dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.non_field_members.required_modifiers = + +# Naming styles + +dotnet_naming_style.pascal_case.required_prefix = +dotnet_naming_style.pascal_case.required_suffix = +dotnet_naming_style.pascal_case.word_separator = +dotnet_naming_style.pascal_case.capitalization = pascal_case + +dotnet_naming_style.begins_with_i.required_prefix = I +dotnet_naming_style.begins_with_i.required_suffix = +dotnet_naming_style.begins_with_i.word_separator = +dotnet_naming_style.begins_with_i.capitalization = pascal_case + +[*.{cs,vb}] +dotnet_style_operator_placement_when_wrapping = beginning_of_line +tab_width = 4 +indent_size = 4 +end_of_line = crlf +dotnet_style_coalesce_expression = true:suggestion +insert_final_newline = true +dotnet_style_null_propagation = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion diff --git a/Directory.Build.props b/Directory.Build.props deleted file mode 100644 index 4fe1ec98f..000000000 --- a/Directory.Build.props +++ /dev/null @@ -1,15 +0,0 @@ - - - latest - git - https://github.com/ThreeMammals/Ocelot - - true - - true - snupkg - - - - - diff --git a/Ocelot.Release.sln b/Ocelot.Release.sln new file mode 100644 index 000000000..20a76ee83 --- /dev/null +++ b/Ocelot.Release.sln @@ -0,0 +1,231 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.9.34728.123 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5CFB79B7-C9DC-45A4-9A75-625D92471702}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3FA7C349-DBE8-4904-A2CE-015B8869CE6C}" + ProjectSection(SolutionItems) = preProject + .dockerignore = .dockerignore + .editorconfig = .editorconfig + .gitignore = .gitignore + .readthedocs.yaml = .readthedocs.yaml + build.cake = build.cake + build.ps1 = build.ps1 + codeanalysis.ruleset = codeanalysis.ruleset + .circleci\config.yml = .circleci\config.yml + GitVersion.yml = GitVersion.yml + LICENSE.md = LICENSE.md + README.md = README.md + ReleaseNotes.md = ReleaseNotes.md + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{5B401523-36DA-4491-B73A-7590A26E420B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.UnitTests", "test\Ocelot.UnitTests\Ocelot.UnitTests.csproj", "{54E84F1A-E525-4443-96EC-039CBD50C263}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.AcceptanceTests", "test\Ocelot.AcceptanceTests\Ocelot.AcceptanceTests.csproj", "{F8C224FE-36BE-45F5-9B0E-666D8F4A9B52}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.ManualTest", "test\Ocelot.ManualTest\Ocelot.ManualTest.csproj", "{02BBF4C5-517E-4157-8D21-4B8B9E118B7A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Benchmarks", "test\Ocelot.Benchmarks\Ocelot.Benchmarks.csproj", "{106B49E6-95F6-4A7B-B81C-96BFA74AF035}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.IntegrationTests", "test\Ocelot.IntegrationTests\Ocelot.IntegrationTests.csproj", "{D4575572-99CA-4530-8737-C296EDA326F8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Testing", "test\Ocelot.Testing\Ocelot.Testing.csproj", "{AE6BCCBD-0687-4C58-B30F-4ABBC6422087}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot", "src\Ocelot\Ocelot.csproj", "{D6DF4206-0DBA-41D8-884D-C3E08290FDBB}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Administration", "src\Ocelot.Administration\Ocelot.Administration.csproj", "{F69CEF43-27D2-4940-A47A-FCA879E371BC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Cache.CacheManager", "src\Ocelot.Cache.CacheManager\Ocelot.Cache.CacheManager.csproj", "{EB9F438F-062E-499F-B6EA-4412BEF6D74C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Provider.Consul", "src\Ocelot.Provider.Consul\Ocelot.Provider.Consul.csproj", "{02F5AE4D-9C36-4E58-B7C6-012CBBDEFDE0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Provider.Eureka", "src\Ocelot.Provider.Eureka\Ocelot.Provider.Eureka.csproj", "{9BBD3586-145C-4FA0-91C5-9ED58287D753}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Provider.Kubernetes", "src\Ocelot.Provider.Kubernetes\Ocelot.Provider.Kubernetes.csproj", "{72C8E528-B4F5-45CE-8A06-CD3787364856}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Provider.Polly", "src\Ocelot.Provider.Polly\Ocelot.Provider.Polly.csproj", "{1F6E5DCF-8A2E-4E24-A25D-064362DE8D0E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Tracing.Butterfly", "src\Ocelot.Tracing.Butterfly\Ocelot.Tracing.Butterfly.csproj", "{6045E23D-669C-4F27-AF8E-8EEE6DB3557F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Tracing.OpenTracing", "src\Ocelot.Tracing.OpenTracing\Ocelot.Tracing.OpenTracing.csproj", "{11C622AD-8C0A-4CF4-811B-3DBB76550797}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "samples", "{8FA0CBA0-0338-48EB-B37F-83CA5022237C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.AdministrationApi", "samples\Administration\Ocelot.Samples.AdministrationApi.csproj", "{A7F0CAFA-AECB-43CA-BE89-5F5B728E7C22}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.Basic.ApiGateway", "samples\Basic\Ocelot.Samples.Basic.ApiGateway.csproj", "{F00C73F4-019D-490D-8194-CA1754D717FA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.Eureka.ApiGateway", "samples\Eureka\ApiGateway\Ocelot.Samples.Eureka.ApiGateway.csproj", "{FECB0C8B-5778-4441-B10E-0C815F5106D5}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.Eureka.DownstreamService", "samples\Eureka\DownstreamService\Ocelot.Samples.Eureka.DownstreamService.csproj", "{28AD7065-8DB1-4711-83BF-9EA47D75F8F7}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.GraphQL", "samples\GraphQL\Ocelot.Samples.GraphQL.csproj", "{869EE931-7E4A-40AA-ADDD-D20DF34C3BB3}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.Kubernetes.ApiGateway", "samples\Kubernetes\ApiGateway\Ocelot.Samples.Kubernetes.ApiGateway.csproj", "{681B6E08-114D-4B9B-8F82-E370CA29B8EC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.Kubernetes.DownstreamService", "samples\Kubernetes\DownstreamService\Ocelot.Samples.Kubernetes.DownstreamService.csproj", "{161DD558-993D-491B-AD20-966127D71E49}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.OpenTracing", "samples\OpenTracing\Ocelot.Samples.OpenTracing.csproj", "{DF9EFF21-58D3-428D-8A33-ACFA24E9B6E8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.ServiceDiscovery.ApiGateway", "samples\ServiceDiscovery\ApiGateway\Ocelot.Samples.ServiceDiscovery.ApiGateway.csproj", "{F25EA682-A763-431B-9D88-012A388D3618}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.ServiceDiscovery.DownstreamService", "samples\ServiceDiscovery\DownstreamService\Ocelot.Samples.ServiceDiscovery.DownstreamService.csproj", "{DCBD0AB5-85DD-4F28-9166-0A23969E19EC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.ServiceFabric.ApiGateway", "samples\ServiceFabric\ApiGateway\Ocelot.Samples.ServiceFabric.ApiGateway.csproj", "{D991C694-01F0-4F04-8135-5C133DC8E029}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.ServiceFabric.DownstreamService", "samples\ServiceFabric\DownstreamService\Ocelot.Samples.ServiceFabric.DownstreamService.csproj", "{AD09D124-7DD7-4C9E-9BCC-782B579B1786}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Release|Any CPU.Build.0 = Release|Any CPU + {54E84F1A-E525-4443-96EC-039CBD50C263}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {54E84F1A-E525-4443-96EC-039CBD50C263}.Debug|Any CPU.Build.0 = Debug|Any CPU + {54E84F1A-E525-4443-96EC-039CBD50C263}.Release|Any CPU.ActiveCfg = Release|Any CPU + {54E84F1A-E525-4443-96EC-039CBD50C263}.Release|Any CPU.Build.0 = Release|Any CPU + {F8C224FE-36BE-45F5-9B0E-666D8F4A9B52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F8C224FE-36BE-45F5-9B0E-666D8F4A9B52}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F8C224FE-36BE-45F5-9B0E-666D8F4A9B52}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F8C224FE-36BE-45F5-9B0E-666D8F4A9B52}.Release|Any CPU.Build.0 = Release|Any CPU + {02BBF4C5-517E-4157-8D21-4B8B9E118B7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {02BBF4C5-517E-4157-8D21-4B8B9E118B7A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {02BBF4C5-517E-4157-8D21-4B8B9E118B7A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {02BBF4C5-517E-4157-8D21-4B8B9E118B7A}.Release|Any CPU.Build.0 = Release|Any CPU + {106B49E6-95F6-4A7B-B81C-96BFA74AF035}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {106B49E6-95F6-4A7B-B81C-96BFA74AF035}.Debug|Any CPU.Build.0 = Debug|Any CPU + {106B49E6-95F6-4A7B-B81C-96BFA74AF035}.Release|Any CPU.ActiveCfg = Release|Any CPU + {106B49E6-95F6-4A7B-B81C-96BFA74AF035}.Release|Any CPU.Build.0 = Release|Any CPU + {D4575572-99CA-4530-8737-C296EDA326F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D4575572-99CA-4530-8737-C296EDA326F8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D4575572-99CA-4530-8737-C296EDA326F8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D4575572-99CA-4530-8737-C296EDA326F8}.Release|Any CPU.Build.0 = Release|Any CPU + {F69CEF43-27D2-4940-A47A-FCA879E371BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F69CEF43-27D2-4940-A47A-FCA879E371BC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F69CEF43-27D2-4940-A47A-FCA879E371BC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F69CEF43-27D2-4940-A47A-FCA879E371BC}.Release|Any CPU.Build.0 = Release|Any CPU + {EB9F438F-062E-499F-B6EA-4412BEF6D74C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EB9F438F-062E-499F-B6EA-4412BEF6D74C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EB9F438F-062E-499F-B6EA-4412BEF6D74C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EB9F438F-062E-499F-B6EA-4412BEF6D74C}.Release|Any CPU.Build.0 = Release|Any CPU + {02F5AE4D-9C36-4E58-B7C6-012CBBDEFDE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {02F5AE4D-9C36-4E58-B7C6-012CBBDEFDE0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {02F5AE4D-9C36-4E58-B7C6-012CBBDEFDE0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {02F5AE4D-9C36-4E58-B7C6-012CBBDEFDE0}.Release|Any CPU.Build.0 = Release|Any CPU + {9BBD3586-145C-4FA0-91C5-9ED58287D753}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9BBD3586-145C-4FA0-91C5-9ED58287D753}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9BBD3586-145C-4FA0-91C5-9ED58287D753}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9BBD3586-145C-4FA0-91C5-9ED58287D753}.Release|Any CPU.Build.0 = Release|Any CPU + {1F6E5DCF-8A2E-4E24-A25D-064362DE8D0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F6E5DCF-8A2E-4E24-A25D-064362DE8D0E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F6E5DCF-8A2E-4E24-A25D-064362DE8D0E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F6E5DCF-8A2E-4E24-A25D-064362DE8D0E}.Release|Any CPU.Build.0 = Release|Any CPU + {6045E23D-669C-4F27-AF8E-8EEE6DB3557F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6045E23D-669C-4F27-AF8E-8EEE6DB3557F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6045E23D-669C-4F27-AF8E-8EEE6DB3557F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6045E23D-669C-4F27-AF8E-8EEE6DB3557F}.Release|Any CPU.Build.0 = Release|Any CPU + {72C8E528-B4F5-45CE-8A06-CD3787364856}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {72C8E528-B4F5-45CE-8A06-CD3787364856}.Debug|Any CPU.Build.0 = Debug|Any CPU + {72C8E528-B4F5-45CE-8A06-CD3787364856}.Release|Any CPU.ActiveCfg = Release|Any CPU + {72C8E528-B4F5-45CE-8A06-CD3787364856}.Release|Any CPU.Build.0 = Release|Any CPU + {11C622AD-8C0A-4CF4-811B-3DBB76550797}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {11C622AD-8C0A-4CF4-811B-3DBB76550797}.Debug|Any CPU.Build.0 = Debug|Any CPU + {11C622AD-8C0A-4CF4-811B-3DBB76550797}.Release|Any CPU.ActiveCfg = Release|Any CPU + {11C622AD-8C0A-4CF4-811B-3DBB76550797}.Release|Any CPU.Build.0 = Release|Any CPU + {AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Release|Any CPU.Build.0 = Release|Any CPU + {A7F0CAFA-AECB-43CA-BE89-5F5B728E7C22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A7F0CAFA-AECB-43CA-BE89-5F5B728E7C22}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A7F0CAFA-AECB-43CA-BE89-5F5B728E7C22}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A7F0CAFA-AECB-43CA-BE89-5F5B728E7C22}.Release|Any CPU.Build.0 = Release|Any CPU + {F00C73F4-019D-490D-8194-CA1754D717FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F00C73F4-019D-490D-8194-CA1754D717FA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F00C73F4-019D-490D-8194-CA1754D717FA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F00C73F4-019D-490D-8194-CA1754D717FA}.Release|Any CPU.Build.0 = Release|Any CPU + {FECB0C8B-5778-4441-B10E-0C815F5106D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FECB0C8B-5778-4441-B10E-0C815F5106D5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FECB0C8B-5778-4441-B10E-0C815F5106D5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FECB0C8B-5778-4441-B10E-0C815F5106D5}.Release|Any CPU.Build.0 = Release|Any CPU + {28AD7065-8DB1-4711-83BF-9EA47D75F8F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28AD7065-8DB1-4711-83BF-9EA47D75F8F7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28AD7065-8DB1-4711-83BF-9EA47D75F8F7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28AD7065-8DB1-4711-83BF-9EA47D75F8F7}.Release|Any CPU.Build.0 = Release|Any CPU + {869EE931-7E4A-40AA-ADDD-D20DF34C3BB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {869EE931-7E4A-40AA-ADDD-D20DF34C3BB3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {869EE931-7E4A-40AA-ADDD-D20DF34C3BB3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {869EE931-7E4A-40AA-ADDD-D20DF34C3BB3}.Release|Any CPU.Build.0 = Release|Any CPU + {681B6E08-114D-4B9B-8F82-E370CA29B8EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {681B6E08-114D-4B9B-8F82-E370CA29B8EC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {681B6E08-114D-4B9B-8F82-E370CA29B8EC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {681B6E08-114D-4B9B-8F82-E370CA29B8EC}.Release|Any CPU.Build.0 = Release|Any CPU + {161DD558-993D-491B-AD20-966127D71E49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {161DD558-993D-491B-AD20-966127D71E49}.Debug|Any CPU.Build.0 = Debug|Any CPU + {161DD558-993D-491B-AD20-966127D71E49}.Release|Any CPU.ActiveCfg = Release|Any CPU + {161DD558-993D-491B-AD20-966127D71E49}.Release|Any CPU.Build.0 = Release|Any CPU + {DF9EFF21-58D3-428D-8A33-ACFA24E9B6E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DF9EFF21-58D3-428D-8A33-ACFA24E9B6E8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DF9EFF21-58D3-428D-8A33-ACFA24E9B6E8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DF9EFF21-58D3-428D-8A33-ACFA24E9B6E8}.Release|Any CPU.Build.0 = Release|Any CPU + {F25EA682-A763-431B-9D88-012A388D3618}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F25EA682-A763-431B-9D88-012A388D3618}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F25EA682-A763-431B-9D88-012A388D3618}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F25EA682-A763-431B-9D88-012A388D3618}.Release|Any CPU.Build.0 = Release|Any CPU + {DCBD0AB5-85DD-4F28-9166-0A23969E19EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DCBD0AB5-85DD-4F28-9166-0A23969E19EC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DCBD0AB5-85DD-4F28-9166-0A23969E19EC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DCBD0AB5-85DD-4F28-9166-0A23969E19EC}.Release|Any CPU.Build.0 = Release|Any CPU + {D991C694-01F0-4F04-8135-5C133DC8E029}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D991C694-01F0-4F04-8135-5C133DC8E029}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D991C694-01F0-4F04-8135-5C133DC8E029}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D991C694-01F0-4F04-8135-5C133DC8E029}.Release|Any CPU.Build.0 = Release|Any CPU + {AD09D124-7DD7-4C9E-9BCC-782B579B1786}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AD09D124-7DD7-4C9E-9BCC-782B579B1786}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AD09D124-7DD7-4C9E-9BCC-782B579B1786}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AD09D124-7DD7-4C9E-9BCC-782B579B1786}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {D6DF4206-0DBA-41D8-884D-C3E08290FDBB} = {5CFB79B7-C9DC-45A4-9A75-625D92471702} + {54E84F1A-E525-4443-96EC-039CBD50C263} = {5B401523-36DA-4491-B73A-7590A26E420B} + {F8C224FE-36BE-45F5-9B0E-666D8F4A9B52} = {5B401523-36DA-4491-B73A-7590A26E420B} + {02BBF4C5-517E-4157-8D21-4B8B9E118B7A} = {5B401523-36DA-4491-B73A-7590A26E420B} + {106B49E6-95F6-4A7B-B81C-96BFA74AF035} = {5B401523-36DA-4491-B73A-7590A26E420B} + {D4575572-99CA-4530-8737-C296EDA326F8} = {5B401523-36DA-4491-B73A-7590A26E420B} + {F69CEF43-27D2-4940-A47A-FCA879E371BC} = {5CFB79B7-C9DC-45A4-9A75-625D92471702} + {EB9F438F-062E-499F-B6EA-4412BEF6D74C} = {5CFB79B7-C9DC-45A4-9A75-625D92471702} + {02F5AE4D-9C36-4E58-B7C6-012CBBDEFDE0} = {5CFB79B7-C9DC-45A4-9A75-625D92471702} + {9BBD3586-145C-4FA0-91C5-9ED58287D753} = {5CFB79B7-C9DC-45A4-9A75-625D92471702} + {1F6E5DCF-8A2E-4E24-A25D-064362DE8D0E} = {5CFB79B7-C9DC-45A4-9A75-625D92471702} + {6045E23D-669C-4F27-AF8E-8EEE6DB3557F} = {5CFB79B7-C9DC-45A4-9A75-625D92471702} + {72C8E528-B4F5-45CE-8A06-CD3787364856} = {5CFB79B7-C9DC-45A4-9A75-625D92471702} + {11C622AD-8C0A-4CF4-811B-3DBB76550797} = {5CFB79B7-C9DC-45A4-9A75-625D92471702} + {AE6BCCBD-0687-4C58-B30F-4ABBC6422087} = {5B401523-36DA-4491-B73A-7590A26E420B} + {A7F0CAFA-AECB-43CA-BE89-5F5B728E7C22} = {8FA0CBA0-0338-48EB-B37F-83CA5022237C} + {F00C73F4-019D-490D-8194-CA1754D717FA} = {8FA0CBA0-0338-48EB-B37F-83CA5022237C} + {FECB0C8B-5778-4441-B10E-0C815F5106D5} = {8FA0CBA0-0338-48EB-B37F-83CA5022237C} + {28AD7065-8DB1-4711-83BF-9EA47D75F8F7} = {8FA0CBA0-0338-48EB-B37F-83CA5022237C} + {869EE931-7E4A-40AA-ADDD-D20DF34C3BB3} = {8FA0CBA0-0338-48EB-B37F-83CA5022237C} + {681B6E08-114D-4B9B-8F82-E370CA29B8EC} = {8FA0CBA0-0338-48EB-B37F-83CA5022237C} + {161DD558-993D-491B-AD20-966127D71E49} = {8FA0CBA0-0338-48EB-B37F-83CA5022237C} + {DF9EFF21-58D3-428D-8A33-ACFA24E9B6E8} = {8FA0CBA0-0338-48EB-B37F-83CA5022237C} + {F25EA682-A763-431B-9D88-012A388D3618} = {8FA0CBA0-0338-48EB-B37F-83CA5022237C} + {DCBD0AB5-85DD-4F28-9166-0A23969E19EC} = {8FA0CBA0-0338-48EB-B37F-83CA5022237C} + {D991C694-01F0-4F04-8135-5C133DC8E029} = {8FA0CBA0-0338-48EB-B37F-83CA5022237C} + {AD09D124-7DD7-4C9E-9BCC-782B579B1786} = {8FA0CBA0-0338-48EB-B37F-83CA5022237C} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {21476EFF-778A-4F97-8A56-D1AF1CEC0C48} + EndGlobalSection +EndGlobal diff --git a/Ocelot.sln b/Ocelot.sln index e40f83cfb..f09456c44 100644 --- a/Ocelot.sln +++ b/Ocelot.sln @@ -1,7 +1,6 @@ - Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 -VisualStudioVersion = 17.8.34309.116 +VisualStudioVersion = 17.9.34728.123 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5CFB79B7-C9DC-45A4-9A75-625D92471702}" EndProject @@ -23,8 +22,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{5B401523-36DA-4491-B73A-7590A26E420B}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot", "src\Ocelot\Ocelot.csproj", "{D6DF4206-0DBA-41D8-884D-C3E08290FDBB}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.UnitTests", "test\Ocelot.UnitTests\Ocelot.UnitTests.csproj", "{54E84F1A-E525-4443-96EC-039CBD50C263}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.AcceptanceTests", "test\Ocelot.AcceptanceTests\Ocelot.AcceptanceTests.csproj", "{F8C224FE-36BE-45F5-9B0E-666D8F4A9B52}" @@ -35,6 +32,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Benchmarks", "test\O EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.IntegrationTests", "test\Ocelot.IntegrationTests\Ocelot.IntegrationTests.csproj", "{D4575572-99CA-4530-8737-C296EDA326F8}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Testing", "test\Ocelot.Testing\Ocelot.Testing.csproj", "{AE6BCCBD-0687-4C58-B30F-4ABBC6422087}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot", "src\Ocelot\Ocelot.csproj", "{D6DF4206-0DBA-41D8-884D-C3E08290FDBB}" +EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Administration", "src\Ocelot.Administration\Ocelot.Administration.csproj", "{F69CEF43-27D2-4940-A47A-FCA879E371BC}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Cache.CacheManager", "src\Ocelot.Cache.CacheManager\Ocelot.Cache.CacheManager.csproj", "{EB9F438F-062E-499F-B6EA-4412BEF6D74C}" @@ -43,68 +44,20 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Provider.Consul", "s EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Provider.Eureka", "src\Ocelot.Provider.Eureka\Ocelot.Provider.Eureka.csproj", "{9BBD3586-145C-4FA0-91C5-9ED58287D753}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Provider.Polly", "src\Ocelot.Provider.Polly\Ocelot.Provider.Polly.csproj", "{1F6E5DCF-8A2E-4E24-A25D-064362DE8D0E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Tracing.Butterfly", "src\Ocelot.Tracing.Butterfly\Ocelot.Tracing.Butterfly.csproj", "{6045E23D-669C-4F27-AF8E-8EEE6DB3557F}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Provider.Kubernetes", "src\Ocelot.Provider.Kubernetes\Ocelot.Provider.Kubernetes.csproj", "{72C8E528-B4F5-45CE-8A06-CD3787364856}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{8FA0CBA0-0338-48EB-B37F-83CA5022237C}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.OcelotBasic.ApiGateway", "samples\OcelotBasic\Ocelot.Samples.OcelotBasic.ApiGateway.csproj", "{ED0B3A09-112B-4BA4-82D6-11569BC7A99B}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AdministrationApi", "samples\AdministrationApi\AdministrationApi.csproj", "{B180F8AE-2F8F-44F9-9E5D-FE65B84B742E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OcelotGraphQL", "samples\OcelotGraphQL\OcelotGraphQL.csproj", "{F43429C3-EC49-464F-9423-9118A36E8FE3}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "eureka", "eureka", "{F1CF6F06-5A34-4A6A-8C19-003A78AB0DCF}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApiGateway", "samples\OcelotEureka\ApiGateway\ApiGateway.csproj", "{48B3DD3C-7F4D-40C1-A104-3BF9EF4ACE29}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DownstreamService", "samples\OcelotEureka\DownstreamService\DownstreamService.csproj", "{32ADF9B3-CBFA-4607-8A8E-1532D90A7197}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "k8s", "k8s", "{4B706988-4817-43A8-ABE1-32A67998C2C8}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.OcelotKube.ApiGateway", "samples\OcelotKube\ApiGateway\Ocelot.Samples.OcelotKube.ApiGateway.csproj", "{8500055B-2C51-4CF1-A6EE-F05BB3E9BF16}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.OcelotKube.DownstreamService", "samples\OcelotKube\DownstreamService\Ocelot.Samples.OcelotKube.DownstreamService.csproj", "{7B319B8C-8155-4779-BD93-5ABD05CA2AB6}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "service-fabric", "service-fabric", "{B412628F-C325-47E1-A8D9-873DE04C8AF5}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OcelotApplicationApiGateway", "samples\OcelotServiceFabric\src\OcelotApplicationApiGateway\OcelotApplicationApiGateway.csproj", "{8E6DAE6E-E9B1-433A-80C3-1E2640FBA590}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OcelotApplicationService", "samples\OcelotServiceFabric\src\OcelotApplicationService\OcelotApplicationService.csproj", "{33BE6D88-F188-4E60-83AC-3C4B94D24675}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "administration", "administration", "{1F1F324D-6EA4-4E63-A6A7-C6053F412F1A}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "basic", "basic", "{ED066001-BAF7-4117-9884-DF591A56347D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Provider.Polly", "src\Ocelot.Provider.Polly\Ocelot.Provider.Polly.csproj", "{1F6E5DCF-8A2E-4E24-A25D-064362DE8D0E}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "graphql", "graphql", "{C15CD120-5F8D-41DE-9B21-00E3EA77D6C1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Tracing.Butterfly", "src\Ocelot.Tracing.Butterfly\Ocelot.Tracing.Butterfly.csproj", "{6045E23D-669C-4F27-AF8E-8EEE6DB3557F}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Tracing.OpenTracing", "src\Ocelot.Tracing.OpenTracing\Ocelot.Tracing.OpenTracing.csproj", "{11C622AD-8C0A-4CF4-811B-3DBB76550797}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "open-tracing", "open-tracing", "{731C6A8A-69ED-445C-A132-C638AA93F9C7}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OcelotOpenTracing", "samples\OcelotOpenTracing\OcelotOpenTracing.csproj", "{C9427E78-4281-4F59-A66E-17C0B66550E5}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "service-discovery", "service-discovery", "{25C30AAA-12DD-4BA5-A53F-9271E54EBAB7}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.ServiceDiscovery.ApiGateway", "samples\OcelotServiceDiscovery\ApiGateway\Ocelot.Samples.ServiceDiscovery.ApiGateway.csproj", "{D37209EA-C13E-42AE-B851-A8604F1FCD0E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.ServiceDiscovery.DownstreamService", "samples\OcelotServiceDiscovery\DownstreamService\Ocelot.Samples.ServiceDiscovery.DownstreamService.csproj", "{E2AC741A-4120-4D59-B5E4-16382ED45E8D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ocelot.Testing", "test\Ocelot.Testing\Ocelot.Testing.csproj", "{AE6BCCBD-0687-4C58-B30F-4ABBC6422087}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Release|Any CPU.Build.0 = Release|Any CPU {54E84F1A-E525-4443-96EC-039CBD50C263}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {54E84F1A-E525-4443-96EC-039CBD50C263}.Debug|Any CPU.Build.0 = Debug|Any CPU {54E84F1A-E525-4443-96EC-039CBD50C263}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -125,6 +78,14 @@ Global {D4575572-99CA-4530-8737-C296EDA326F8}.Debug|Any CPU.Build.0 = Debug|Any CPU {D4575572-99CA-4530-8737-C296EDA326F8}.Release|Any CPU.ActiveCfg = Release|Any CPU {D4575572-99CA-4530-8737-C296EDA326F8}.Release|Any CPU.Build.0 = Release|Any CPU + {AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Release|Any CPU.Build.0 = Release|Any CPU + {D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D6DF4206-0DBA-41D8-884D-C3E08290FDBB}.Release|Any CPU.Build.0 = Release|Any CPU {F69CEF43-27D2-4940-A47A-FCA879E371BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F69CEF43-27D2-4940-A47A-FCA879E371BC}.Debug|Any CPU.Build.0 = Debug|Any CPU {F69CEF43-27D2-4940-A47A-FCA879E371BC}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -141,6 +102,10 @@ Global {9BBD3586-145C-4FA0-91C5-9ED58287D753}.Debug|Any CPU.Build.0 = Debug|Any CPU {9BBD3586-145C-4FA0-91C5-9ED58287D753}.Release|Any CPU.ActiveCfg = Release|Any CPU {9BBD3586-145C-4FA0-91C5-9ED58287D753}.Release|Any CPU.Build.0 = Release|Any CPU + {72C8E528-B4F5-45CE-8A06-CD3787364856}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {72C8E528-B4F5-45CE-8A06-CD3787364856}.Debug|Any CPU.Build.0 = Debug|Any CPU + {72C8E528-B4F5-45CE-8A06-CD3787364856}.Release|Any CPU.ActiveCfg = Release|Any CPU + {72C8E528-B4F5-45CE-8A06-CD3787364856}.Release|Any CPU.Build.0 = Release|Any CPU {1F6E5DCF-8A2E-4E24-A25D-064362DE8D0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1F6E5DCF-8A2E-4E24-A25D-064362DE8D0E}.Debug|Any CPU.Build.0 = Debug|Any CPU {1F6E5DCF-8A2E-4E24-A25D-064362DE8D0E}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -149,106 +114,30 @@ Global {6045E23D-669C-4F27-AF8E-8EEE6DB3557F}.Debug|Any CPU.Build.0 = Debug|Any CPU {6045E23D-669C-4F27-AF8E-8EEE6DB3557F}.Release|Any CPU.ActiveCfg = Release|Any CPU {6045E23D-669C-4F27-AF8E-8EEE6DB3557F}.Release|Any CPU.Build.0 = Release|Any CPU - {72C8E528-B4F5-45CE-8A06-CD3787364856}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {72C8E528-B4F5-45CE-8A06-CD3787364856}.Debug|Any CPU.Build.0 = Debug|Any CPU - {72C8E528-B4F5-45CE-8A06-CD3787364856}.Release|Any CPU.ActiveCfg = Release|Any CPU - {72C8E528-B4F5-45CE-8A06-CD3787364856}.Release|Any CPU.Build.0 = Release|Any CPU - {ED0B3A09-112B-4BA4-82D6-11569BC7A99B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {ED0B3A09-112B-4BA4-82D6-11569BC7A99B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {ED0B3A09-112B-4BA4-82D6-11569BC7A99B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {ED0B3A09-112B-4BA4-82D6-11569BC7A99B}.Release|Any CPU.Build.0 = Release|Any CPU - {B180F8AE-2F8F-44F9-9E5D-FE65B84B742E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B180F8AE-2F8F-44F9-9E5D-FE65B84B742E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B180F8AE-2F8F-44F9-9E5D-FE65B84B742E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B180F8AE-2F8F-44F9-9E5D-FE65B84B742E}.Release|Any CPU.Build.0 = Release|Any CPU - {F43429C3-EC49-464F-9423-9118A36E8FE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F43429C3-EC49-464F-9423-9118A36E8FE3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F43429C3-EC49-464F-9423-9118A36E8FE3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F43429C3-EC49-464F-9423-9118A36E8FE3}.Release|Any CPU.Build.0 = Release|Any CPU - {48B3DD3C-7F4D-40C1-A104-3BF9EF4ACE29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {48B3DD3C-7F4D-40C1-A104-3BF9EF4ACE29}.Debug|Any CPU.Build.0 = Debug|Any CPU - {48B3DD3C-7F4D-40C1-A104-3BF9EF4ACE29}.Release|Any CPU.ActiveCfg = Release|Any CPU - {48B3DD3C-7F4D-40C1-A104-3BF9EF4ACE29}.Release|Any CPU.Build.0 = Release|Any CPU - {32ADF9B3-CBFA-4607-8A8E-1532D90A7197}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {32ADF9B3-CBFA-4607-8A8E-1532D90A7197}.Debug|Any CPU.Build.0 = Debug|Any CPU - {32ADF9B3-CBFA-4607-8A8E-1532D90A7197}.Release|Any CPU.ActiveCfg = Release|Any CPU - {32ADF9B3-CBFA-4607-8A8E-1532D90A7197}.Release|Any CPU.Build.0 = Release|Any CPU - {8500055B-2C51-4CF1-A6EE-F05BB3E9BF16}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8500055B-2C51-4CF1-A6EE-F05BB3E9BF16}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8500055B-2C51-4CF1-A6EE-F05BB3E9BF16}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8500055B-2C51-4CF1-A6EE-F05BB3E9BF16}.Release|Any CPU.Build.0 = Release|Any CPU - {7B319B8C-8155-4779-BD93-5ABD05CA2AB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7B319B8C-8155-4779-BD93-5ABD05CA2AB6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7B319B8C-8155-4779-BD93-5ABD05CA2AB6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7B319B8C-8155-4779-BD93-5ABD05CA2AB6}.Release|Any CPU.Build.0 = Release|Any CPU - {8E6DAE6E-E9B1-433A-80C3-1E2640FBA590}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8E6DAE6E-E9B1-433A-80C3-1E2640FBA590}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8E6DAE6E-E9B1-433A-80C3-1E2640FBA590}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8E6DAE6E-E9B1-433A-80C3-1E2640FBA590}.Release|Any CPU.Build.0 = Release|Any CPU - {33BE6D88-F188-4E60-83AC-3C4B94D24675}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {33BE6D88-F188-4E60-83AC-3C4B94D24675}.Debug|Any CPU.Build.0 = Debug|Any CPU - {33BE6D88-F188-4E60-83AC-3C4B94D24675}.Release|Any CPU.ActiveCfg = Release|Any CPU - {33BE6D88-F188-4E60-83AC-3C4B94D24675}.Release|Any CPU.Build.0 = Release|Any CPU {11C622AD-8C0A-4CF4-811B-3DBB76550797}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {11C622AD-8C0A-4CF4-811B-3DBB76550797}.Debug|Any CPU.Build.0 = Debug|Any CPU {11C622AD-8C0A-4CF4-811B-3DBB76550797}.Release|Any CPU.ActiveCfg = Release|Any CPU {11C622AD-8C0A-4CF4-811B-3DBB76550797}.Release|Any CPU.Build.0 = Release|Any CPU - {C9427E78-4281-4F59-A66E-17C0B66550E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C9427E78-4281-4F59-A66E-17C0B66550E5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C9427E78-4281-4F59-A66E-17C0B66550E5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C9427E78-4281-4F59-A66E-17C0B66550E5}.Release|Any CPU.Build.0 = Release|Any CPU - {D37209EA-C13E-42AE-B851-A8604F1FCD0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D37209EA-C13E-42AE-B851-A8604F1FCD0E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D37209EA-C13E-42AE-B851-A8604F1FCD0E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D37209EA-C13E-42AE-B851-A8604F1FCD0E}.Release|Any CPU.Build.0 = Release|Any CPU - {E2AC741A-4120-4D59-B5E4-16382ED45E8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E2AC741A-4120-4D59-B5E4-16382ED45E8D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E2AC741A-4120-4D59-B5E4-16382ED45E8D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E2AC741A-4120-4D59-B5E4-16382ED45E8D}.Release|Any CPU.Build.0 = Release|Any CPU - {AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AE6BCCBD-0687-4C58-B30F-4ABBC6422087}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {D6DF4206-0DBA-41D8-884D-C3E08290FDBB} = {5CFB79B7-C9DC-45A4-9A75-625D92471702} {54E84F1A-E525-4443-96EC-039CBD50C263} = {5B401523-36DA-4491-B73A-7590A26E420B} {F8C224FE-36BE-45F5-9B0E-666D8F4A9B52} = {5B401523-36DA-4491-B73A-7590A26E420B} {02BBF4C5-517E-4157-8D21-4B8B9E118B7A} = {5B401523-36DA-4491-B73A-7590A26E420B} {106B49E6-95F6-4A7B-B81C-96BFA74AF035} = {5B401523-36DA-4491-B73A-7590A26E420B} {D4575572-99CA-4530-8737-C296EDA326F8} = {5B401523-36DA-4491-B73A-7590A26E420B} + {AE6BCCBD-0687-4C58-B30F-4ABBC6422087} = {5B401523-36DA-4491-B73A-7590A26E420B} + {D6DF4206-0DBA-41D8-884D-C3E08290FDBB} = {5CFB79B7-C9DC-45A4-9A75-625D92471702} {F69CEF43-27D2-4940-A47A-FCA879E371BC} = {5CFB79B7-C9DC-45A4-9A75-625D92471702} {EB9F438F-062E-499F-B6EA-4412BEF6D74C} = {5CFB79B7-C9DC-45A4-9A75-625D92471702} {02F5AE4D-9C36-4E58-B7C6-012CBBDEFDE0} = {5CFB79B7-C9DC-45A4-9A75-625D92471702} {9BBD3586-145C-4FA0-91C5-9ED58287D753} = {5CFB79B7-C9DC-45A4-9A75-625D92471702} + {72C8E528-B4F5-45CE-8A06-CD3787364856} = {5CFB79B7-C9DC-45A4-9A75-625D92471702} {1F6E5DCF-8A2E-4E24-A25D-064362DE8D0E} = {5CFB79B7-C9DC-45A4-9A75-625D92471702} {6045E23D-669C-4F27-AF8E-8EEE6DB3557F} = {5CFB79B7-C9DC-45A4-9A75-625D92471702} - {72C8E528-B4F5-45CE-8A06-CD3787364856} = {5CFB79B7-C9DC-45A4-9A75-625D92471702} - {ED0B3A09-112B-4BA4-82D6-11569BC7A99B} = {ED066001-BAF7-4117-9884-DF591A56347D} - {B180F8AE-2F8F-44F9-9E5D-FE65B84B742E} = {1F1F324D-6EA4-4E63-A6A7-C6053F412F1A} - {F43429C3-EC49-464F-9423-9118A36E8FE3} = {C15CD120-5F8D-41DE-9B21-00E3EA77D6C1} - {F1CF6F06-5A34-4A6A-8C19-003A78AB0DCF} = {8FA0CBA0-0338-48EB-B37F-83CA5022237C} - {48B3DD3C-7F4D-40C1-A104-3BF9EF4ACE29} = {F1CF6F06-5A34-4A6A-8C19-003A78AB0DCF} - {32ADF9B3-CBFA-4607-8A8E-1532D90A7197} = {F1CF6F06-5A34-4A6A-8C19-003A78AB0DCF} - {4B706988-4817-43A8-ABE1-32A67998C2C8} = {8FA0CBA0-0338-48EB-B37F-83CA5022237C} - {8500055B-2C51-4CF1-A6EE-F05BB3E9BF16} = {4B706988-4817-43A8-ABE1-32A67998C2C8} - {7B319B8C-8155-4779-BD93-5ABD05CA2AB6} = {4B706988-4817-43A8-ABE1-32A67998C2C8} - {B412628F-C325-47E1-A8D9-873DE04C8AF5} = {8FA0CBA0-0338-48EB-B37F-83CA5022237C} - {8E6DAE6E-E9B1-433A-80C3-1E2640FBA590} = {B412628F-C325-47E1-A8D9-873DE04C8AF5} - {33BE6D88-F188-4E60-83AC-3C4B94D24675} = {B412628F-C325-47E1-A8D9-873DE04C8AF5} - {1F1F324D-6EA4-4E63-A6A7-C6053F412F1A} = {8FA0CBA0-0338-48EB-B37F-83CA5022237C} - {ED066001-BAF7-4117-9884-DF591A56347D} = {8FA0CBA0-0338-48EB-B37F-83CA5022237C} - {C15CD120-5F8D-41DE-9B21-00E3EA77D6C1} = {8FA0CBA0-0338-48EB-B37F-83CA5022237C} {11C622AD-8C0A-4CF4-811B-3DBB76550797} = {5CFB79B7-C9DC-45A4-9A75-625D92471702} - {731C6A8A-69ED-445C-A132-C638AA93F9C7} = {8FA0CBA0-0338-48EB-B37F-83CA5022237C} - {C9427E78-4281-4F59-A66E-17C0B66550E5} = {731C6A8A-69ED-445C-A132-C638AA93F9C7} - {25C30AAA-12DD-4BA5-A53F-9271E54EBAB7} = {8FA0CBA0-0338-48EB-B37F-83CA5022237C} - {D37209EA-C13E-42AE-B851-A8604F1FCD0E} = {25C30AAA-12DD-4BA5-A53F-9271E54EBAB7} - {E2AC741A-4120-4D59-B5E4-16382ED45E8D} = {25C30AAA-12DD-4BA5-A53F-9271E54EBAB7} - {AE6BCCBD-0687-4C58-B30F-4ABBC6422087} = {5B401523-36DA-4491-B73A-7590A26E420B} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {21476EFF-778A-4F97-8A56-D1AF1CEC0C48} diff --git a/build.cake b/build.cake index f7896932f..a8f7cc362 100644 --- a/build.cake +++ b/build.cake @@ -1,9 +1,9 @@ -#tool "dotnet:?package=GitVersion.Tool&version=5.8.1" -#tool "dotnet:?package=coveralls.net&version=4.0.1" -#addin nuget:?package=Newtonsoft.Json -#addin nuget:?package=System.Text.Encodings.Web&version=4.7.1 -#tool "nuget:?package=ReportGenerator&version=5.2.0" -#addin Cake.Coveralls&version=1.1.0 +#tool dotnet:?package=GitVersion.Tool&version=5.12.0 // 6.0.0-beta.7 supports .NET 8, 7, 6 +#tool dotnet:?package=coveralls.net&version=4.0.1 +#tool nuget:?package=ReportGenerator&version=5.2.4 +#addin nuget:?package=Newtonsoft.Json&version=13.0.3 +#addin nuget:?package=System.Text.Encodings.Web&version=8.0.0 +#addin nuget:?package=Cake.Coveralls&version=1.1.0 #r "Spectre.Console" using Spectre.Console @@ -13,10 +13,8 @@ using System.IO; using System.Linq; using System.Text.RegularExpressions; -// compile -var compileConfig = Argument("configuration", "Release"); - -var slnFile = "./Ocelot.sln"; +const string Release = "Release"; // task name, target, and Release config name +var compileConfig = Argument("configuration", Release); // compile // build artifacts var artifactsDir = Directory("artifacts"); @@ -61,9 +59,10 @@ string gitHubUsername = "TomPallister"; string gitHubPassword = Environment.GetEnvironmentVariable("OCELOT_GITHUB_API_KEY"); var target = Argument("target", "Default"); - -Information("target is " + target); -Information("Build configuration is " + compileConfig); +var slnFile = (target == Release) ? $"./Ocelot.{Release}.sln" : "./Ocelot.sln"; +Information("\nTarget: " + target); +Information("Build: " + compileConfig); +Information("Solution: " + slnFile); TaskTeardown(context => { AnsiConsole.Markup($"[green]DONE[/] {context.Task.Name}\n"); @@ -83,7 +82,7 @@ Task("RunTests") .IsDependentOn("RunAcceptanceTests") .IsDependentOn("RunIntegrationTests"); -Task("Release") +Task(Release) .IsDependentOn("Build") .IsDependentOn("CreateReleaseNotes") .IsDependentOn("CreateArtifacts") @@ -95,11 +94,18 @@ Task("Compile") .IsDependentOn("Version") .Does(() => { + Information("Build: " + compileConfig); + Information("Solution: " + slnFile); var settings = new DotNetBuildSettings { Configuration = compileConfig, }; - + if (target != Release) + { + settings.Framework = "net8.0"; // build using .NET 8 SDK only + } + Information($"Settings {nameof(DotNetBuildSettings.Framework)}: {settings.Framework}"); + Information($"Settings {nameof(DotNetBuildSettings.Configuration)}: {settings.Configuration}"); DotNetBuild(slnFile, settings); }); @@ -344,15 +350,23 @@ Task("RunUnitTests") { Configuration = compileConfig, ResultsDirectory = artifactsForUnitTestsDir, - ArgumentCustomization = args => args - // this create the code coverage report - .Append("--collect:\"XPlat Code Coverage\"") + ArgumentCustomization = args => args + .Append("--no-restore") + .Append("--no-build") + .Append("--collect:\"XPlat Code Coverage\"") // this create the code coverage report + .Append("--verbosity:detailed") + .Append("--consoleLoggerParameters:ErrorsOnly") }; - + if (target != Release) + { + testSettings.Framework = "net8.0"; // .NET 8 SDK only + } EnsureDirectoryExists(artifactsForUnitTestsDir); DotNetTest(unitTestAssemblies, testSettings); - var coverageSummaryFile = GetSubDirectories(artifactsForUnitTestsDir).First().CombineWithFilePath(File("coverage.cobertura.xml")); + var coverageSummaryFile = GetSubDirectories(artifactsForUnitTestsDir) + .First() + .CombineWithFilePath(File("coverage.cobertura.xml")); Information(coverageSummaryFile); Information(artifactsForUnitTestsDir); @@ -396,11 +410,15 @@ Task("RunAcceptanceTests") var settings = new DotNetTestSettings { Configuration = compileConfig, + Framework = "net8.0", // .NET 8 SDK only ArgumentCustomization = args => args .Append("--no-restore") .Append("--no-build") }; - + if (target != Release) + { + settings.Framework = "net8.0"; // .NET 8 SDK only + } EnsureDirectoryExists(artifactsForAcceptanceTestsDir); DotNetTest(acceptanceTestAssemblies, settings); }); @@ -412,11 +430,15 @@ Task("RunIntegrationTests") var settings = new DotNetTestSettings { Configuration = compileConfig, + Framework = "net8.0", // .NET 8 SDK only ArgumentCustomization = args => args .Append("--no-restore") .Append("--no-build") }; - + if (target != Release) + { + settings.Framework = "net8.0"; // .NET 8 SDK only + } EnsureDirectoryExists(artifactsForIntegrationTestsDir); DotNetTest(integrationTestAssemblies, settings); }); diff --git a/samples/AdministrationApi/Issue645.postman_collection.json b/samples/Administration/Issue645.postman_collection.json similarity index 97% rename from samples/AdministrationApi/Issue645.postman_collection.json rename to samples/Administration/Issue645.postman_collection.json index c9bac89f5..6fedd16b9 100644 --- a/samples/AdministrationApi/Issue645.postman_collection.json +++ b/samples/Administration/Issue645.postman_collection.json @@ -1,150 +1,150 @@ -{ - "info": { - "_postman_id": "6234b40a-e363-4c73-8577-1c9074abb951", - "name": "Issue645", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" - }, - "item": [ - { - "name": "1. GET http://localhost: 55580/administration/.well-known/openid-configuration", - "request": { - "method": "GET", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{AccessToken}}" - } - ], - "body": {}, - "url": { - "raw": "http://localhost:5000/administration/.well-known/openid-configuration", - "protocol": "http", - "host": [ - "localhost" - ], - "port": "5000", - "path": [ - "administration", - ".well-known", - "openid-configuration" - ] - } - }, - "response": [] - }, - { - "name": "3. GET http://localhost: 55580/administration/configuration", - "request": { - "method": "POST", - "header": [ - { - "key": "Authorization", - "value": "Bearer {{AccessToken}}" - }, - { - "key": "Content-Type", - "value": "application/json" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"routes\": [\r\n {\r\n \"downstreamPathTemplate\": \"/{everything}\",\r\n \"upstreamPathTemplate\": \"/templates/{everything}\",\r\n \"upstreamHttpMethod\": [\r\n \"GET\"\r\n ],\r\n \"addHeadersToRequest\": {},\r\n \"upstreamHeaderTransform\": {},\r\n \"downstreamHeaderTransform\": {},\r\n \"addClaimsToRequest\": {},\r\n \"routeClaimsRequirement\": {},\r\n \"addQueriesToRequest\": {},\r\n \"requestIdKey\": null,\r\n \"fileCacheOptions\": {\r\n \"ttlSeconds\": 0,\r\n \"region\": null\r\n },\r\n \"routeIsCaseSensitive\": false,\r\n \"downstreamScheme\": \"http\",\r\n \"qoSOptions\": {\r\n \"exceptionsAllowedBeforeBreaking\": 0,\r\n \"durationOfBreak\": 0,\r\n \"timeoutValue\": 0\r\n },\r\n \"loadBalancerOptions\": {\r\n \"type\": null,\r\n \"key\": null,\r\n \"expiry\": 0\r\n },\r\n \"rateLimitOptions\": {\r\n \"clientWhitelist\": [],\r\n \"enableRateLimiting\": false,\r\n \"period\": null,\r\n \"periodTimespan\": 0,\r\n \"limit\": 0\r\n },\r\n \"authenticationOptions\": {\r\n \"authenticationProviderKey\": null,\r\n \"allowedScopes\": []\r\n },\r\n \"httpHandlerOptions\": {\r\n \"allowAutoRedirect\": false,\r\n \"useCookieContainer\": false,\r\n \"useTracing\": false,\r\n \"useProxy\": true\r\n },\r\n \"downstreamHostAndPorts\": [\r\n {\r\n \"host\": \"localhost\",\r\n \"port\": 50689\r\n }\r\n ],\r\n \"upstreamHost\": null,\r\n \"key\": null,\r\n \"delegatingHandlers\": [],\r\n \"priority\": 1,\r\n \"timeout\": 0,\r\n \"dangerousAcceptAnyServerCertificateValidator\": false\r\n }\r\n ],\r\n \"aggregates\": [],\r\n \"globalConfiguration\": {\r\n \"requestIdKey\": \"Request-Id\",\r\n \"rateLimitOptions\": {\r\n \"clientIdHeader\": \"ClientId\",\r\n \"quotaExceededMessage\": null,\r\n \"rateLimitCounterPrefix\": \"ocelot\",\r\n \"disableRateLimitHeaders\": false,\r\n \"httpStatusCode\": 429\r\n },\r\n \"qoSOptions\": {\r\n \"exceptionsAllowedBeforeBreaking\": 0,\r\n \"durationOfBreak\": 0,\r\n \"timeoutValue\": 0\r\n },\r\n \"baseUrl\": \"http://localhost:55580\",\r\n \"loadBalancerOptions\": {\r\n \"type\": null,\r\n \"key\": null,\r\n \"expiry\": 0\r\n },\r\n \"downstreamScheme\": null,\r\n \"httpHandlerOptions\": {\r\n \"allowAutoRedirect\": false,\r\n \"useCookieContainer\": false,\r\n \"useTracing\": false,\r\n \"useProxy\": true\r\n }\r\n }\r\n}" - }, - "url": { - "raw": "http://localhost:5000/administration/configuration", - "protocol": "http", - "host": [ - "localhost" - ], - "port": "5000", - "path": [ - "administration", - "configuration" - ] - } - }, - "response": [] - }, - { - "name": "2. POST http://localhost: 55580/administration/connect/token", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var jsonData = JSON.parse(responseBody);", - "postman.setGlobalVariable(\"AccessToken\", jsonData.access_token);", - "postman.setGlobalVariable(\"RefreshToken\", jsonData.refresh_token);" - ] - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "formdata", - "formdata": [ - { - "key": "client_id", - "value": "admin", - "type": "text" - }, - { - "key": "client_secret", - "value": "secret", - "type": "text" - }, - { - "key": "scope", - "value": "admin", - "type": "text" - }, - { - "key": "grant_type", - "value": "client_credentials", - "type": "text" - } - ] - }, - "url": { - "raw": "http://localhost:5000/administration/connect/token", - "protocol": "http", - "host": [ - "localhost" - ], - "port": "5000", - "path": [ - "administration", - "connect", - "token" - ] - } - }, - "response": [] - } - ], - "event": [ - { - "listen": "prerequest", - "script": { - "id": "0f60e7b3-e4f1-4458-bbc4-fc4809e86b2d", - "type": "text/javascript", - "exec": [ - string.Empty - ] - } - }, - { - "listen": "test", - "script": { - "id": "1279a2cf-b771-4a86-9dfa-302b240fac62", - "type": "text/javascript", - "exec": [ - string.Empty - ] - } - } - ] +{ + "info": { + "_postman_id": "6234b40a-e363-4c73-8577-1c9074abb951", + "name": "Issue645", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "1. GET http://localhost: 55580/administration/.well-known/openid-configuration", + "request": { + "method": "GET", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{AccessToken}}" + } + ], + "body": {}, + "url": { + "raw": "http://localhost:5000/administration/.well-known/openid-configuration", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "5000", + "path": [ + "administration", + ".well-known", + "openid-configuration" + ] + } + }, + "response": [] + }, + { + "name": "3. GET http://localhost: 55580/administration/configuration", + "request": { + "method": "POST", + "header": [ + { + "key": "Authorization", + "value": "Bearer {{AccessToken}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"routes\": [\r\n {\r\n \"downstreamPathTemplate\": \"/{everything}\",\r\n \"upstreamPathTemplate\": \"/templates/{everything}\",\r\n \"upstreamHttpMethod\": [\r\n \"GET\"\r\n ],\r\n \"addHeadersToRequest\": {},\r\n \"upstreamHeaderTransform\": {},\r\n \"downstreamHeaderTransform\": {},\r\n \"addClaimsToRequest\": {},\r\n \"routeClaimsRequirement\": {},\r\n \"addQueriesToRequest\": {},\r\n \"requestIdKey\": null,\r\n \"fileCacheOptions\": {\r\n \"ttlSeconds\": 0,\r\n \"region\": null\r\n },\r\n \"routeIsCaseSensitive\": false,\r\n \"downstreamScheme\": \"http\",\r\n \"qoSOptions\": {\r\n \"exceptionsAllowedBeforeBreaking\": 0,\r\n \"durationOfBreak\": 0,\r\n \"timeoutValue\": 0\r\n },\r\n \"loadBalancerOptions\": {\r\n \"type\": null,\r\n \"key\": null,\r\n \"expiry\": 0\r\n },\r\n \"rateLimitOptions\": {\r\n \"clientWhitelist\": [],\r\n \"enableRateLimiting\": false,\r\n \"period\": null,\r\n \"periodTimespan\": 0,\r\n \"limit\": 0\r\n },\r\n \"authenticationOptions\": {\r\n \"authenticationProviderKey\": null,\r\n \"allowedScopes\": []\r\n },\r\n \"httpHandlerOptions\": {\r\n \"allowAutoRedirect\": false,\r\n \"useCookieContainer\": false,\r\n \"useTracing\": false,\r\n \"useProxy\": true\r\n },\r\n \"downstreamHostAndPorts\": [\r\n {\r\n \"host\": \"localhost\",\r\n \"port\": 50689\r\n }\r\n ],\r\n \"upstreamHost\": null,\r\n \"key\": null,\r\n \"delegatingHandlers\": [],\r\n \"priority\": 1,\r\n \"timeout\": 0,\r\n \"dangerousAcceptAnyServerCertificateValidator\": false\r\n }\r\n ],\r\n \"aggregates\": [],\r\n \"globalConfiguration\": {\r\n \"requestIdKey\": \"Request-Id\",\r\n \"rateLimitOptions\": {\r\n \"clientIdHeader\": \"ClientId\",\r\n \"quotaExceededMessage\": null,\r\n \"rateLimitCounterPrefix\": \"ocelot\",\r\n \"disableRateLimitHeaders\": false,\r\n \"httpStatusCode\": 429\r\n },\r\n \"qoSOptions\": {\r\n \"exceptionsAllowedBeforeBreaking\": 0,\r\n \"durationOfBreak\": 0,\r\n \"timeoutValue\": 0\r\n },\r\n \"baseUrl\": \"http://localhost:55580\",\r\n \"loadBalancerOptions\": {\r\n \"type\": null,\r\n \"key\": null,\r\n \"expiry\": 0\r\n },\r\n \"downstreamScheme\": null,\r\n \"httpHandlerOptions\": {\r\n \"allowAutoRedirect\": false,\r\n \"useCookieContainer\": false,\r\n \"useTracing\": false,\r\n \"useProxy\": true\r\n }\r\n }\r\n}" + }, + "url": { + "raw": "http://localhost:5000/administration/configuration", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "5000", + "path": [ + "administration", + "configuration" + ] + } + }, + "response": [] + }, + { + "name": "2. POST http://localhost: 55580/administration/connect/token", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var jsonData = JSON.parse(responseBody);", + "postman.setGlobalVariable(\"AccessToken\", jsonData.access_token);", + "postman.setGlobalVariable(\"RefreshToken\", jsonData.refresh_token);" + ] + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "client_id", + "value": "admin", + "type": "text" + }, + { + "key": "client_secret", + "value": "secret", + "type": "text" + }, + { + "key": "scope", + "value": "admin", + "type": "text" + }, + { + "key": "grant_type", + "value": "client_credentials", + "type": "text" + } + ] + }, + "url": { + "raw": "http://localhost:5000/administration/connect/token", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "5000", + "path": [ + "administration", + "connect", + "token" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "id": "0f60e7b3-e4f1-4458-bbc4-fc4809e86b2d", + "type": "text/javascript", + "exec": [ + string.Empty + ] + } + }, + { + "listen": "test", + "script": { + "id": "1279a2cf-b771-4a86-9dfa-302b240fac62", + "type": "text/javascript", + "exec": [ + string.Empty + ] + } + } + ] } \ No newline at end of file diff --git a/samples/AdministrationApi/AdministrationApi.csproj b/samples/Administration/Ocelot.Samples.AdministrationApi.csproj similarity index 100% rename from samples/AdministrationApi/AdministrationApi.csproj rename to samples/Administration/Ocelot.Samples.AdministrationApi.csproj diff --git a/samples/AdministrationApi/Program.cs b/samples/Administration/Program.cs similarity index 100% rename from samples/AdministrationApi/Program.cs rename to samples/Administration/Program.cs diff --git a/samples/AdministrationApi/Properties/launchSettings.json b/samples/Administration/Properties/launchSettings.json similarity index 100% rename from samples/AdministrationApi/Properties/launchSettings.json rename to samples/Administration/Properties/launchSettings.json diff --git a/samples/AdministrationApi/README.md b/samples/Administration/README.md similarity index 96% rename from samples/AdministrationApi/README.md rename to samples/Administration/README.md index 42a01b2f4..59d236aa7 100644 --- a/samples/AdministrationApi/README.md +++ b/samples/Administration/README.md @@ -1,94 +1,94 @@ -```json -{ - "routes": [ - { - "downstreamPathTemplate": "/{everything}", - "upstreamPathTemplate": "/templates/{everything}", - "upstreamHttpMethod": [ - "GET" - ], - "addHeadersToRequest": {}, - "upstreamHeaderTransform": {}, - "downstreamHeaderTransform": {}, - "addClaimsToRequest": {}, - "routeClaimsRequirement": {}, - "addQueriesToRequest": {}, - "requestIdKey": null, - "fileCacheOptions": { - "ttlSeconds": 0, - "region": null - }, - "routeIsCaseSensitive": false, - "downstreamScheme": "http", - "qoSOptions": { - "exceptionsAllowedBeforeBreaking": 0, - "durationOfBreak": 0, - "timeoutValue": 0 - }, - "loadBalancerOptions": { - "type": null, - "key": null, - "expiry": 0 - }, - "rateLimitOptions": { - "clientWhitelist": [], - "enableRateLimiting": false, - "period": null, - "periodTimespan": 0, - "limit": 0 - }, - "authenticationOptions": { - "authenticationProviderKey": null, - "allowedScopes": [] - }, - "httpHandlerOptions": { - "allowAutoRedirect": false, - "useCookieContainer": false, - "useTracing": false, - "useProxy": true - }, - "downstreamHostAndPorts": [ - { - "host": "localhost", - "port": 50689 - } - ], - "upstreamHost": null, - "key": null, - "delegatingHandlers": [], - "priority": 1, - "timeout": 0, - "dangerousAcceptAnyServerCertificateValidator": false - } - ], - "aggregates": [], - "globalConfiguration": { - "requestIdKey": "Request-Id", - "rateLimitOptions": { - "clientIdHeader": "ClientId", - "quotaExceededMessage": null, - "rateLimitCounterPrefix": "ocelot", - "disableRateLimitHeaders": false, - "httpStatusCode": 429 - }, - "qoSOptions": { - "exceptionsAllowedBeforeBreaking": 0, - "durationOfBreak": 0, - "timeoutValue": 0 - }, - "baseUrl": "http://localhost:55580", - "loadBalancerOptions": { - "type": null, - "key": null, - "expiry": 0 - }, - "downstreamScheme": null, - "httpHandlerOptions": { - "allowAutoRedirect": false, - "useCookieContainer": false, - "useTracing": false, - "useProxy": true - } - } -} -``` +```json +{ + "routes": [ + { + "downstreamPathTemplate": "/{everything}", + "upstreamPathTemplate": "/templates/{everything}", + "upstreamHttpMethod": [ + "GET" + ], + "addHeadersToRequest": {}, + "upstreamHeaderTransform": {}, + "downstreamHeaderTransform": {}, + "addClaimsToRequest": {}, + "routeClaimsRequirement": {}, + "addQueriesToRequest": {}, + "requestIdKey": null, + "fileCacheOptions": { + "ttlSeconds": 0, + "region": null + }, + "routeIsCaseSensitive": false, + "downstreamScheme": "http", + "qoSOptions": { + "exceptionsAllowedBeforeBreaking": 0, + "durationOfBreak": 0, + "timeoutValue": 0 + }, + "loadBalancerOptions": { + "type": null, + "key": null, + "expiry": 0 + }, + "rateLimitOptions": { + "clientWhitelist": [], + "enableRateLimiting": false, + "period": null, + "periodTimespan": 0, + "limit": 0 + }, + "authenticationOptions": { + "authenticationProviderKey": null, + "allowedScopes": [] + }, + "httpHandlerOptions": { + "allowAutoRedirect": false, + "useCookieContainer": false, + "useTracing": false, + "useProxy": true + }, + "downstreamHostAndPorts": [ + { + "host": "localhost", + "port": 50689 + } + ], + "upstreamHost": null, + "key": null, + "delegatingHandlers": [], + "priority": 1, + "timeout": 0, + "dangerousAcceptAnyServerCertificateValidator": false + } + ], + "aggregates": [], + "globalConfiguration": { + "requestIdKey": "Request-Id", + "rateLimitOptions": { + "clientIdHeader": "ClientId", + "quotaExceededMessage": null, + "rateLimitCounterPrefix": "ocelot", + "disableRateLimitHeaders": false, + "httpStatusCode": 429 + }, + "qoSOptions": { + "exceptionsAllowedBeforeBreaking": 0, + "durationOfBreak": 0, + "timeoutValue": 0 + }, + "baseUrl": "http://localhost:55580", + "loadBalancerOptions": { + "type": null, + "key": null, + "expiry": 0 + }, + "downstreamScheme": null, + "httpHandlerOptions": { + "allowAutoRedirect": false, + "useCookieContainer": false, + "useTracing": false, + "useProxy": true + } + } +} +``` diff --git a/samples/AdministrationApi/appsettings.json b/samples/Administration/appsettings.json similarity index 100% rename from samples/AdministrationApi/appsettings.json rename to samples/Administration/appsettings.json diff --git a/samples/AdministrationApi/ocelot.json b/samples/Administration/ocelot.json similarity index 95% rename from samples/AdministrationApi/ocelot.json rename to samples/Administration/ocelot.json index 0fa4143ff..02e7c5512 100644 --- a/samples/AdministrationApi/ocelot.json +++ b/samples/Administration/ocelot.json @@ -1,18 +1,18 @@ -{ - "Routes": [ - { - "DownstreamPathTemplate": "/service/stats/collected", - "DownstreamScheme": "http", - "DownstreamHostAndPorts": [ - { - "Host": "localhost", - "Port": 5100 - } - ], - "UpstreamPathTemplate": "/api/stats/collected" - } - ], - "GlobalConfiguration": { - "BaseUrl": "http://localhost:5000" - } +{ + "Routes": [ + { + "DownstreamPathTemplate": "/service/stats/collected", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "localhost", + "Port": 5100 + } + ], + "UpstreamPathTemplate": "/api/stats/collected" + } + ], + "GlobalConfiguration": { + "BaseUrl": "http://localhost:5000" + } } \ No newline at end of file diff --git a/samples/AdministrationApi/tempkey.rsa b/samples/Administration/tempkey.rsa similarity index 100% rename from samples/AdministrationApi/tempkey.rsa rename to samples/Administration/tempkey.rsa diff --git a/samples/OcelotBasic/Ocelot.Samples.OcelotBasic.ApiGateway.csproj b/samples/Basic/Ocelot.Samples.Basic.ApiGateway.csproj similarity index 100% rename from samples/OcelotBasic/Ocelot.Samples.OcelotBasic.ApiGateway.csproj rename to samples/Basic/Ocelot.Samples.Basic.ApiGateway.csproj diff --git a/samples/OcelotBasic/Program.cs b/samples/Basic/Program.cs similarity index 97% rename from samples/OcelotBasic/Program.cs rename to samples/Basic/Program.cs index 34c555f19..3901407c2 100644 --- a/samples/OcelotBasic/Program.cs +++ b/samples/Basic/Program.cs @@ -1,29 +1,29 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; -using System.IO; +using System.IO; -namespace Ocelot.Samples.OcelotBasic.ApiGateway; - -public class Program -{ - public static void Main(string[] args) - { - new WebHostBuilder() - .UseKestrel() - .UseContentRoot(Directory.GetCurrentDirectory()) - .ConfigureAppConfiguration((hostingContext, config) => - { - config - .SetBasePath(hostingContext.HostingEnvironment.ContentRootPath) - .AddJsonFile("appsettings.json", true, true) - .AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true) - .AddJsonFile("ocelot.json") - .AddEnvironmentVariables(); - }) - .ConfigureLogging((hostingContext, logging) => +namespace Ocelot.Samples.OcelotBasic.ApiGateway; + +public class Program +{ + public static void Main(string[] args) + { + new WebHostBuilder() + .UseKestrel() + .UseContentRoot(Directory.GetCurrentDirectory()) + .ConfigureAppConfiguration((hostingContext, config) => + { + config + .SetBasePath(hostingContext.HostingEnvironment.ContentRootPath) + .AddJsonFile("appsettings.json", true, true) + .AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true) + .AddJsonFile("ocelot.json") + .AddEnvironmentVariables(); + }) + .ConfigureLogging((hostingContext, logging) => { if (hostingContext.HostingEnvironment.IsDevelopment()) { @@ -31,10 +31,10 @@ public static void Main(string[] args) logging.AddConsole(); } //add your logging - }) - .UseIISIntegration() + }) + .UseIISIntegration() .UseStartup() - .Build() - .Run(); - } -} + .Build() + .Run(); + } +} diff --git a/samples/OcelotBasic/Properties/launchSettings.json b/samples/Basic/Properties/launchSettings.json similarity index 100% rename from samples/OcelotBasic/Properties/launchSettings.json rename to samples/Basic/Properties/launchSettings.json diff --git a/samples/OcelotBasic/Startup.cs b/samples/Basic/Startup.cs similarity index 100% rename from samples/OcelotBasic/Startup.cs rename to samples/Basic/Startup.cs diff --git a/samples/OcelotBasic/appsettings.Development.json b/samples/Basic/appsettings.Development.json similarity index 100% rename from samples/OcelotBasic/appsettings.Development.json rename to samples/Basic/appsettings.Development.json diff --git a/samples/OcelotKube/ApiGateway/appsettings.json b/samples/Basic/appsettings.json similarity index 100% rename from samples/OcelotKube/ApiGateway/appsettings.json rename to samples/Basic/appsettings.json diff --git a/samples/OcelotBasic/ocelot.json b/samples/Basic/ocelot.json similarity index 95% rename from samples/OcelotBasic/ocelot.json rename to samples/Basic/ocelot.json index 2864550cd..7cab02430 100644 --- a/samples/OcelotBasic/ocelot.json +++ b/samples/Basic/ocelot.json @@ -1,21 +1,21 @@ -{ - "Routes": [ - { - "DownstreamPathTemplate": "/todos/{id}", - "DownstreamScheme": "https", - "DownstreamHostAndPorts": [ - { - "Host": "jsonplaceholder.typicode.com", - "Port": 443 - } - ], - "UpstreamPathTemplate": "/posts/{id}", - "UpstreamHttpMethod": [ - "Get" - ] - } - ], - "GlobalConfiguration": { - "BaseUrl": "https://localhost:5000" - } +{ + "Routes": [ + { + "DownstreamPathTemplate": "/todos/{id}", + "DownstreamScheme": "https", + "DownstreamHostAndPorts": [ + { + "Host": "jsonplaceholder.typicode.com", + "Port": 443 + } + ], + "UpstreamPathTemplate": "/posts/{id}", + "UpstreamHttpMethod": [ + "Get" + ] + } + ], + "GlobalConfiguration": { + "BaseUrl": "https://localhost:5000" + } } diff --git a/samples/Docker/README.md b/samples/Docker/README.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/samples/OcelotEureka/ApiGateway/ApiGateway.csproj b/samples/Eureka/ApiGateway/Ocelot.Samples.Eureka.ApiGateway.csproj similarity index 100% rename from samples/OcelotEureka/ApiGateway/ApiGateway.csproj rename to samples/Eureka/ApiGateway/Ocelot.Samples.Eureka.ApiGateway.csproj diff --git a/samples/OcelotEureka/ApiGateway/Program.cs b/samples/Eureka/ApiGateway/Program.cs similarity index 100% rename from samples/OcelotEureka/ApiGateway/Program.cs rename to samples/Eureka/ApiGateway/Program.cs diff --git a/samples/OcelotEureka/ApiGateway/Properties/launchSettings.json b/samples/Eureka/ApiGateway/Properties/launchSettings.json similarity index 100% rename from samples/OcelotEureka/ApiGateway/Properties/launchSettings.json rename to samples/Eureka/ApiGateway/Properties/launchSettings.json diff --git a/samples/OcelotEureka/ApiGateway/appsettings.json b/samples/Eureka/ApiGateway/appsettings.json similarity index 100% rename from samples/OcelotEureka/ApiGateway/appsettings.json rename to samples/Eureka/ApiGateway/appsettings.json diff --git a/samples/OcelotEureka/ApiGateway/ocelot.json b/samples/Eureka/ApiGateway/ocelot.json similarity index 96% rename from samples/OcelotEureka/ApiGateway/ocelot.json rename to samples/Eureka/ApiGateway/ocelot.json index 5a69973de..747cf23c8 100644 --- a/samples/OcelotEureka/ApiGateway/ocelot.json +++ b/samples/Eureka/ApiGateway/ocelot.json @@ -1,22 +1,22 @@ -{ - "Routes": [ - { - "DownstreamPathTemplate": "/api/Category", - "DownstreamScheme": "http", - "UpstreamPathTemplate": "/Category", - "ServiceName": "ncore-rat", - "UpstreamHttpMethod": [ "Get" ], - "QoSOptions": { - "ExceptionsAllowedBeforeBreaking": 3, - "DurationOfBreak": 10000, - "TimeoutValue": 5000 - }, - "FileCacheOptions": { "TtlSeconds": 15 } - } - ], - "GlobalConfiguration": { - "RequestIdKey": "OcRequestId", - "AdministrationPath": "/administration", - "ServiceDiscoveryProvider": { "Type": "Eureka" } - } -} +{ + "Routes": [ + { + "DownstreamPathTemplate": "/api/Category", + "DownstreamScheme": "http", + "UpstreamPathTemplate": "/Category", + "ServiceName": "ncore-rat", + "UpstreamHttpMethod": [ "Get" ], + "QoSOptions": { + "ExceptionsAllowedBeforeBreaking": 3, + "DurationOfBreak": 10000, + "TimeoutValue": 5000 + }, + "FileCacheOptions": { "TtlSeconds": 15 } + } + ], + "GlobalConfiguration": { + "RequestIdKey": "OcRequestId", + "AdministrationPath": "/administration", + "ServiceDiscoveryProvider": { "Type": "Eureka" } + } +} diff --git a/samples/OcelotEureka/DownstreamService/Controllers/CategoryController.cs b/samples/Eureka/DownstreamService/Controllers/CategoryController.cs similarity index 100% rename from samples/OcelotEureka/DownstreamService/Controllers/CategoryController.cs rename to samples/Eureka/DownstreamService/Controllers/CategoryController.cs diff --git a/samples/OcelotEureka/DownstreamService/DownstreamService.csproj b/samples/Eureka/DownstreamService/Ocelot.Samples.Eureka.DownstreamService.csproj similarity index 100% rename from samples/OcelotEureka/DownstreamService/DownstreamService.csproj rename to samples/Eureka/DownstreamService/Ocelot.Samples.Eureka.DownstreamService.csproj diff --git a/samples/OcelotEureka/DownstreamService/Program.cs b/samples/Eureka/DownstreamService/Program.cs similarity index 100% rename from samples/OcelotEureka/DownstreamService/Program.cs rename to samples/Eureka/DownstreamService/Program.cs diff --git a/samples/OcelotEureka/DownstreamService/Properties/launchSettings.json b/samples/Eureka/DownstreamService/Properties/launchSettings.json similarity index 100% rename from samples/OcelotEureka/DownstreamService/Properties/launchSettings.json rename to samples/Eureka/DownstreamService/Properties/launchSettings.json diff --git a/samples/OcelotEureka/DownstreamService/Startup.cs b/samples/Eureka/DownstreamService/Startup.cs similarity index 100% rename from samples/OcelotEureka/DownstreamService/Startup.cs rename to samples/Eureka/DownstreamService/Startup.cs diff --git a/samples/OcelotEureka/DownstreamService/appsettings.Development.json b/samples/Eureka/DownstreamService/appsettings.Development.json similarity index 100% rename from samples/OcelotEureka/DownstreamService/appsettings.Development.json rename to samples/Eureka/DownstreamService/appsettings.Development.json diff --git a/samples/OcelotEureka/DownstreamService/appsettings.json b/samples/Eureka/DownstreamService/appsettings.json similarity index 100% rename from samples/OcelotEureka/DownstreamService/appsettings.json rename to samples/Eureka/DownstreamService/appsettings.json diff --git a/samples/OcelotEureka/OcelotEureka.sln b/samples/Eureka/OcelotEureka.sln similarity index 100% rename from samples/OcelotEureka/OcelotEureka.sln rename to samples/Eureka/OcelotEureka.sln diff --git a/samples/OcelotEureka/README.md b/samples/Eureka/README.md similarity index 100% rename from samples/OcelotEureka/README.md rename to samples/Eureka/README.md diff --git a/samples/OcelotGraphQL/OcelotGraphQL.csproj b/samples/GraphQL/Ocelot.Samples.GraphQL.csproj similarity index 100% rename from samples/OcelotGraphQL/OcelotGraphQL.csproj rename to samples/GraphQL/Ocelot.Samples.GraphQL.csproj diff --git a/samples/OcelotGraphQL/OcelotGraphQL.sln b/samples/GraphQL/OcelotGraphQL.sln similarity index 100% rename from samples/OcelotGraphQL/OcelotGraphQL.sln rename to samples/GraphQL/OcelotGraphQL.sln diff --git a/samples/OcelotGraphQL/Program.cs b/samples/GraphQL/Program.cs similarity index 96% rename from samples/OcelotGraphQL/Program.cs rename to samples/GraphQL/Program.cs index e519875f1..e2f19aaaf 100644 --- a/samples/OcelotGraphQL/Program.cs +++ b/samples/GraphQL/Program.cs @@ -1,134 +1,134 @@ -using GraphQL; -using GraphQL.Types; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -using Ocelot.DependencyInjection; -using Ocelot.Middleware; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; - -namespace OcelotGraphQL -{ - public class Hero - { - public int Id { get; set; } - public string Name { get; set; } - } - - public class Query - { - private readonly List _heroes = new() - { - new Hero { Id = 1, Name = "R2-D2" }, - new Hero { Id = 2, Name = "Batman" }, - new Hero { Id = 3, Name = "Wonder Woman" }, - new Hero { Id = 4, Name = "Tom Pallister" } - }; - - [GraphQLMetadata("hero")] - public Hero GetHero(int id) - { - return _heroes.FirstOrDefault(x => x.Id == id); - } - } - - public class GraphQlDelegatingHandler : DelegatingHandler - { - //private readonly ISchema _schema; - private readonly IDocumentExecuter _executer; - private readonly IDocumentWriter _writer; - - public GraphQlDelegatingHandler(IDocumentExecuter executer, IDocumentWriter writer) - { - _executer = executer; - _writer = writer; - } - - protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) - { - //try get query from body, could check http method :) - var query = await request.Content.ReadAsStringAsync(cancellationToken); - - //if not body try query string, dont hack like this in real world.. - if (query.Length == 0) - { - var decoded = WebUtility.UrlDecode(request.RequestUri.Query); - query = decoded.Replace("?query=", string.Empty); - } - - var result = await _executer.ExecuteAsync(_ => - { - _.Query = query; - }); - - var responseBody = await _writer.WriteToStringAsync(result); - - //maybe check for errors and headers etc in real world? - var response = new HttpResponseMessage(HttpStatusCode.OK) - { - Content = new StringContent(responseBody) - }; - - //ocelot will treat this like any other http request... - return response; - } - } - - public class Program - { - public static void Main() - { - var schema = Schema.For(@" - type Hero { - id: Int - name: String - } - - type Query { - hero(id: Int): Hero - } - ", _ => - { - _.Types.Include(); - }); - - new WebHostBuilder() - .UseKestrel() - .UseContentRoot(Directory.GetCurrentDirectory()) - .ConfigureAppConfiguration((hostingContext, config) => - { - config - .SetBasePath(hostingContext.HostingEnvironment.ContentRootPath) - .AddJsonFile("appsettings.json", true, true) - .AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true) - .AddJsonFile("ocelot.json", false, false) - .AddEnvironmentVariables(); - }) - .ConfigureServices(s => - { - s.AddSingleton(schema); - s.AddOcelot() - .AddDelegatingHandler(); - }) - .ConfigureLogging((hostingContext, logging) => - { - logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging")); - logging.AddConsole(); - }) - .UseIISIntegration() - .Configure(app => - { - app.UseOcelot().Wait(); - }) - .Build() - .Run(); - } - } -} +using GraphQL; +using GraphQL.Types; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Ocelot.DependencyInjection; +using Ocelot.Middleware; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; + +namespace OcelotGraphQL +{ + public class Hero + { + public int Id { get; set; } + public string Name { get; set; } + } + + public class Query + { + private readonly List _heroes = new() + { + new Hero { Id = 1, Name = "R2-D2" }, + new Hero { Id = 2, Name = "Batman" }, + new Hero { Id = 3, Name = "Wonder Woman" }, + new Hero { Id = 4, Name = "Tom Pallister" } + }; + + [GraphQLMetadata("hero")] + public Hero GetHero(int id) + { + return _heroes.FirstOrDefault(x => x.Id == id); + } + } + + public class GraphQlDelegatingHandler : DelegatingHandler + { + //private readonly ISchema _schema; + private readonly IDocumentExecuter _executer; + private readonly IDocumentWriter _writer; + + public GraphQlDelegatingHandler(IDocumentExecuter executer, IDocumentWriter writer) + { + _executer = executer; + _writer = writer; + } + + protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) + { + //try get query from body, could check http method :) + var query = await request.Content.ReadAsStringAsync(cancellationToken); + + //if not body try query string, dont hack like this in real world.. + if (query.Length == 0) + { + var decoded = WebUtility.UrlDecode(request.RequestUri.Query); + query = decoded.Replace("?query=", string.Empty); + } + + var result = await _executer.ExecuteAsync(_ => + { + _.Query = query; + }); + + var responseBody = await _writer.WriteToStringAsync(result); + + //maybe check for errors and headers etc in real world? + var response = new HttpResponseMessage(HttpStatusCode.OK) + { + Content = new StringContent(responseBody) + }; + + //ocelot will treat this like any other http request... + return response; + } + } + + public class Program + { + public static void Main() + { + var schema = Schema.For(@" + type Hero { + id: Int + name: String + } + + type Query { + hero(id: Int): Hero + } + ", _ => + { + _.Types.Include(); + }); + + new WebHostBuilder() + .UseKestrel() + .UseContentRoot(Directory.GetCurrentDirectory()) + .ConfigureAppConfiguration((hostingContext, config) => + { + config + .SetBasePath(hostingContext.HostingEnvironment.ContentRootPath) + .AddJsonFile("appsettings.json", true, true) + .AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true) + .AddJsonFile("ocelot.json", false, false) + .AddEnvironmentVariables(); + }) + .ConfigureServices(s => + { + s.AddSingleton(schema); + s.AddOcelot() + .AddDelegatingHandler(); + }) + .ConfigureLogging((hostingContext, logging) => + { + logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging")); + logging.AddConsole(); + }) + .UseIISIntegration() + .Configure(app => + { + app.UseOcelot().Wait(); + }) + .Build() + .Run(); + } + } +} diff --git a/samples/OcelotGraphQL/Properties/launchSettings.json b/samples/GraphQL/Properties/launchSettings.json similarity index 100% rename from samples/OcelotGraphQL/Properties/launchSettings.json rename to samples/GraphQL/Properties/launchSettings.json diff --git a/samples/OcelotGraphQL/README.md b/samples/GraphQL/README.md similarity index 96% rename from samples/OcelotGraphQL/README.md rename to samples/GraphQL/README.md index 7f16ed985..1a470c344 100644 --- a/samples/OcelotGraphQL/README.md +++ b/samples/GraphQL/README.md @@ -1,71 +1,71 @@ -# Ocelot using GraphQL example - -Loads of people keep asking me if Ocelot will every support GraphQL, in my mind Ocelot and GraphQL are two different things that can work together. -I would not try and implement GraphQL in Ocelot instead I would either have Ocelot in front of GraphQL to handle things like authorization / authentication or I would -bring in the awesome [graphql-dotnet](https://github.com/graphql-dotnet/graphql-dotnet) library and use it in a [DelegatingHandler](http://ocelot.readthedocs.io/en/latest/features/delegatinghandlers.html). This way you could have Ocelot and GraphQL without the extra hop to GraphQL. This same is an example of how to do that. - -## Example - -If you run this project with - -$ dotnet run - -Use postman or something to make the following requests and you can see Ocelot and GraphQL in action together... - -GET http://localhost:5000/graphql?query={ hero(id: 4) { id name } } - -RESPONSE -```json - { - "data": { - "hero": { - "id": 4, - "name": "Tom Pallister" - } - } - } -``` - -POST http://localhost:5000/graphql - -BODY -```json - { hero(id: 4) { id name } } -``` - -RESPONSE -```json - { - "data": { - "hero": { - "id": 4, - "name": "Tom Pallister" - } - } - } -``` - -## Notes - -Please note this project never goes out to another service, it just gets the data for GraphQL in memory. You would need to add the details of your GraphQL server in ocelot.json e.g. - -```json -{ - "Routes": [ - { - "DownstreamPathTemplate": "/graphql", - "DownstreamScheme": "http", - "DownstreamHostAndPorts": [ - { - "Host": "yourgraphqlhost.com", - "Port": 80 - } - ], - "UpstreamPathTemplate": "/graphql", - "DelegatingHandlers": [ - "GraphQlDelegatingHandler" - ] - } - ] - } +# Ocelot using GraphQL example + +Loads of people keep asking me if Ocelot will every support GraphQL, in my mind Ocelot and GraphQL are two different things that can work together. +I would not try and implement GraphQL in Ocelot instead I would either have Ocelot in front of GraphQL to handle things like authorization / authentication or I would +bring in the awesome [graphql-dotnet](https://github.com/graphql-dotnet/graphql-dotnet) library and use it in a [DelegatingHandler](http://ocelot.readthedocs.io/en/latest/features/delegatinghandlers.html). This way you could have Ocelot and GraphQL without the extra hop to GraphQL. This same is an example of how to do that. + +## Example + +If you run this project with + +$ dotnet run + +Use postman or something to make the following requests and you can see Ocelot and GraphQL in action together... + +GET http://localhost:5000/graphql?query={ hero(id: 4) { id name } } + +RESPONSE +```json + { + "data": { + "hero": { + "id": 4, + "name": "Tom Pallister" + } + } + } +``` + +POST http://localhost:5000/graphql + +BODY +```json + { hero(id: 4) { id name } } +``` + +RESPONSE +```json + { + "data": { + "hero": { + "id": 4, + "name": "Tom Pallister" + } + } + } +``` + +## Notes + +Please note this project never goes out to another service, it just gets the data for GraphQL in memory. You would need to add the details of your GraphQL server in ocelot.json e.g. + +```json +{ + "Routes": [ + { + "DownstreamPathTemplate": "/graphql", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "yourgraphqlhost.com", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/graphql", + "DelegatingHandlers": [ + "GraphQlDelegatingHandler" + ] + } + ] + } ``` \ No newline at end of file diff --git a/samples/OcelotGraphQL/ocelot.json b/samples/GraphQL/ocelot.json similarity index 96% rename from samples/OcelotGraphQL/ocelot.json rename to samples/GraphQL/ocelot.json index c716bf258..3529e0ba8 100644 --- a/samples/OcelotGraphQL/ocelot.json +++ b/samples/GraphQL/ocelot.json @@ -1,19 +1,19 @@ -{ - "Routes": [ - { - "DownstreamPathTemplate": "/", - "DownstreamScheme": "http", - "DownstreamHostAndPorts": [ - { - "Host": "jsonplaceholder.typicode.com", - "Port": 80 - } - ], - "UpstreamPathTemplate": "/graphql", - "DelegatingHandlers": [ - "GraphQlDelegatingHandler" - ] - } - ] - } +{ + "Routes": [ + { + "DownstreamPathTemplate": "/", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "jsonplaceholder.typicode.com", + "Port": 80 + } + ], + "UpstreamPathTemplate": "/graphql", + "DelegatingHandlers": [ + "GraphQlDelegatingHandler" + ] + } + ] + } \ No newline at end of file diff --git a/samples/OcelotKube/.dockerignore b/samples/Kubernetes/.dockerignore similarity index 100% rename from samples/OcelotKube/.dockerignore rename to samples/Kubernetes/.dockerignore diff --git a/samples/OcelotKube/ApiGateway/Dockerfile b/samples/Kubernetes/ApiGateway/Dockerfile similarity index 100% rename from samples/OcelotKube/ApiGateway/Dockerfile rename to samples/Kubernetes/ApiGateway/Dockerfile diff --git a/samples/OcelotKube/ApiGateway/Ocelot.Samples.OcelotKube.ApiGateway.csproj b/samples/Kubernetes/ApiGateway/Ocelot.Samples.Kubernetes.ApiGateway.csproj similarity index 100% rename from samples/OcelotKube/ApiGateway/Ocelot.Samples.OcelotKube.ApiGateway.csproj rename to samples/Kubernetes/ApiGateway/Ocelot.Samples.Kubernetes.ApiGateway.csproj diff --git a/samples/OcelotKube/ApiGateway/Program.cs b/samples/Kubernetes/ApiGateway/Program.cs similarity index 100% rename from samples/OcelotKube/ApiGateway/Program.cs rename to samples/Kubernetes/ApiGateway/Program.cs diff --git a/samples/OcelotKube/ApiGateway/Properties/launchSettings.json b/samples/Kubernetes/ApiGateway/Properties/launchSettings.json similarity index 100% rename from samples/OcelotKube/ApiGateway/Properties/launchSettings.json rename to samples/Kubernetes/ApiGateway/Properties/launchSettings.json diff --git a/samples/OcelotKube/ApiGateway/Startup.cs b/samples/Kubernetes/ApiGateway/Startup.cs similarity index 100% rename from samples/OcelotKube/ApiGateway/Startup.cs rename to samples/Kubernetes/ApiGateway/Startup.cs diff --git a/samples/OcelotKube/ApiGateway/appsettings.Development.json b/samples/Kubernetes/ApiGateway/appsettings.Development.json similarity index 100% rename from samples/OcelotKube/ApiGateway/appsettings.Development.json rename to samples/Kubernetes/ApiGateway/appsettings.Development.json diff --git a/samples/OcelotKube/DownstreamService/appsettings.json b/samples/Kubernetes/ApiGateway/appsettings.json similarity index 100% rename from samples/OcelotKube/DownstreamService/appsettings.json rename to samples/Kubernetes/ApiGateway/appsettings.json diff --git a/samples/OcelotKube/ApiGateway/ocelot.json b/samples/Kubernetes/ApiGateway/ocelot.json similarity index 95% rename from samples/OcelotKube/ApiGateway/ocelot.json rename to samples/Kubernetes/ApiGateway/ocelot.json index 6a28b9eec..f4a5af0b8 100644 --- a/samples/OcelotKube/ApiGateway/ocelot.json +++ b/samples/Kubernetes/ApiGateway/ocelot.json @@ -1,20 +1,20 @@ -{ - "Routes": [ - { - "DownstreamPathTemplate": "/api/values", - "DownstreamScheme": "http", - "UpstreamPathTemplate": "/values", - "ServiceName": "downstreamservice", - "UpstreamHttpMethod": [ "Get" ] - } - ], - "GlobalConfiguration": { - "ServiceDiscoveryProvider": { - "Host": "192.168.0.13", - "Port": 443, - "Token": "txpc696iUhbVoudg164r93CxDTrKRVWG", - "Namespace": "dev", - "Type": "kube" - } - } -} +{ + "Routes": [ + { + "DownstreamPathTemplate": "/api/values", + "DownstreamScheme": "http", + "UpstreamPathTemplate": "/values", + "ServiceName": "downstreamservice", + "UpstreamHttpMethod": [ "Get" ] + } + ], + "GlobalConfiguration": { + "ServiceDiscoveryProvider": { + "Host": "192.168.0.13", + "Port": 443, + "Token": "txpc696iUhbVoudg164r93CxDTrKRVWG", + "Namespace": "dev", + "Type": "kube" + } + } +} diff --git a/samples/OcelotKube/Dockerfile b/samples/Kubernetes/Dockerfile similarity index 100% rename from samples/OcelotKube/Dockerfile rename to samples/Kubernetes/Dockerfile diff --git a/samples/OcelotKube/DownstreamService/Controllers/ValuesController.cs b/samples/Kubernetes/DownstreamService/Controllers/ValuesController.cs similarity index 100% rename from samples/OcelotKube/DownstreamService/Controllers/ValuesController.cs rename to samples/Kubernetes/DownstreamService/Controllers/ValuesController.cs diff --git a/samples/OcelotKube/DownstreamService/Controllers/WeatherForecastController.cs b/samples/Kubernetes/DownstreamService/Controllers/WeatherForecastController.cs similarity index 100% rename from samples/OcelotKube/DownstreamService/Controllers/WeatherForecastController.cs rename to samples/Kubernetes/DownstreamService/Controllers/WeatherForecastController.cs diff --git a/samples/OcelotKube/DownstreamService/Dockerfile b/samples/Kubernetes/DownstreamService/Dockerfile similarity index 100% rename from samples/OcelotKube/DownstreamService/Dockerfile rename to samples/Kubernetes/DownstreamService/Dockerfile diff --git a/samples/OcelotKube/DownstreamService/Models/WeatherForecast.cs b/samples/Kubernetes/DownstreamService/Models/WeatherForecast.cs similarity index 100% rename from samples/OcelotKube/DownstreamService/Models/WeatherForecast.cs rename to samples/Kubernetes/DownstreamService/Models/WeatherForecast.cs diff --git a/samples/OcelotKube/DownstreamService/Ocelot.Samples.OcelotKube.DownstreamService.csproj b/samples/Kubernetes/DownstreamService/Ocelot.Samples.Kubernetes.DownstreamService.csproj similarity index 86% rename from samples/OcelotKube/DownstreamService/Ocelot.Samples.OcelotKube.DownstreamService.csproj rename to samples/Kubernetes/DownstreamService/Ocelot.Samples.Kubernetes.DownstreamService.csproj index 3c1cfefb2..72b36b2fc 100644 --- a/samples/OcelotKube/DownstreamService/Ocelot.Samples.OcelotKube.DownstreamService.csproj +++ b/samples/Kubernetes/DownstreamService/Ocelot.Samples.Kubernetes.DownstreamService.csproj @@ -1,6 +1,6 @@ - net7.0 + net6.0;net7.0;net8.0 disable disable InProcess diff --git a/samples/OcelotKube/DownstreamService/Program.cs b/samples/Kubernetes/DownstreamService/Program.cs similarity index 100% rename from samples/OcelotKube/DownstreamService/Program.cs rename to samples/Kubernetes/DownstreamService/Program.cs diff --git a/samples/OcelotKube/DownstreamService/Properties/launchSettings.json b/samples/Kubernetes/DownstreamService/Properties/launchSettings.json similarity index 100% rename from samples/OcelotKube/DownstreamService/Properties/launchSettings.json rename to samples/Kubernetes/DownstreamService/Properties/launchSettings.json diff --git a/samples/OcelotKube/DownstreamService/appsettings.Development.json b/samples/Kubernetes/DownstreamService/appsettings.Development.json similarity index 100% rename from samples/OcelotKube/DownstreamService/appsettings.Development.json rename to samples/Kubernetes/DownstreamService/appsettings.Development.json diff --git a/samples/OcelotBasic/appsettings.json b/samples/Kubernetes/DownstreamService/appsettings.json similarity index 92% rename from samples/OcelotBasic/appsettings.json rename to samples/Kubernetes/DownstreamService/appsettings.json index 7376aada1..def9159a7 100644 --- a/samples/OcelotBasic/appsettings.json +++ b/samples/Kubernetes/DownstreamService/appsettings.json @@ -1,8 +1,8 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Warning" - } - }, - "AllowedHosts": "*" -} +{ + "Logging": { + "LogLevel": { + "Default": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/samples/OcelotKube/OcelotKube.sln b/samples/Kubernetes/OcelotKube.sln similarity index 100% rename from samples/OcelotKube/OcelotKube.sln rename to samples/Kubernetes/OcelotKube.sln diff --git a/samples/Ocelot.Samples.sln b/samples/Ocelot.Samples.sln new file mode 100644 index 000000000..ca208f4a6 --- /dev/null +++ b/samples/Ocelot.Samples.sln @@ -0,0 +1,91 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.9.34728.123 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.AdministrationApi", "Administration\Ocelot.Samples.AdministrationApi.csproj", "{238467FE-19EE-4102-9AF7-51EB2C6F0354}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.Basic.ApiGateway", "Basic\Ocelot.Samples.Basic.ApiGateway.csproj", "{A7D2C43A-E35C-4A89-AEE5-5C87052ECD89}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.Eureka.ApiGateway", "Eureka\ApiGateway\Ocelot.Samples.Eureka.ApiGateway.csproj", "{EA0E146F-2C2B-4176-B6EC-F62A587F5077}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.Eureka.DownstreamService", "Eureka\DownstreamService\Ocelot.Samples.Eureka.DownstreamService.csproj", "{B7317B64-2208-472D-90AC-F42B61956B79}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.GraphQL", "GraphQL\Ocelot.Samples.GraphQL.csproj", "{6CCA3677-420A-4294-8D41-67CF3D818575}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.Kubernetes.ApiGateway", "Kubernetes\ApiGateway\Ocelot.Samples.Kubernetes.ApiGateway.csproj", "{721C1737-70CB-4B11-A19B-C7AAC6856CC7}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.Kubernetes.DownstreamService", "Kubernetes\DownstreamService\Ocelot.Samples.Kubernetes.DownstreamService.csproj", "{CE949A5D-9D25-46E3-B59A-DA63F7ED9A59}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.OpenTracing", "OpenTracing\Ocelot.Samples.OpenTracing.csproj", "{707BD584-3CC0-4087-820C-049C3D68F6A3}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.ServiceDiscovery.ApiGateway", "ServiceDiscovery\ApiGateway\Ocelot.Samples.ServiceDiscovery.ApiGateway.csproj", "{96B9F16E-C95D-425A-A419-40CB3C90CB77}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.ServiceDiscovery.DownstreamService", "ServiceDiscovery\DownstreamService\Ocelot.Samples.ServiceDiscovery.DownstreamService.csproj", "{60E14B1A-C295-453B-910E-58E09F5A28AA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.ServiceFabric.ApiGateway", "ServiceFabric\ApiGateway\Ocelot.Samples.ServiceFabric.ApiGateway.csproj", "{115F7934-3326-492A-B131-64F0EAEBAD71}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Samples.ServiceFabric.DownstreamService", "ServiceFabric\DownstreamService\Ocelot.Samples.ServiceFabric.DownstreamService.csproj", "{6C777A20-F557-45CF-B87B-11E3C6B29A36}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {238467FE-19EE-4102-9AF7-51EB2C6F0354}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {238467FE-19EE-4102-9AF7-51EB2C6F0354}.Debug|Any CPU.Build.0 = Debug|Any CPU + {238467FE-19EE-4102-9AF7-51EB2C6F0354}.Release|Any CPU.ActiveCfg = Release|Any CPU + {238467FE-19EE-4102-9AF7-51EB2C6F0354}.Release|Any CPU.Build.0 = Release|Any CPU + {A7D2C43A-E35C-4A89-AEE5-5C87052ECD89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A7D2C43A-E35C-4A89-AEE5-5C87052ECD89}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A7D2C43A-E35C-4A89-AEE5-5C87052ECD89}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A7D2C43A-E35C-4A89-AEE5-5C87052ECD89}.Release|Any CPU.Build.0 = Release|Any CPU + {EA0E146F-2C2B-4176-B6EC-F62A587F5077}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EA0E146F-2C2B-4176-B6EC-F62A587F5077}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EA0E146F-2C2B-4176-B6EC-F62A587F5077}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EA0E146F-2C2B-4176-B6EC-F62A587F5077}.Release|Any CPU.Build.0 = Release|Any CPU + {B7317B64-2208-472D-90AC-F42B61956B79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B7317B64-2208-472D-90AC-F42B61956B79}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B7317B64-2208-472D-90AC-F42B61956B79}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B7317B64-2208-472D-90AC-F42B61956B79}.Release|Any CPU.Build.0 = Release|Any CPU + {6CCA3677-420A-4294-8D41-67CF3D818575}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6CCA3677-420A-4294-8D41-67CF3D818575}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6CCA3677-420A-4294-8D41-67CF3D818575}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6CCA3677-420A-4294-8D41-67CF3D818575}.Release|Any CPU.Build.0 = Release|Any CPU + {721C1737-70CB-4B11-A19B-C7AAC6856CC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {721C1737-70CB-4B11-A19B-C7AAC6856CC7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {721C1737-70CB-4B11-A19B-C7AAC6856CC7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {721C1737-70CB-4B11-A19B-C7AAC6856CC7}.Release|Any CPU.Build.0 = Release|Any CPU + {CE949A5D-9D25-46E3-B59A-DA63F7ED9A59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CE949A5D-9D25-46E3-B59A-DA63F7ED9A59}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CE949A5D-9D25-46E3-B59A-DA63F7ED9A59}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CE949A5D-9D25-46E3-B59A-DA63F7ED9A59}.Release|Any CPU.Build.0 = Release|Any CPU + {707BD584-3CC0-4087-820C-049C3D68F6A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {707BD584-3CC0-4087-820C-049C3D68F6A3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {707BD584-3CC0-4087-820C-049C3D68F6A3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {707BD584-3CC0-4087-820C-049C3D68F6A3}.Release|Any CPU.Build.0 = Release|Any CPU + {96B9F16E-C95D-425A-A419-40CB3C90CB77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {96B9F16E-C95D-425A-A419-40CB3C90CB77}.Debug|Any CPU.Build.0 = Debug|Any CPU + {96B9F16E-C95D-425A-A419-40CB3C90CB77}.Release|Any CPU.ActiveCfg = Release|Any CPU + {96B9F16E-C95D-425A-A419-40CB3C90CB77}.Release|Any CPU.Build.0 = Release|Any CPU + {60E14B1A-C295-453B-910E-58E09F5A28AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {60E14B1A-C295-453B-910E-58E09F5A28AA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {60E14B1A-C295-453B-910E-58E09F5A28AA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {60E14B1A-C295-453B-910E-58E09F5A28AA}.Release|Any CPU.Build.0 = Release|Any CPU + {115F7934-3326-492A-B131-64F0EAEBAD71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {115F7934-3326-492A-B131-64F0EAEBAD71}.Debug|Any CPU.Build.0 = Debug|Any CPU + {115F7934-3326-492A-B131-64F0EAEBAD71}.Release|Any CPU.ActiveCfg = Release|Any CPU + {115F7934-3326-492A-B131-64F0EAEBAD71}.Release|Any CPU.Build.0 = Release|Any CPU + {6C777A20-F557-45CF-B87B-11E3C6B29A36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6C777A20-F557-45CF-B87B-11E3C6B29A36}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6C777A20-F557-45CF-B87B-11E3C6B29A36}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6C777A20-F557-45CF-B87B-11E3C6B29A36}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {2C1620D4-EB38-4C3E-9FC5-029FB6B2F426} + EndGlobalSection +EndGlobal diff --git a/samples/OcelotServiceDiscovery/DownstreamService/.dockerignore b/samples/OcelotServiceDiscovery/DownstreamService/.dockerignore deleted file mode 100644 index e7b690f11..000000000 --- a/samples/OcelotServiceDiscovery/DownstreamService/.dockerignore +++ /dev/null @@ -1,25 +0,0 @@ -**/.classpath -**/.dockerignore -**/.env -**/.git -**/.gitignore -**/.project -**/.settings -**/.toolstarget -**/.vs -**/.vscode -**/*.*proj.user -**/*.dbmdl -**/*.jfm -**/azds.yaml -**/bin -**/charts -**/docker-compose* -**/Dockerfile* -**/node_modules -**/npm-debug.log -**/obj -**/secrets.dev.yaml -**/values.dev.yaml -LICENSE -README.md diff --git a/samples/OcelotServiceDiscovery/DownstreamService/Dockerfile b/samples/OcelotServiceDiscovery/DownstreamService/Dockerfile deleted file mode 100644 index b7535cfcd..000000000 --- a/samples/OcelotServiceDiscovery/DownstreamService/Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. - -FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base -WORKDIR /app -EXPOSE 80 -EXPOSE 443 - -FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build -WORKDIR /src -COPY ["Ocelot.Samples.ServiceDiscovery.DownstreamService.csproj", "."] -RUN dotnet restore "./Ocelot.Samples.ServiceDiscovery.DownstreamService.csproj" -COPY . . -WORKDIR "/src/." -RUN dotnet build "Ocelot.Samples.ServiceDiscovery.DownstreamService.csproj" -c Release -o /app/build - -FROM build AS publish -RUN dotnet publish "Ocelot.Samples.ServiceDiscovery.DownstreamService.csproj" -c Release -o /app/publish /p:UseAppHost=false - -FROM base AS final -WORKDIR /app -COPY --from=publish /app/publish . -ENTRYPOINT ["dotnet", "Ocelot.Samples.ServiceDiscovery.DownstreamService.dll"] diff --git a/samples/OcelotServiceDiscovery/DownstreamService/Ocelot.Samples.ServiceDiscovery.DownstreamService.csproj b/samples/OcelotServiceDiscovery/DownstreamService/Ocelot.Samples.ServiceDiscovery.DownstreamService.csproj deleted file mode 100644 index c0669cb7d..000000000 --- a/samples/OcelotServiceDiscovery/DownstreamService/Ocelot.Samples.ServiceDiscovery.DownstreamService.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - net7.0 - disable - enable - Linux - . - d5492aa8-b50c-41ae-a044-9954846db9ac - - - - - - - - diff --git a/samples/OcelotOpenTracing/OcelotOpenTracing.csproj b/samples/OpenTracing/Ocelot.Samples.OpenTracing.csproj similarity index 100% rename from samples/OcelotOpenTracing/OcelotOpenTracing.csproj rename to samples/OpenTracing/Ocelot.Samples.OpenTracing.csproj diff --git a/samples/OcelotOpenTracing/Program.cs b/samples/OpenTracing/Program.cs similarity index 100% rename from samples/OcelotOpenTracing/Program.cs rename to samples/OpenTracing/Program.cs diff --git a/samples/OcelotOpenTracing/appsettings.Development.json b/samples/OpenTracing/appsettings.Development.json similarity index 100% rename from samples/OcelotOpenTracing/appsettings.Development.json rename to samples/OpenTracing/appsettings.Development.json diff --git a/samples/OcelotOpenTracing/appsettings.json b/samples/OpenTracing/appsettings.json similarity index 100% rename from samples/OcelotOpenTracing/appsettings.json rename to samples/OpenTracing/appsettings.json diff --git a/samples/OcelotOpenTracing/ocelot.json b/samples/OpenTracing/ocelot.json similarity index 100% rename from samples/OcelotOpenTracing/ocelot.json rename to samples/OpenTracing/ocelot.json diff --git a/samples/OcelotServiceDiscovery/.dockerignore b/samples/ServiceDiscovery/.dockerignore similarity index 100% rename from samples/OcelotServiceDiscovery/.dockerignore rename to samples/ServiceDiscovery/.dockerignore diff --git a/samples/OcelotServiceDiscovery/ApiGateway/Ocelot.Samples.ServiceDiscovery.ApiGateway.csproj b/samples/ServiceDiscovery/ApiGateway/Ocelot.Samples.ServiceDiscovery.ApiGateway.csproj similarity index 59% rename from samples/OcelotServiceDiscovery/ApiGateway/Ocelot.Samples.ServiceDiscovery.ApiGateway.csproj rename to samples/ServiceDiscovery/ApiGateway/Ocelot.Samples.ServiceDiscovery.ApiGateway.csproj index aac1dd20a..815c793e9 100644 --- a/samples/OcelotServiceDiscovery/ApiGateway/Ocelot.Samples.ServiceDiscovery.ApiGateway.csproj +++ b/samples/ServiceDiscovery/ApiGateway/Ocelot.Samples.ServiceDiscovery.ApiGateway.csproj @@ -1,6 +1,8 @@ - net6.0;net7.0;net8.0 + net8.0 + disable + disable diff --git a/samples/OcelotServiceDiscovery/ApiGateway/Program.cs b/samples/ServiceDiscovery/ApiGateway/Program.cs similarity index 100% rename from samples/OcelotServiceDiscovery/ApiGateway/Program.cs rename to samples/ServiceDiscovery/ApiGateway/Program.cs diff --git a/samples/OcelotServiceDiscovery/ApiGateway/Properties/launchSettings.json b/samples/ServiceDiscovery/ApiGateway/Properties/launchSettings.json similarity index 100% rename from samples/OcelotServiceDiscovery/ApiGateway/Properties/launchSettings.json rename to samples/ServiceDiscovery/ApiGateway/Properties/launchSettings.json diff --git a/samples/OcelotServiceDiscovery/ApiGateway/ServiceDiscovery/MyServiceDiscoveryProvider.cs b/samples/ServiceDiscovery/ApiGateway/ServiceDiscovery/MyServiceDiscoveryProvider.cs similarity index 100% rename from samples/OcelotServiceDiscovery/ApiGateway/ServiceDiscovery/MyServiceDiscoveryProvider.cs rename to samples/ServiceDiscovery/ApiGateway/ServiceDiscovery/MyServiceDiscoveryProvider.cs diff --git a/samples/OcelotServiceDiscovery/ApiGateway/ServiceDiscovery/MyServiceDiscoveryProviderFactory.cs b/samples/ServiceDiscovery/ApiGateway/ServiceDiscovery/MyServiceDiscoveryProviderFactory.cs similarity index 100% rename from samples/OcelotServiceDiscovery/ApiGateway/ServiceDiscovery/MyServiceDiscoveryProviderFactory.cs rename to samples/ServiceDiscovery/ApiGateway/ServiceDiscovery/MyServiceDiscoveryProviderFactory.cs diff --git a/samples/OcelotServiceDiscovery/ApiGateway/appsettings.json b/samples/ServiceDiscovery/ApiGateway/appsettings.json similarity index 100% rename from samples/OcelotServiceDiscovery/ApiGateway/appsettings.json rename to samples/ServiceDiscovery/ApiGateway/appsettings.json diff --git a/samples/OcelotServiceDiscovery/ApiGateway/ocelot.json b/samples/ServiceDiscovery/ApiGateway/ocelot.json similarity index 100% rename from samples/OcelotServiceDiscovery/ApiGateway/ocelot.json rename to samples/ServiceDiscovery/ApiGateway/ocelot.json diff --git a/samples/OcelotServiceDiscovery/DownstreamService/Controllers/CategoriesController.cs b/samples/ServiceDiscovery/DownstreamService/Controllers/CategoriesController.cs similarity index 100% rename from samples/OcelotServiceDiscovery/DownstreamService/Controllers/CategoriesController.cs rename to samples/ServiceDiscovery/DownstreamService/Controllers/CategoriesController.cs diff --git a/samples/OcelotServiceDiscovery/DownstreamService/Controllers/HealthController.cs b/samples/ServiceDiscovery/DownstreamService/Controllers/HealthController.cs similarity index 100% rename from samples/OcelotServiceDiscovery/DownstreamService/Controllers/HealthController.cs rename to samples/ServiceDiscovery/DownstreamService/Controllers/HealthController.cs diff --git a/samples/OcelotServiceDiscovery/DownstreamService/Controllers/WeatherForecastController.cs b/samples/ServiceDiscovery/DownstreamService/Controllers/WeatherForecastController.cs similarity index 100% rename from samples/OcelotServiceDiscovery/DownstreamService/Controllers/WeatherForecastController.cs rename to samples/ServiceDiscovery/DownstreamService/Controllers/WeatherForecastController.cs diff --git a/samples/OcelotServiceDiscovery/DownstreamService/Models/HealthResult.cs b/samples/ServiceDiscovery/DownstreamService/Models/HealthResult.cs similarity index 100% rename from samples/OcelotServiceDiscovery/DownstreamService/Models/HealthResult.cs rename to samples/ServiceDiscovery/DownstreamService/Models/HealthResult.cs diff --git a/samples/OcelotServiceDiscovery/DownstreamService/Models/MicroserviceResult.cs b/samples/ServiceDiscovery/DownstreamService/Models/MicroserviceResult.cs similarity index 100% rename from samples/OcelotServiceDiscovery/DownstreamService/Models/MicroserviceResult.cs rename to samples/ServiceDiscovery/DownstreamService/Models/MicroserviceResult.cs diff --git a/samples/OcelotServiceDiscovery/DownstreamService/Models/ReadyResult.cs b/samples/ServiceDiscovery/DownstreamService/Models/ReadyResult.cs similarity index 100% rename from samples/OcelotServiceDiscovery/DownstreamService/Models/ReadyResult.cs rename to samples/ServiceDiscovery/DownstreamService/Models/ReadyResult.cs diff --git a/samples/OcelotServiceDiscovery/DownstreamService/Models/WeatherForecast.cs b/samples/ServiceDiscovery/DownstreamService/Models/WeatherForecast.cs similarity index 100% rename from samples/OcelotServiceDiscovery/DownstreamService/Models/WeatherForecast.cs rename to samples/ServiceDiscovery/DownstreamService/Models/WeatherForecast.cs diff --git a/samples/ServiceDiscovery/DownstreamService/Ocelot.Samples.ServiceDiscovery.DownstreamService.csproj b/samples/ServiceDiscovery/DownstreamService/Ocelot.Samples.ServiceDiscovery.DownstreamService.csproj new file mode 100644 index 000000000..163a956bb --- /dev/null +++ b/samples/ServiceDiscovery/DownstreamService/Ocelot.Samples.ServiceDiscovery.DownstreamService.csproj @@ -0,0 +1,13 @@ + + + + net8.0 + disable + enable + + + + + + + diff --git a/samples/OcelotServiceDiscovery/DownstreamService/Program.cs b/samples/ServiceDiscovery/DownstreamService/Program.cs similarity index 100% rename from samples/OcelotServiceDiscovery/DownstreamService/Program.cs rename to samples/ServiceDiscovery/DownstreamService/Program.cs diff --git a/samples/OcelotServiceDiscovery/DownstreamService/Properties/launchSettings.json b/samples/ServiceDiscovery/DownstreamService/Properties/launchSettings.json similarity index 100% rename from samples/OcelotServiceDiscovery/DownstreamService/Properties/launchSettings.json rename to samples/ServiceDiscovery/DownstreamService/Properties/launchSettings.json diff --git a/samples/OcelotServiceDiscovery/DownstreamService/Startup.cs b/samples/ServiceDiscovery/DownstreamService/Startup.cs similarity index 100% rename from samples/OcelotServiceDiscovery/DownstreamService/Startup.cs rename to samples/ServiceDiscovery/DownstreamService/Startup.cs diff --git a/samples/OcelotServiceDiscovery/DownstreamService/appsettings.Development.json b/samples/ServiceDiscovery/DownstreamService/appsettings.Development.json similarity index 100% rename from samples/OcelotServiceDiscovery/DownstreamService/appsettings.Development.json rename to samples/ServiceDiscovery/DownstreamService/appsettings.Development.json diff --git a/samples/OcelotServiceDiscovery/DownstreamService/appsettings.json b/samples/ServiceDiscovery/DownstreamService/appsettings.json similarity index 100% rename from samples/OcelotServiceDiscovery/DownstreamService/appsettings.json rename to samples/ServiceDiscovery/DownstreamService/appsettings.json diff --git a/samples/OcelotServiceDiscovery/Ocelot.Samples.ServiceDiscovery.sln b/samples/ServiceDiscovery/Ocelot.Samples.ServiceDiscovery.sln similarity index 100% rename from samples/OcelotServiceDiscovery/Ocelot.Samples.ServiceDiscovery.sln rename to samples/ServiceDiscovery/Ocelot.Samples.ServiceDiscovery.sln diff --git a/samples/OcelotServiceDiscovery/README.md b/samples/ServiceDiscovery/README.md similarity index 100% rename from samples/OcelotServiceDiscovery/README.md rename to samples/ServiceDiscovery/README.md diff --git a/samples/OcelotServiceFabric/.gitignore b/samples/ServiceFabric/.gitignore similarity index 100% rename from samples/OcelotServiceFabric/.gitignore rename to samples/ServiceFabric/.gitignore diff --git a/samples/OcelotServiceFabric/src/OcelotApplicationApiGateway/OcelotApplicationApiGateway.csproj b/samples/ServiceFabric/ApiGateway/Ocelot.Samples.ServiceFabric.ApiGateway.csproj similarity index 92% rename from samples/OcelotServiceFabric/src/OcelotApplicationApiGateway/OcelotApplicationApiGateway.csproj rename to samples/ServiceFabric/ApiGateway/Ocelot.Samples.ServiceFabric.ApiGateway.csproj index c97238c53..c9f886f75 100644 --- a/samples/OcelotServiceFabric/src/OcelotApplicationApiGateway/OcelotApplicationApiGateway.csproj +++ b/samples/ServiceFabric/ApiGateway/Ocelot.Samples.ServiceFabric.ApiGateway.csproj @@ -18,6 +18,6 @@ - + diff --git a/samples/OcelotServiceFabric/src/OcelotApplicationApiGateway/OcelotApplicationApiGateway.cs b/samples/ServiceFabric/ApiGateway/OcelotApplicationApiGateway.cs similarity index 100% rename from samples/OcelotServiceFabric/src/OcelotApplicationApiGateway/OcelotApplicationApiGateway.cs rename to samples/ServiceFabric/ApiGateway/OcelotApplicationApiGateway.cs diff --git a/samples/OcelotServiceFabric/src/OcelotApplicationApiGateway/Program.cs b/samples/ServiceFabric/ApiGateway/Program.cs similarity index 100% rename from samples/OcelotServiceFabric/src/OcelotApplicationApiGateway/Program.cs rename to samples/ServiceFabric/ApiGateway/Program.cs diff --git a/samples/OcelotServiceFabric/src/OcelotApplicationApiGateway/Properties/launchSettings.json b/samples/ServiceFabric/ApiGateway/Properties/launchSettings.json similarity index 100% rename from samples/OcelotServiceFabric/src/OcelotApplicationApiGateway/Properties/launchSettings.json rename to samples/ServiceFabric/ApiGateway/Properties/launchSettings.json diff --git a/samples/OcelotServiceFabric/src/OcelotApplicationApiGateway/ServiceEventListener.cs b/samples/ServiceFabric/ApiGateway/ServiceEventListener.cs similarity index 100% rename from samples/OcelotServiceFabric/src/OcelotApplicationApiGateway/ServiceEventListener.cs rename to samples/ServiceFabric/ApiGateway/ServiceEventListener.cs diff --git a/samples/OcelotServiceFabric/src/OcelotApplicationApiGateway/ServiceEventSource.cs b/samples/ServiceFabric/ApiGateway/ServiceEventSource.cs similarity index 100% rename from samples/OcelotServiceFabric/src/OcelotApplicationApiGateway/ServiceEventSource.cs rename to samples/ServiceFabric/ApiGateway/ServiceEventSource.cs diff --git a/samples/OcelotServiceFabric/src/OcelotApplicationApiGateway/WebCommunicationListener.cs b/samples/ServiceFabric/ApiGateway/WebCommunicationListener.cs similarity index 100% rename from samples/OcelotServiceFabric/src/OcelotApplicationApiGateway/WebCommunicationListener.cs rename to samples/ServiceFabric/ApiGateway/WebCommunicationListener.cs diff --git a/samples/OcelotServiceFabric/src/OcelotApplicationApiGateway/appsettings.json b/samples/ServiceFabric/ApiGateway/appsettings.json similarity index 100% rename from samples/OcelotServiceFabric/src/OcelotApplicationApiGateway/appsettings.json rename to samples/ServiceFabric/ApiGateway/appsettings.json diff --git a/samples/OcelotServiceFabric/src/OcelotApplicationApiGateway/ocelot.json b/samples/ServiceFabric/ApiGateway/ocelot.json similarity index 95% rename from samples/OcelotServiceFabric/src/OcelotApplicationApiGateway/ocelot.json rename to samples/ServiceFabric/ApiGateway/ocelot.json index b541e95c4..1b174cd62 100644 --- a/samples/OcelotServiceFabric/src/OcelotApplicationApiGateway/ocelot.json +++ b/samples/ServiceFabric/ApiGateway/ocelot.json @@ -1,21 +1,21 @@ -{ - "Routes": [ - { - "DownstreamPathTemplate": "/api/values", - "UpstreamPathTemplate": "/EquipmentInterfaces", - "UpstreamHttpMethod": [ - "Get" - ], - "DownstreamScheme": "http", - "ServiceName": "OcelotServiceApplication/OcelotApplicationService" - } - ], - "GlobalConfiguration": { - "RequestIdKey": "OcRequestId", - "ServiceDiscoveryProvider": { - "Host": "localhost", - "Port": 19081, - "Type": "ServiceFabric" - } - } -} +{ + "Routes": [ + { + "DownstreamPathTemplate": "/api/values", + "UpstreamPathTemplate": "/EquipmentInterfaces", + "UpstreamHttpMethod": [ + "Get" + ], + "DownstreamScheme": "http", + "ServiceName": "OcelotServiceApplication/OcelotApplicationService" + } + ], + "GlobalConfiguration": { + "RequestIdKey": "OcRequestId", + "ServiceDiscoveryProvider": { + "Host": "localhost", + "Port": 19081, + "Type": "ServiceFabric" + } + } +} diff --git a/samples/OcelotServiceFabric/CONTRIBUTING.md b/samples/ServiceFabric/CONTRIBUTING.md similarity index 100% rename from samples/OcelotServiceFabric/CONTRIBUTING.md rename to samples/ServiceFabric/CONTRIBUTING.md diff --git a/samples/OcelotServiceFabric/src/OcelotApplicationService/ApiGateway.cs b/samples/ServiceFabric/DownstreamService/ApiGateway.cs similarity index 100% rename from samples/OcelotServiceFabric/src/OcelotApplicationService/ApiGateway.cs rename to samples/ServiceFabric/DownstreamService/ApiGateway.cs diff --git a/samples/OcelotServiceFabric/src/OcelotApplicationService/Controllers/ValuesController.cs b/samples/ServiceFabric/DownstreamService/Controllers/ValuesController.cs similarity index 100% rename from samples/OcelotServiceFabric/src/OcelotApplicationService/Controllers/ValuesController.cs rename to samples/ServiceFabric/DownstreamService/Controllers/ValuesController.cs diff --git a/samples/OcelotServiceFabric/src/OcelotApplicationService/OcelotApplicationService.csproj b/samples/ServiceFabric/DownstreamService/Ocelot.Samples.ServiceFabric.DownstreamService.csproj similarity index 100% rename from samples/OcelotServiceFabric/src/OcelotApplicationService/OcelotApplicationService.csproj rename to samples/ServiceFabric/DownstreamService/Ocelot.Samples.ServiceFabric.DownstreamService.csproj diff --git a/samples/OcelotServiceFabric/src/OcelotApplicationService/Program.cs b/samples/ServiceFabric/DownstreamService/Program.cs similarity index 100% rename from samples/OcelotServiceFabric/src/OcelotApplicationService/Program.cs rename to samples/ServiceFabric/DownstreamService/Program.cs diff --git a/samples/OcelotServiceFabric/src/OcelotApplicationService/Properties/launchSettings.json b/samples/ServiceFabric/DownstreamService/Properties/launchSettings.json similarity index 100% rename from samples/OcelotServiceFabric/src/OcelotApplicationService/Properties/launchSettings.json rename to samples/ServiceFabric/DownstreamService/Properties/launchSettings.json diff --git a/samples/OcelotServiceFabric/src/OcelotApplicationService/ServiceEventSource.cs b/samples/ServiceFabric/DownstreamService/ServiceEventSource.cs similarity index 100% rename from samples/OcelotServiceFabric/src/OcelotApplicationService/ServiceEventSource.cs rename to samples/ServiceFabric/DownstreamService/ServiceEventSource.cs diff --git a/samples/OcelotServiceFabric/src/OcelotApplicationService/Startup.cs b/samples/ServiceFabric/DownstreamService/Startup.cs similarity index 100% rename from samples/OcelotServiceFabric/src/OcelotApplicationService/Startup.cs rename to samples/ServiceFabric/DownstreamService/Startup.cs diff --git a/samples/OcelotServiceFabric/LICENSE.md b/samples/ServiceFabric/LICENSE.md similarity index 100% rename from samples/OcelotServiceFabric/LICENSE.md rename to samples/ServiceFabric/LICENSE.md diff --git a/samples/OcelotServiceFabric/OcelotApplication/ApplicationManifest.xml b/samples/ServiceFabric/OcelotApplication/ApplicationManifest.xml similarity index 100% rename from samples/OcelotServiceFabric/OcelotApplication/ApplicationManifest.xml rename to samples/ServiceFabric/OcelotApplication/ApplicationManifest.xml diff --git a/samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/Code/entryPoint.cmd b/samples/ServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/Code/entryPoint.cmd similarity index 100% rename from samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/Code/entryPoint.cmd rename to samples/ServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/Code/entryPoint.cmd diff --git a/samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/Code/entryPoint.sh b/samples/ServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/Code/entryPoint.sh similarity index 100% rename from samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/Code/entryPoint.sh rename to samples/ServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/Code/entryPoint.sh diff --git a/samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/Config/Settings.xml b/samples/ServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/Config/Settings.xml similarity index 100% rename from samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/Config/Settings.xml rename to samples/ServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/Config/Settings.xml diff --git a/samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/Config/_readme.txt b/samples/ServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/Config/_readme.txt similarity index 100% rename from samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/Config/_readme.txt rename to samples/ServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/Config/_readme.txt diff --git a/samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/Data/_readme.txt b/samples/ServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/Data/_readme.txt similarity index 100% rename from samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/Data/_readme.txt rename to samples/ServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/Data/_readme.txt diff --git a/samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/ServiceManifest-Linux.xml b/samples/ServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/ServiceManifest-Linux.xml similarity index 100% rename from samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/ServiceManifest-Linux.xml rename to samples/ServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/ServiceManifest-Linux.xml diff --git a/samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/ServiceManifest-Windows.xml b/samples/ServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/ServiceManifest-Windows.xml similarity index 100% rename from samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/ServiceManifest-Windows.xml rename to samples/ServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/ServiceManifest-Windows.xml diff --git a/samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/ServiceManifest.xml b/samples/ServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/ServiceManifest.xml similarity index 100% rename from samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/ServiceManifest.xml rename to samples/ServiceFabric/OcelotApplication/OcelotApplicationApiGatewayPkg/ServiceManifest.xml diff --git a/samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationServicePkg/Code/entryPoint.cmd b/samples/ServiceFabric/OcelotApplication/OcelotApplicationServicePkg/Code/entryPoint.cmd similarity index 100% rename from samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationServicePkg/Code/entryPoint.cmd rename to samples/ServiceFabric/OcelotApplication/OcelotApplicationServicePkg/Code/entryPoint.cmd diff --git a/samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationServicePkg/Code/entryPoint.sh b/samples/ServiceFabric/OcelotApplication/OcelotApplicationServicePkg/Code/entryPoint.sh similarity index 100% rename from samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationServicePkg/Code/entryPoint.sh rename to samples/ServiceFabric/OcelotApplication/OcelotApplicationServicePkg/Code/entryPoint.sh diff --git a/samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationServicePkg/Config/Settings.xml b/samples/ServiceFabric/OcelotApplication/OcelotApplicationServicePkg/Config/Settings.xml similarity index 100% rename from samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationServicePkg/Config/Settings.xml rename to samples/ServiceFabric/OcelotApplication/OcelotApplicationServicePkg/Config/Settings.xml diff --git a/samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationServicePkg/Config/_readme.txt b/samples/ServiceFabric/OcelotApplication/OcelotApplicationServicePkg/Config/_readme.txt similarity index 100% rename from samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationServicePkg/Config/_readme.txt rename to samples/ServiceFabric/OcelotApplication/OcelotApplicationServicePkg/Config/_readme.txt diff --git a/samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationServicePkg/Data/_readme.txt b/samples/ServiceFabric/OcelotApplication/OcelotApplicationServicePkg/Data/_readme.txt similarity index 100% rename from samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationServicePkg/Data/_readme.txt rename to samples/ServiceFabric/OcelotApplication/OcelotApplicationServicePkg/Data/_readme.txt diff --git a/samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationServicePkg/ServiceManifest-Linux.xml b/samples/ServiceFabric/OcelotApplication/OcelotApplicationServicePkg/ServiceManifest-Linux.xml similarity index 100% rename from samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationServicePkg/ServiceManifest-Linux.xml rename to samples/ServiceFabric/OcelotApplication/OcelotApplicationServicePkg/ServiceManifest-Linux.xml diff --git a/samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationServicePkg/ServiceManifest-Windows.xml b/samples/ServiceFabric/OcelotApplication/OcelotApplicationServicePkg/ServiceManifest-Windows.xml similarity index 100% rename from samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationServicePkg/ServiceManifest-Windows.xml rename to samples/ServiceFabric/OcelotApplication/OcelotApplicationServicePkg/ServiceManifest-Windows.xml diff --git a/samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationServicePkg/ServiceManifest.xml b/samples/ServiceFabric/OcelotApplication/OcelotApplicationServicePkg/ServiceManifest.xml similarity index 100% rename from samples/OcelotServiceFabric/OcelotApplication/OcelotApplicationServicePkg/ServiceManifest.xml rename to samples/ServiceFabric/OcelotApplication/OcelotApplicationServicePkg/ServiceManifest.xml diff --git a/samples/OcelotServiceFabric/README.md b/samples/ServiceFabric/README.md similarity index 100% rename from samples/OcelotServiceFabric/README.md rename to samples/ServiceFabric/README.md diff --git a/samples/OcelotServiceFabric/build.bat b/samples/ServiceFabric/build.bat similarity index 100% rename from samples/OcelotServiceFabric/build.bat rename to samples/ServiceFabric/build.bat diff --git a/samples/OcelotServiceFabric/build.sh b/samples/ServiceFabric/build.sh similarity index 100% rename from samples/OcelotServiceFabric/build.sh rename to samples/ServiceFabric/build.sh diff --git a/samples/OcelotServiceFabric/dotnet-include.sh b/samples/ServiceFabric/dotnet-include.sh similarity index 100% rename from samples/OcelotServiceFabric/dotnet-include.sh rename to samples/ServiceFabric/dotnet-include.sh diff --git a/samples/OcelotServiceFabric/install.ps1 b/samples/ServiceFabric/install.ps1 similarity index 100% rename from samples/OcelotServiceFabric/install.ps1 rename to samples/ServiceFabric/install.ps1 diff --git a/samples/OcelotServiceFabric/install.sh b/samples/ServiceFabric/install.sh similarity index 100% rename from samples/OcelotServiceFabric/install.sh rename to samples/ServiceFabric/install.sh diff --git a/samples/OcelotServiceFabric/uninstall.ps1 b/samples/ServiceFabric/uninstall.ps1 similarity index 100% rename from samples/OcelotServiceFabric/uninstall.ps1 rename to samples/ServiceFabric/uninstall.ps1 diff --git a/samples/OcelotServiceFabric/uninstall.sh b/samples/ServiceFabric/uninstall.sh similarity index 100% rename from samples/OcelotServiceFabric/uninstall.sh rename to samples/ServiceFabric/uninstall.sh diff --git a/src/Ocelot.Provider.Polly/PollyQoSProviderBase.cs b/src/Ocelot.Provider.Polly/PollyQoSProviderBase.cs index 31ca23451..24760c800 100644 --- a/src/Ocelot.Provider.Polly/PollyQoSProviderBase.cs +++ b/src/Ocelot.Provider.Polly/PollyQoSProviderBase.cs @@ -5,8 +5,8 @@ namespace Ocelot.Provider.Polly; public abstract class PollyQoSProviderBase { - protected static readonly HashSet ServerErrorCodes = - [ + protected static readonly HashSet ServerErrorCodes = new() + { HttpStatusCode.InternalServerError, HttpStatusCode.NotImplemented, HttpStatusCode.BadGateway, @@ -16,7 +16,7 @@ public abstract class PollyQoSProviderBase HttpStatusCode.VariantAlsoNegotiates, HttpStatusCode.InsufficientStorage, HttpStatusCode.LoopDetected, - ]; + }; protected static string GetRouteName(DownstreamRoute route) => string.IsNullOrWhiteSpace(route.ServiceName) diff --git a/src/Ocelot.Provider.Polly/v7/PollyQoSProvider.cs b/src/Ocelot.Provider.Polly/v7/PollyQoSProvider.cs index 34f76aacb..51c727e80 100644 --- a/src/Ocelot.Provider.Polly/v7/PollyQoSProvider.cs +++ b/src/Ocelot.Provider.Polly/v7/PollyQoSProvider.cs @@ -10,7 +10,7 @@ namespace Ocelot.Provider.Polly.v7; [Obsolete("Due to new v8 policy definition in Polly 8 (use PollyQoSResiliencePipelineProvider)")] public class PollyQoSProvider : PollyQoSProviderBase, IPollyQoSProvider { - private readonly Dictionary> _policyWrappers = []; + private readonly Dictionary> _policyWrappers = new(); private readonly object _lockObject = new(); private readonly IOcelotLogger _logger; diff --git a/src/Ocelot/Configuration/AuthenticationOptions.cs b/src/Ocelot/Configuration/AuthenticationOptions.cs index af5cf7273..978a940a8 100644 --- a/src/Ocelot/Configuration/AuthenticationOptions.cs +++ b/src/Ocelot/Configuration/AuthenticationOptions.cs @@ -8,22 +8,21 @@ public AuthenticationOptions(List allowedScopes, string authenticationPr { AllowedScopes = allowedScopes; AuthenticationProviderKey = authenticationProviderKey; - AuthenticationProviderKeys = []; + AuthenticationProviderKeys = Array.Empty(); } public AuthenticationOptions(FileAuthenticationOptions from) { - AllowedScopes = from.AllowedScopes ?? []; + AllowedScopes = from.AllowedScopes ?? new(); AuthenticationProviderKey = from.AuthenticationProviderKey ?? string.Empty; - AuthenticationProviderKeys = from.AuthenticationProviderKeys ?? []; + AuthenticationProviderKeys = from.AuthenticationProviderKeys ?? Array.Empty(); } - public AuthenticationOptions(List allowedScopes, string authenticationProviderKey, - string[] authenticationProviderKeys) + public AuthenticationOptions(List allowedScopes, string authenticationProviderKey, string[] authenticationProviderKeys) { - AllowedScopes = allowedScopes ?? []; + AllowedScopes = allowedScopes ?? new(); AuthenticationProviderKey = authenticationProviderKey ?? string.Empty; - AuthenticationProviderKeys = authenticationProviderKeys ?? []; + AuthenticationProviderKeys = authenticationProviderKeys ?? Array.Empty(); } public List AllowedScopes { get; } diff --git a/src/Ocelot/Configuration/Builder/AuthenticationOptionsBuilder.cs b/src/Ocelot/Configuration/Builder/AuthenticationOptionsBuilder.cs index e911908c7..0b85ee809 100644 --- a/src/Ocelot/Configuration/Builder/AuthenticationOptionsBuilder.cs +++ b/src/Ocelot/Configuration/Builder/AuthenticationOptionsBuilder.cs @@ -4,7 +4,7 @@ public class AuthenticationOptionsBuilder { private List _allowedScopes = new(); private string _authenticationProviderKey; - private string[] _authenticationProviderKeys =[]; + private string[] _authenticationProviderKeys = Array.Empty(); public AuthenticationOptionsBuilder WithAllowedScopes(List allowedScopes) { diff --git a/src/Ocelot/Configuration/File/FileAuthenticationOptions.cs b/src/Ocelot/Configuration/File/FileAuthenticationOptions.cs index 24d9b787d..0dd93a9c6 100644 --- a/src/Ocelot/Configuration/File/FileAuthenticationOptions.cs +++ b/src/Ocelot/Configuration/File/FileAuthenticationOptions.cs @@ -4,13 +4,13 @@ public sealed class FileAuthenticationOptions { public FileAuthenticationOptions() { - AllowedScopes = []; - AuthenticationProviderKeys = []; + AllowedScopes = new(); + AuthenticationProviderKeys = Array.Empty(); } public FileAuthenticationOptions(FileAuthenticationOptions from) { - AllowedScopes = [..from.AllowedScopes]; + AllowedScopes = new(from.AllowedScopes); AuthenticationProviderKey = from.AuthenticationProviderKey; AuthenticationProviderKeys = from.AuthenticationProviderKeys; } diff --git a/src/Ocelot/LoadBalancer/LoadBalancers/LoadBalancerHouse.cs b/src/Ocelot/LoadBalancer/LoadBalancers/LoadBalancerHouse.cs index 4a3dc798f..dfa6279e6 100644 --- a/src/Ocelot/LoadBalancer/LoadBalancers/LoadBalancerHouse.cs +++ b/src/Ocelot/LoadBalancer/LoadBalancers/LoadBalancerHouse.cs @@ -1,4 +1,5 @@ using Ocelot.Configuration; +using Ocelot.Errors; using Ocelot.Responses; namespace Ocelot.LoadBalancer.LoadBalancers @@ -33,10 +34,10 @@ public Response Get(DownstreamRoute route, ServiceProviderConfigu } catch (Exception ex) { - return new ErrorResponse( - [ + return new ErrorResponse(new List() + { new UnableToFindLoadBalancerError($"Unable to find load balancer for '{route.LoadBalancerKey}'. Exception: {ex};"), - ]); + }); } } diff --git a/src/Ocelot/Middleware/HttpItemsExtensions.cs b/src/Ocelot/Middleware/HttpItemsExtensions.cs index d8d82ef9d..df97e0a19 100644 --- a/src/Ocelot/Middleware/HttpItemsExtensions.cs +++ b/src/Ocelot/Middleware/HttpItemsExtensions.cs @@ -56,7 +56,7 @@ public static IInternalConfiguration IInternalConfiguration(this IDictionary Errors(this IDictionary input) { var errors = input.Get>("Errors"); - return errors ?? []; + return errors ?? new(); } public static DownstreamRouteFinder.DownstreamRouteHolder diff --git a/src/Ocelot/Multiplexer/MultiplexingMiddleware.cs b/src/Ocelot/Multiplexer/MultiplexingMiddleware.cs index 731909006..17609dc18 100644 --- a/src/Ocelot/Multiplexer/MultiplexingMiddleware.cs +++ b/src/Ocelot/Multiplexer/MultiplexingMiddleware.cs @@ -104,7 +104,7 @@ private async Task ProcessRoutesAsync(HttpContext context, Route route) .Select(downstreamRoute => ProcessRouteAsync(context, downstreamRoute)) .ToArray(); var contexts = await Task.WhenAll(tasks); - await MapAsync(context, route, [.. contexts]); + await MapAsync(context, route, new(contexts)); } /// diff --git a/src/Ocelot/Request/Middleware/DownstreamRequestInitialiserMiddleware.cs b/src/Ocelot/Request/Middleware/DownstreamRequestInitialiserMiddleware.cs index 6440e3d46..f7da43960 100644 --- a/src/Ocelot/Request/Middleware/DownstreamRequestInitialiserMiddleware.cs +++ b/src/Ocelot/Request/Middleware/DownstreamRequestInitialiserMiddleware.cs @@ -35,7 +35,7 @@ public async Task Invoke(HttpContext httpContext) catch (Exception ex) { // TODO Review the error handling, we should throw an exception here and use the global error handler middleware to catch it - httpContext.Items.UpsertErrors([new UnmappableRequestError(ex)]); + httpContext.Items.SetError(new UnmappableRequestError(ex)); return; } diff --git a/src/Ocelot/Requester/MessageInvokerPool.cs b/src/Ocelot/Requester/MessageInvokerPool.cs index 32d9b5235..130b4bccb 100644 --- a/src/Ocelot/Requester/MessageInvokerPool.cs +++ b/src/Ocelot/Requester/MessageInvokerPool.cs @@ -6,11 +6,6 @@ namespace Ocelot.Requester; public class MessageInvokerPool : IMessageInvokerPool { - /// - /// TODO This should be configurable and available as global config parameter in ocelot.json. - /// - public const int DefaultRequestTimeoutSeconds = 90; - private readonly ConcurrentDictionary> _handlersPool; private readonly IDelegatingHandlerHandlerFactory _handlerFactory; private readonly IOcelotLogger _logger; @@ -37,6 +32,18 @@ public HttpMessageInvoker Get(DownstreamRoute downstreamRoute) public void Clear() => _handlersPool.Clear(); + /// + /// TODO This should be configurable and available as global config parameter in ocelot.json. + /// + public const int DefaultRequestTimeoutSeconds = 90; + private int _requestTimeoutSeconds; + + public int RequestTimeoutSeconds + { + get => _requestTimeoutSeconds > 0 ? _requestTimeoutSeconds : DefaultRequestTimeoutSeconds; + set => _requestTimeoutSeconds = value > 0 ? value : DefaultRequestTimeoutSeconds; + } + private HttpMessageInvoker CreateMessageInvoker(DownstreamRoute downstreamRoute) { var baseHandler = CreateHandler(downstreamRoute); @@ -52,7 +59,7 @@ private HttpMessageInvoker CreateMessageInvoker(DownstreamRoute downstreamRoute) // Adding timeout handler to the top of the chain. // It's standard behavior to throw TimeoutException after the defined timeout (90 seconds by default) var timeoutHandler = new TimeoutDelegatingHandler(downstreamRoute.QosOptions.TimeoutValue == 0 - ? TimeSpan.FromSeconds(DefaultRequestTimeoutSeconds) + ? TimeSpan.FromSeconds(RequestTimeoutSeconds) : TimeSpan.FromMilliseconds(downstreamRoute.QosOptions.TimeoutValue)) { InnerHandler = baseHandler, @@ -93,9 +100,14 @@ private HttpMessageHandler CreateHandler(DownstreamRoute downstreamRoute) return handler; } - private readonly struct MessageInvokerCacheKey(DownstreamRoute downstreamRoute) : IEquatable + private readonly struct MessageInvokerCacheKey : IEquatable { - public DownstreamRoute DownstreamRoute { get; } = downstreamRoute; + public MessageInvokerCacheKey(DownstreamRoute downstreamRoute) + { + DownstreamRoute = downstreamRoute; + } + + public DownstreamRoute DownstreamRoute { get; } public override bool Equals(object obj) => obj is MessageInvokerCacheKey key && Equals(key); diff --git a/test/Ocelot.AcceptanceTests/AggregateTests.cs b/test/Ocelot.AcceptanceTests/AggregateTests.cs index cd90b5f5a..daf3bdbfa 100644 --- a/test/Ocelot.AcceptanceTests/AggregateTests.cs +++ b/test/Ocelot.AcceptanceTests/AggregateTests.cs @@ -42,96 +42,86 @@ public void Should_fix_issue_597() var port = PortFinder.GetRandomPort(); var configuration = new FileConfiguration { - Routes = - [ + Routes = new() + { new FileRoute { DownstreamPathTemplate = "/api/values?MailId={userid}", UpstreamPathTemplate = "/key1data/{userid}", - UpstreamHttpMethod = ["Get"], + UpstreamHttpMethod = new() { "Get" }, DownstreamScheme = "http", - DownstreamHostAndPorts = - [ + DownstreamHostAndPorts = new() + { new FileHostAndPort { Host = "localhost", Port = port, }, - ], + }, Key = "key1", }, new FileRoute { DownstreamPathTemplate = "/api/values?MailId={userid}", UpstreamPathTemplate = "/key2data/{userid}", - UpstreamHttpMethod = ["Get"], + UpstreamHttpMethod = new() { "Get" }, DownstreamScheme = "http", - DownstreamHostAndPorts = - [ + DownstreamHostAndPorts = new() + { new FileHostAndPort { Host = "localhost", Port = port, }, - ], + }, Key = "key2", }, new FileRoute { DownstreamPathTemplate = "/api/values?MailId={userid}", UpstreamPathTemplate = "/key3data/{userid}", - UpstreamHttpMethod = ["Get"], + UpstreamHttpMethod = new() { "Get" }, DownstreamScheme = "http", - DownstreamHostAndPorts = - [ + DownstreamHostAndPorts = new() + { new FileHostAndPort { Host = "localhost", Port = port, }, - ], + }, Key = "key3", }, new FileRoute { DownstreamPathTemplate = "/api/values?MailId={userid}", UpstreamPathTemplate = "/key4data/{userid}", - UpstreamHttpMethod = ["Get"], + UpstreamHttpMethod = new() { "Get" }, DownstreamScheme = "http", - DownstreamHostAndPorts = - [ + DownstreamHostAndPorts = new() + { new FileHostAndPort { Host = "localhost", Port = port, }, - ], + }, Key = "key4", }, - ], - Aggregates = - [ + }, + Aggregates = new() + { new FileAggregateRoute { - RouteKeys = - [ - "key1", - "key2", - "key3", - "key4" - ], + RouteKeys = new() { "key1", "key2", "key3", "key4" }, UpstreamPathTemplate = "/EmpDetail/IN/{userid}", }, new FileAggregateRoute { - RouteKeys = - [ - "key1", - "key2" - ], + RouteKeys = new() { "key1", "key2" }, UpstreamPathTemplate = "/EmpDetail/US/{userid}", }, - ], + }, GlobalConfiguration = new FileGlobalConfiguration { RequestIdKey = "CorrelationID", @@ -157,78 +147,73 @@ public void Should_return_response_200_with_advanced_aggregate_configs() var port3 = PortFinder.GetRandomPort(); var configuration = new FileConfiguration { - Routes = - [ + Routes = new() + { new FileRoute { DownstreamPathTemplate = "/", DownstreamScheme = "http", - DownstreamHostAndPorts = - [ + DownstreamHostAndPorts = new() + { new FileHostAndPort { Host = "localhost", Port = port1, }, - ], + }, UpstreamPathTemplate = "/Comments", - UpstreamHttpMethod = ["Get"], + UpstreamHttpMethod = new() { "Get" }, Key = "Comments", }, new FileRoute { DownstreamPathTemplate = "/users/{userId}", DownstreamScheme = "http", - DownstreamHostAndPorts = - [ + DownstreamHostAndPorts = new() + { new FileHostAndPort { Host = "localhost", Port = port2, }, - ], + }, UpstreamPathTemplate = "/UserDetails/{userId}", - UpstreamHttpMethod = ["Get"], + UpstreamHttpMethod = new() { "Get" }, Key = "UserDetails", }, new FileRoute { DownstreamPathTemplate = "/posts/{postId}", DownstreamScheme = "http", - DownstreamHostAndPorts = - [ + DownstreamHostAndPorts = new() + { new FileHostAndPort { Host = "localhost", Port = port3, }, - ], + }, UpstreamPathTemplate = "/PostDetails/{postId}", - UpstreamHttpMethod = ["Get"], + UpstreamHttpMethod = new() { "Get" }, Key = "PostDetails", }, - ], - Aggregates = - [ + }, + Aggregates = new() + { new FileAggregateRoute { UpstreamPathTemplate = "/", UpstreamHost = "localhost", - RouteKeys = - [ - "Comments", - "UserDetails", - "PostDetails" - ], - RouteKeysConfig = - [ + RouteKeys = new() { "Comments", "UserDetails", "PostDetails" }, + RouteKeysConfig = new() + { new AggregateRouteConfig { RouteKey = "UserDetails", JsonPath = "$[*].writerId", Parameter = "userId" }, new AggregateRouteConfig { RouteKey = "PostDetails", JsonPath = "$[*].postId", Parameter = "postId" }, - ], + }, }, - ], + }, }; var userDetailsResponseContent = @"{""id"":1,""firstName"":""abolfazl"",""lastName"":""rajabpour""}"; @@ -255,22 +240,22 @@ public void Should_return_response_200_with_simple_url_user_defined_aggregate() var port2 = PortFinder.GetRandomPort(); var configuration = new FileConfiguration { - Routes = - [ + Routes = new() + { new FileRoute { DownstreamPathTemplate = "/", DownstreamScheme = "http", - DownstreamHostAndPorts = - [ + DownstreamHostAndPorts = new() + { new FileHostAndPort { Host = "localhost", Port = port1, }, - ], + }, UpstreamPathTemplate = "/laura", - UpstreamHttpMethod = ["Get"], + UpstreamHttpMethod = new() { "Get" }, Key = "Laura", }, @@ -278,33 +263,29 @@ public void Should_return_response_200_with_simple_url_user_defined_aggregate() { DownstreamPathTemplate = "/", DownstreamScheme = "http", - DownstreamHostAndPorts = - [ + DownstreamHostAndPorts = new() + { new FileHostAndPort { Host = "localhost", Port = port2, }, - ], + }, UpstreamPathTemplate = "/tom", - UpstreamHttpMethod = ["Get"], + UpstreamHttpMethod = new() { "Get" }, Key = "Tom", }, - ], - Aggregates = - [ + }, + Aggregates = new() + { new FileAggregateRoute { UpstreamPathTemplate = "/", UpstreamHost = "localhost", - RouteKeys = - [ - "Laura", - "Tom" - ], + RouteKeys = new() { "Laura", "Tom" }, Aggregator = "FakeDefinedAggregator", }, - ], + }, }; var expected = "Bye from Laura, Bye from Tom"; @@ -347,54 +328,50 @@ public void Should_return_response_200_with_simple_url_one_service_404() var port2 = PortFinder.GetRandomPort(); var configuration = new FileConfiguration { - Routes = - [ + Routes = new() + { new FileRoute { DownstreamPathTemplate = "/", DownstreamScheme = "http", - DownstreamHostAndPorts = - [ + DownstreamHostAndPorts = new() + { new FileHostAndPort { Host = "localhost", Port = port1, }, - ], + }, UpstreamPathTemplate = "/laura", - UpstreamHttpMethod = ["Get"], + UpstreamHttpMethod = new() { "Get" }, Key = "Laura", }, new FileRoute { DownstreamPathTemplate = "/", DownstreamScheme = "http", - DownstreamHostAndPorts = - [ + DownstreamHostAndPorts = new() + { new FileHostAndPort { Host = "localhost", Port = port2, }, - ], + }, UpstreamPathTemplate = "/tom", - UpstreamHttpMethod = ["Get"], + UpstreamHttpMethod = new() { "Get" }, Key = "Tom", }, - ], - Aggregates = - [ + }, + Aggregates = new() + { new FileAggregateRoute { UpstreamPathTemplate = "/", UpstreamHost = "localhost", - RouteKeys = - [ - "Laura", - "Tom" - ], + RouteKeys = new() { "Laura", "Tom" }, }, - ], + }, }; var expected = "{\"Laura\":,\"Tom\":{Hello from Tom}}"; @@ -417,54 +394,50 @@ public void Should_return_response_200_with_simple_url_both_service_404() var port2 = PortFinder.GetRandomPort(); var configuration = new FileConfiguration { - Routes = - [ + Routes = new() + { new FileRoute { DownstreamPathTemplate = "/", DownstreamScheme = "http", - DownstreamHostAndPorts = - [ + DownstreamHostAndPorts = new() + { new FileHostAndPort { Host = "localhost", Port = port1, }, - ], + }, UpstreamPathTemplate = "/laura", - UpstreamHttpMethod = ["Get"], + UpstreamHttpMethod = new() { "Get" }, Key = "Laura", }, new FileRoute { DownstreamPathTemplate = "/", DownstreamScheme = "http", - DownstreamHostAndPorts = - [ + DownstreamHostAndPorts = new() + { new FileHostAndPort { Host = "localhost", Port = port2, }, - ], + }, UpstreamPathTemplate = "/tom", - UpstreamHttpMethod = ["Get"], + UpstreamHttpMethod = new() { "Get" }, Key = "Tom", }, - ], - Aggregates = - [ + }, + Aggregates = new() + { new FileAggregateRoute { UpstreamPathTemplate = "/", UpstreamHost = "localhost", - RouteKeys = - [ - "Laura", - "Tom" - ], + RouteKeys = new() { "Laura", "Tom" }, }, - ], + }, }; var expected = "{\"Laura\":,\"Tom\":}"; @@ -487,54 +460,50 @@ public void Should_be_thread_safe() var port2 = PortFinder.GetRandomPort(); var configuration = new FileConfiguration { - Routes = - [ + Routes = new() + { new FileRoute { DownstreamPathTemplate = "/", DownstreamScheme = "http", - DownstreamHostAndPorts = - [ + DownstreamHostAndPorts = new() + { new FileHostAndPort { Host = "localhost", Port = port1, }, - ], + }, UpstreamPathTemplate = "/laura", - UpstreamHttpMethod = ["Get"], + UpstreamHttpMethod = new() { "Get" }, Key = "Laura", }, new FileRoute { DownstreamPathTemplate = "/", DownstreamScheme = "http", - DownstreamHostAndPorts = - [ + DownstreamHostAndPorts = new() + { new FileHostAndPort { Host = "localhost", Port = port2, }, - ], + }, UpstreamPathTemplate = "/tom", - UpstreamHttpMethod = ["Get"], + UpstreamHttpMethod = new() { "Get" }, Key = "Tom", }, - ], - Aggregates = - [ + }, + Aggregates = new() + { new FileAggregateRoute { UpstreamPathTemplate = "/", UpstreamHost = "localhost", - RouteKeys = - [ - "Laura", - "Tom" - ], + RouteKeys = new() { "Laura", "Tom" }, }, - ], + }, }; this.Given(x => x.GivenServiceIsRunning(0, port1, "/", 200, "{Hello from Laura}")) @@ -697,9 +666,9 @@ private void ThenTheDownstreamUrlPathShouldBe(string expectedDownstreamPathOne, { DownstreamPathTemplate = "/", DownstreamScheme = Uri.UriSchemeHttp, - DownstreamHostAndPorts = [new FileHostAndPort("localhost", port)], + DownstreamHostAndPorts = new() { new FileHostAndPort("localhost", port) }, UpstreamPathTemplate = upstream, - UpstreamHttpMethod = [HttpMethods.Get], + UpstreamHttpMethod = new() { HttpMethods.Get }, Key = key, }; diff --git a/test/Ocelot.AcceptanceTests/Authentication/AuthenticationSteps.cs b/test/Ocelot.AcceptanceTests/Authentication/AuthenticationSteps.cs index 0c2fb65fc..b9e626f00 100644 --- a/test/Ocelot.AcceptanceTests/Authentication/AuthenticationSteps.cs +++ b/test/Ocelot.AcceptanceTests/Authentication/AuthenticationSteps.cs @@ -57,7 +57,7 @@ protected static Client CreateClientWithSecret(string clientId, Secret secret, A protected static Client DefaultClient(AccessTokenType tokenType = AccessTokenType.Jwt, string[] apiScopes = null) { - apiScopes ??= ["api"]; + apiScopes ??= new string[] { "api" }; return new() { ClientId = "client", @@ -65,7 +65,7 @@ protected static Client DefaultClient(AccessTokenType tokenType = AccessTokenTyp ClientSecrets = new List { new("secret".Sha256()) }, AllowedScopes = apiScopes .Union(apiScopes.Select(x => $"{x}.readOnly")) - .Union(["openid", "offline_access"]) + .Union(new string[] { "openid", "offline_access" }) .ToList(), AccessTokenType = tokenType, Enabled = true, @@ -76,8 +76,8 @@ protected static Client DefaultClient(AccessTokenType tokenType = AccessTokenTyp public static IWebHostBuilder CreateIdentityServer(string url, AccessTokenType tokenType, string[] apiScopes, Client[] clients) { - apiScopes ??= ["api"]; - clients ??= [DefaultClient(tokenType, apiScopes)]; + apiScopes ??= new string[] { "api" }; + clients ??= new Client[] { DefaultClient(tokenType, apiScopes) }; var builder = new WebHostBuilder() .UseUrls(url) .UseKestrel() @@ -93,10 +93,10 @@ public static IWebHostBuilder CreateIdentityServer(string url, AccessTokenType t .Select(apiname => new ApiScope(apiname, apiname.ToUpper()))) .AddInMemoryApiResources(apiScopes .Select(x => new { i = Array.IndexOf(apiScopes, x), scope = x }) - .Select(x => CreateApiResource(x.scope, ["openid", "offline_access"]))) + .Select(x => CreateApiResource(x.scope, new string[] { "openid", "offline_access" }))) .AddInMemoryClients(clients) - .AddTestUsers( - [ + .AddTestUsers(new() + { new() { Username = "test", @@ -108,7 +108,7 @@ public static IWebHostBuilder CreateIdentityServer(string url, AccessTokenType t new("LocationId", "321"), }, }, - ]); + }); }) .Configure(app => { @@ -141,16 +141,16 @@ internal Task GivenAuthToken(string url, string apiScope, string cl public static FileRoute GivenDefaultAuthRoute(int port, string upstreamHttpMethod = null, string authProviderKey = null) => new() { DownstreamPathTemplate = "/", - DownstreamHostAndPorts = - [ - new("localhost", port), - ], + DownstreamHostAndPorts = new() + { + new("localhost", port), + }, DownstreamScheme = Uri.UriSchemeHttp, UpstreamPathTemplate = "/", - UpstreamHttpMethod = [upstreamHttpMethod ?? HttpMethods.Get], - AuthenticationOptions = new FileAuthenticationOptions + UpstreamHttpMethod = new() { upstreamHttpMethod ?? HttpMethods.Get }, + AuthenticationOptions = new() { - AuthenticationProviderKey = authProviderKey ?? "Test", + AuthenticationProviderKeys = new string[] { authProviderKey ?? "Test" }, }, }; diff --git a/test/Ocelot.AcceptanceTests/Authentication/AuthenticationTests.cs b/test/Ocelot.AcceptanceTests/Authentication/AuthenticationTests.cs index ea3e9ee3a..05a60e7e2 100644 --- a/test/Ocelot.AcceptanceTests/Authentication/AuthenticationTests.cs +++ b/test/Ocelot.AcceptanceTests/Authentication/AuthenticationTests.cs @@ -112,6 +112,7 @@ public void Should_return_201_using_identity_server_reference_token() .BDDfy(); } + [IgnorePublicMethod] public void GivenThereIsAnIdentityServerOn(string url, AccessTokenType tokenType) { var scopes = new string[] { "api", "api2" }; @@ -127,4 +128,11 @@ public override void Dispose() base.Dispose(); } } + + [AttributeUsage(AttributeTargets.Class)] + public sealed class IgnoreXunitAnalyzersRule1013Attribute : Attribute { } + + [IgnoreXunitAnalyzersRule1013] + [AttributeUsage(AttributeTargets.Method)] + public class IgnorePublicMethodAttribute : Attribute { } } diff --git a/test/Ocelot.AcceptanceTests/Authentication/MultipleAuthSchemesFeatureTests.cs b/test/Ocelot.AcceptanceTests/Authentication/MultipleAuthSchemesFeatureTests.cs index 204441497..f797431f9 100644 --- a/test/Ocelot.AcceptanceTests/Authentication/MultipleAuthSchemesFeatureTests.cs +++ b/test/Ocelot.AcceptanceTests/Authentication/MultipleAuthSchemesFeatureTests.cs @@ -19,9 +19,9 @@ public sealed class MultipleAuthSchemesFeatureTests : AuthenticationSteps, IDisp public MultipleAuthSchemesFeatureTests() : base() { - _identityServers = []; - _identityServerUrls = []; - _tokens = []; + _identityServers = Array.Empty(); + _identityServerUrls = Array.Empty(); + _tokens = Array.Empty(); } public override void Dispose() diff --git a/test/Ocelot.AcceptanceTests/Caching/CachingTests.cs b/test/Ocelot.AcceptanceTests/Caching/CachingTests.cs index 4eb8a5bf3..c61ce3864 100644 --- a/test/Ocelot.AcceptanceTests/Caching/CachingTests.cs +++ b/test/Ocelot.AcceptanceTests/Caching/CachingTests.cs @@ -154,21 +154,21 @@ public void Should_clean_cached_response_by_cache_header_via_new_caching_key() private static FileConfiguration GivenFileConfiguration(int port, FileCacheOptions cacheOptions) => new() { - Routes = - [ + Routes = new() + { new FileRoute() { DownstreamPathTemplate = "/", - DownstreamHostAndPorts = - [ + DownstreamHostAndPorts = new() + { new FileHostAndPort("localhost", port), - ], + }, DownstreamScheme = Uri.UriSchemeHttp, UpstreamPathTemplate = "/", - UpstreamHttpMethod =["Get"], + UpstreamHttpMethod = new() { HttpMethods.Get }, FileCacheOptions = cacheOptions, }, - ], + }, }; private static void GivenTheCacheExpires() diff --git a/test/Ocelot.AcceptanceTests/ContentTests.cs b/test/Ocelot.AcceptanceTests/ContentTests.cs index 5c64da21f..272dc5210 100644 --- a/test/Ocelot.AcceptanceTests/ContentTests.cs +++ b/test/Ocelot.AcceptanceTests/ContentTests.cs @@ -170,20 +170,20 @@ private static string GenerateDummyDatFile(int sizeInMb) private static FileConfiguration GivenConfiguration(int port, string method = null) => new() { - Routes = - [ + Routes = new() + { new FileRoute { DownstreamPathTemplate = "/", DownstreamScheme = Uri.UriSchemeHttp, - DownstreamHostAndPorts = - [ + DownstreamHostAndPorts = new() + { new FileHostAndPort("localhost", port), - ], + }, UpstreamPathTemplate = "/", - UpstreamHttpMethod = [method ?? HttpMethods.Get], + UpstreamHttpMethod = new() {method ?? HttpMethods.Get }, }, - ], + }, }; } } diff --git a/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj b/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj index bb1399943..701a23d67 100644 --- a/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj +++ b/test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj @@ -14,9 +14,9 @@ false false false - ..\..\codeanalysis.ruleset True - 1591 + ..\..\codeanalysis.ruleset + $(NoWarn);CS0618;CS1591 diff --git a/test/Ocelot.AcceptanceTests/PollyQoSTests.cs b/test/Ocelot.AcceptanceTests/PollyQoSTests.cs index 9697d2032..58481afa3 100644 --- a/test/Ocelot.AcceptanceTests/PollyQoSTests.cs +++ b/test/Ocelot.AcceptanceTests/PollyQoSTests.cs @@ -1,39 +1,44 @@ using Microsoft.AspNetCore.Http; using Ocelot.Configuration; using Ocelot.Configuration.File; +using Ocelot.Requester; +using System.Reflection; namespace Ocelot.AcceptanceTests { - public class PollyQoSTests : IDisposable + public sealed class PollyQoSTests : Steps, IDisposable { - private readonly Steps _steps; private readonly ServiceHandler _serviceHandler; public PollyQoSTests() { _serviceHandler = new ServiceHandler(); - _steps = new Steps(); + } + + public override void Dispose() + { + _serviceHandler.Dispose(); + base.Dispose(); } - private static FileConfiguration FileConfigurationFactory(int port, QoSOptions options, string httpMethod = nameof(HttpMethods.Get)) - => new() + private static FileConfiguration FileConfigurationFactory(int port, QoSOptions options, string httpMethod = nameof(HttpMethods.Get)) => new() + { + Routes = new() { - Routes = new List + new() { - new() + DownstreamPathTemplate = "/", + DownstreamScheme = Uri.UriSchemeHttp, + DownstreamHostAndPorts = new() { - DownstreamPathTemplate = "/", - DownstreamScheme = Uri.UriSchemeHttp, - DownstreamHostAndPorts = new() - { - new("localhost", port), - }, - UpstreamPathTemplate = "/", - UpstreamHttpMethod = new() {httpMethod}, - QoSOptions = new FileQoSOptions(options), + new("localhost", port), }, + UpstreamPathTemplate = "/", + UpstreamHttpMethod = new() {httpMethod}, + QoSOptions = new FileQoSOptions(options), }, - }; + }, + }; [Fact] public void Should_not_timeout() @@ -42,11 +47,11 @@ public void Should_not_timeout() var configuration = FileConfigurationFactory(port, new QoSOptions(10, 500, 1000, null), HttpMethods.Post); this.Given(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}", 200, string.Empty, 10)) - .And(x => _steps.GivenThereIsAConfiguration(configuration)) - .And(x => _steps.GivenOcelotIsRunningWithPolly()) - .And(x => _steps.GivenThePostHasContent("postContent")) - .When(x => _steps.WhenIPostUrlOnTheApiGateway("/")) - .Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK)) + .And(x => GivenThereIsAConfiguration(configuration)) + .And(x => GivenOcelotIsRunningWithPolly()) + .And(x => GivenThePostHasContent("postContent")) + .When(x => WhenIPostUrlOnTheApiGateway("/")) + .Then(x => ThenTheStatusCodeShouldBe(HttpStatusCode.OK)) .BDDfy(); } @@ -57,11 +62,11 @@ public void Should_timeout() var configuration = FileConfigurationFactory(port, new QoSOptions(0, 0, 1000, null), HttpMethods.Post); this.Given(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}", 201, string.Empty, 2100)) - .And(x => _steps.GivenThereIsAConfiguration(configuration)) - .And(x => _steps.GivenOcelotIsRunningWithPolly()) - .And(x => _steps.GivenThePostHasContent("postContent")) - .When(x => _steps.WhenIPostUrlOnTheApiGateway("/")) - .Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.ServiceUnavailable)) + .And(x => GivenThereIsAConfiguration(configuration)) + .And(x => GivenOcelotIsRunningWithPolly()) + .And(x => GivenThePostHasContent("postContent")) + .When(x => WhenIPostUrlOnTheApiGateway("/")) + .Then(x => ThenTheStatusCodeShouldBe(HttpStatusCode.ServiceUnavailable)) .BDDfy(); } @@ -72,12 +77,12 @@ public void Should_open_circuit_breaker_after_two_exceptions() var configuration = FileConfigurationFactory(port, new QoSOptions(2, 5000, 100000, null)); this.Given(x => x.GivenThereIsABrokenServiceRunningOn($"http://localhost:{port}")) - .And(x => _steps.GivenThereIsAConfiguration(configuration)) - .And(x => _steps.GivenOcelotIsRunningWithPolly()) - .And(x => _steps.WhenIGetUrlOnTheApiGateway("/")) - .And(x => _steps.WhenIGetUrlOnTheApiGateway("/")) - .And(x => _steps.WhenIGetUrlOnTheApiGateway("/")) - .Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.ServiceUnavailable)) + .And(x => GivenThereIsAConfiguration(configuration)) + .And(x => GivenOcelotIsRunningWithPolly()) + .And(x => WhenIGetUrlOnTheApiGateway("/")) + .And(x => WhenIGetUrlOnTheApiGateway("/")) + .And(x => WhenIGetUrlOnTheApiGateway("/")) + .Then(x => ThenTheStatusCodeShouldBe(HttpStatusCode.ServiceUnavailable)) .BDDfy(); } @@ -88,24 +93,24 @@ public void Should_open_circuit_breaker_then_close() var configuration = FileConfigurationFactory(port, new QoSOptions(2, 500, 1000, null)); this.Given(x => x.GivenThereIsAPossiblyBrokenServiceRunningOn($"http://localhost:{port}", "Hello from Laura")) - .Given(x => _steps.GivenThereIsAConfiguration(configuration)) - .Given(x => _steps.GivenOcelotIsRunningWithPolly()) - .When(x => _steps.WhenIGetUrlOnTheApiGateway("/")) - .Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK)) - .And(x => _steps.ThenTheResponseBodyShouldBe("Hello from Laura")) - .When(x => _steps.WhenIGetUrlOnTheApiGateway("/")) // repeat same request because min ExceptionsAllowedBeforeBreaking is 2 - .Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK)) - .And(x => _steps.ThenTheResponseBodyShouldBe("Hello from Laura")) - .Given(x => _steps.WhenIGetUrlOnTheApiGateway("/")) - .Given(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.ServiceUnavailable)) - .Given(x => _steps.WhenIGetUrlOnTheApiGateway("/")) - .Given(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.ServiceUnavailable)) - .Given(x => _steps.WhenIGetUrlOnTheApiGateway("/")) - .Given(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.ServiceUnavailable)) + .Given(x => GivenThereIsAConfiguration(configuration)) + .Given(x => GivenOcelotIsRunningWithPolly()) + .When(x => WhenIGetUrlOnTheApiGateway("/")) + .Then(x => ThenTheStatusCodeShouldBe(HttpStatusCode.OK)) + .And(x => ThenTheResponseBodyShouldBe("Hello from Laura")) + .When(x => WhenIGetUrlOnTheApiGateway("/")) // repeat same request because min ExceptionsAllowedBeforeBreaking is 2 + .Then(x => ThenTheStatusCodeShouldBe(HttpStatusCode.OK)) + .And(x => ThenTheResponseBodyShouldBe("Hello from Laura")) + .Given(x => WhenIGetUrlOnTheApiGateway("/")) + .Given(x => ThenTheStatusCodeShouldBe(HttpStatusCode.ServiceUnavailable)) + .Given(x => WhenIGetUrlOnTheApiGateway("/")) + .Given(x => ThenTheStatusCodeShouldBe(HttpStatusCode.ServiceUnavailable)) + .Given(x => WhenIGetUrlOnTheApiGateway("/")) + .Given(x => ThenTheStatusCodeShouldBe(HttpStatusCode.ServiceUnavailable)) .Given(x => GivenIWaitMilliseconds(3000)) - .When(x => _steps.WhenIGetUrlOnTheApiGateway("/")) - .Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK)) - .And(x => _steps.ThenTheResponseBodyShouldBe("Hello from Laura")) + .When(x => WhenIGetUrlOnTheApiGateway("/")) + .Then(x => ThenTheStatusCodeShouldBe(HttpStatusCode.OK)) + .And(x => ThenTheResponseBodyShouldBe("Hello from Laura")) .BDDfy(); } @@ -125,43 +130,55 @@ public void Open_circuit_should_not_effect_different_route() this.Given(x => x.GivenThereIsAPossiblyBrokenServiceRunningOn($"http://localhost:{port1}", "Hello from Laura")) .And(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port2}", 200, "Hello from Tom", 0)) - .And(x => _steps.GivenThereIsAConfiguration(configuration)) - .And(x => _steps.GivenOcelotIsRunningWithPolly()) - .And(x => _steps.WhenIGetUrlOnTheApiGateway("/")) - .And(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK)) - .And(x => _steps.ThenTheResponseBodyShouldBe("Hello from Laura")) - .And(x => _steps.WhenIGetUrlOnTheApiGateway("/")) // repeat same request because min ExceptionsAllowedBeforeBreaking is 2 - .And(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK)) - .And(x => _steps.ThenTheResponseBodyShouldBe("Hello from Laura")) - .And(x => _steps.WhenIGetUrlOnTheApiGateway("/")) - .And(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.ServiceUnavailable)) - .And(x => _steps.WhenIGetUrlOnTheApiGateway("/working")) - .And(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK)) - .And(x => _steps.ThenTheResponseBodyShouldBe("Hello from Tom")) - .And(x => _steps.WhenIGetUrlOnTheApiGateway("/")) - .And(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.ServiceUnavailable)) - .And(x => _steps.WhenIGetUrlOnTheApiGateway("/")) - .And(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.ServiceUnavailable)) + .And(x => GivenThereIsAConfiguration(configuration)) + .And(x => GivenOcelotIsRunningWithPolly()) + .And(x => WhenIGetUrlOnTheApiGateway("/")) + .And(x => ThenTheStatusCodeShouldBe(HttpStatusCode.OK)) + .And(x => ThenTheResponseBodyShouldBe("Hello from Laura")) + .And(x => WhenIGetUrlOnTheApiGateway("/")) // repeat same request because min ExceptionsAllowedBeforeBreaking is 2 + .And(x => ThenTheStatusCodeShouldBe(HttpStatusCode.OK)) + .And(x => ThenTheResponseBodyShouldBe("Hello from Laura")) + .And(x => WhenIGetUrlOnTheApiGateway("/")) + .And(x => ThenTheStatusCodeShouldBe(HttpStatusCode.ServiceUnavailable)) + .And(x => WhenIGetUrlOnTheApiGateway("/working")) + .And(x => ThenTheStatusCodeShouldBe(HttpStatusCode.OK)) + .And(x => ThenTheResponseBodyShouldBe("Hello from Tom")) + .And(x => WhenIGetUrlOnTheApiGateway("/")) + .And(x => ThenTheStatusCodeShouldBe(HttpStatusCode.ServiceUnavailable)) + .And(x => WhenIGetUrlOnTheApiGateway("/")) + .And(x => ThenTheStatusCodeShouldBe(HttpStatusCode.ServiceUnavailable)) .And(x => GivenIWaitMilliseconds(3000)) - .When(x => _steps.WhenIGetUrlOnTheApiGateway("/")) - .Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK)) - .And(x => _steps.ThenTheResponseBodyShouldBe("Hello from Laura")) + .When(x => WhenIGetUrlOnTheApiGateway("/")) + .Then(x => ThenTheStatusCodeShouldBe(HttpStatusCode.OK)) + .And(x => ThenTheResponseBodyShouldBe("Hello from Laura")) .BDDfy(); } [Fact] [Trait("Bug", "1833")] public void Should_timeout_per_default_after_90_seconds() - { + { + // Arrange var port = PortFinder.GetRandomPort(); - var configuration = FileConfigurationFactory(port, new QoSOptions(new FileQoSOptions()), HttpMethods.Get); - this.Given(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}", 201, string.Empty, 95000)) - .And(x => _steps.GivenThereIsAConfiguration(configuration)) - .And(x => _steps.GivenOcelotIsRunningWithPolly()) - .When(x => _steps.WhenIGetUrlOnTheApiGateway("/")) - .Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.ServiceUnavailable)) - .BDDfy(); - } + var configuration = FileConfigurationFactory(port, new QoSOptions(new FileQoSOptions()), HttpMethods.Get); + GivenThereIsAServiceRunningOn(DownstreamUrl(port), (int)HttpStatusCode.Created, string.Empty, 3500); // 3.5s > 3s -> ServiceUnavailable + GivenThereIsAConfiguration(configuration); + GivenOcelotIsRunningWithPolly(); + GivenIHackDefaultTimeoutValue(3); // after 3 secs -> Timeout exception aka request cancellation + + // Act + WhenIGetUrlOnTheApiGateway("/"); + + // Assert + ThenTheStatusCodeShouldBe(HttpStatusCode.ServiceUnavailable); + } + + private void GivenIHackDefaultTimeoutValue(int defaultTimeoutSeconds) + { + var field = typeof(MessageInvokerPool).GetField("_requestTimeoutSeconds", BindingFlags.NonPublic | BindingFlags.Instance); + var service = _ocelotServer.Services.GetService(typeof(IMessageInvokerPool)); + field.SetValue(service, defaultTimeoutSeconds); // hack the value of default 90 seconds + } private static void GivenIWaitMilliseconds(int ms) => Thread.Sleep(ms); @@ -206,12 +223,5 @@ private void GivenThereIsAServiceRunningOn(string url, int statusCode, string re await context.Response.WriteAsync(responseBody); }); } - - public void Dispose() - { - _serviceHandler?.Dispose(); - _steps.Dispose(); - GC.SuppressFinalize(this); - } } } diff --git a/test/Ocelot.AcceptanceTests/Request/RequestMapperTests.cs b/test/Ocelot.AcceptanceTests/Request/RequestMapperTests.cs index b5c69b006..ea93d6d8c 100644 --- a/test/Ocelot.AcceptanceTests/Request/RequestMapperTests.cs +++ b/test/Ocelot.AcceptanceTests/Request/RequestMapperTests.cs @@ -117,12 +117,12 @@ private void GivenThereIsAServiceRunningOn(string baseUrl, string basePath, Http { DownstreamPathTemplate = "/", DownstreamScheme = Uri.UriSchemeHttp, - DownstreamHostAndPorts = - [ + DownstreamHostAndPorts = new() + { new("localhost", port), - ], + }, UpstreamPathTemplate = "/", - UpstreamHttpMethod = [method ?? HttpMethods.Get], + UpstreamHttpMethod = new() { method ?? HttpMethods.Get }, }; } diff --git a/test/Ocelot.AcceptanceTests/Request/StreamContentTests.cs b/test/Ocelot.AcceptanceTests/Request/StreamContentTests.cs index 5c20c53e1..1e97a36d1 100644 --- a/test/Ocelot.AcceptanceTests/Request/StreamContentTests.cs +++ b/test/Ocelot.AcceptanceTests/Request/StreamContentTests.cs @@ -86,22 +86,31 @@ static void options(KestrelServerOptions o) { DownstreamPathTemplate = "/", DownstreamScheme = Uri.UriSchemeHttp, - DownstreamHostAndPorts = - [ + DownstreamHostAndPorts = new() + { new("localhost", port), - ], + }, UpstreamPathTemplate = "/", - UpstreamHttpMethod = [method ?? HttpMethods.Get], + UpstreamHttpMethod = new() { method ?? HttpMethods.Get }, }; } -internal class StreamTestContent(long size, bool sendChunked) : HttpContent +internal class StreamTestContent : HttpContent { - private readonly byte[] _dataBuffer = RandomNumberGenerator.GetBytes(8192); + private readonly long _size; + private readonly bool _sendChunked; + private readonly byte[] _dataBuffer; + + public StreamTestContent(long size, bool sendChunked) + { + _size = size; + _sendChunked = sendChunked; + _dataBuffer = RandomNumberGenerator.GetBytes(8192); + } protected override async Task SerializeToStreamAsync(Stream stream, TransportContext context) { - var remaining = size; + var remaining = _size; while (remaining > 0) { var count = (int)Math.Min(remaining, _dataBuffer.Length); @@ -112,14 +121,14 @@ protected override async Task SerializeToStreamAsync(Stream stream, TransportCon protected override bool TryComputeLength(out long length) { - if (sendChunked) + if (_sendChunked) { length = -1; return false; } else { - length = size; + length = _size; return true; } } diff --git a/test/Ocelot.AcceptanceTests/Requester/PayloadTooLargeTests.cs b/test/Ocelot.AcceptanceTests/Requester/PayloadTooLargeTests.cs index 35c789143..fdb5741ed 100644 --- a/test/Ocelot.AcceptanceTests/Requester/PayloadTooLargeTests.cs +++ b/test/Ocelot.AcceptanceTests/Requester/PayloadTooLargeTests.cs @@ -71,13 +71,13 @@ public void Should_throw_payload_too_large_exception_using_http_sys() private static FileRoute GivenRoute(int port, string method = null) => new() { DownstreamPathTemplate = "/", - DownstreamHostAndPorts = - [ + DownstreamHostAndPorts = new() + { new("localhost", port), - ], + }, DownstreamScheme = Uri.UriSchemeHttp, UpstreamPathTemplate = "/", - UpstreamHttpMethod = [method ?? HttpMethods.Get], + UpstreamHttpMethod = new() {method ?? HttpMethods.Get }, }; private void GivenThereIsAServiceRunningOn(string baseUrl) diff --git a/test/Ocelot.AcceptanceTests/RoutingTests.cs b/test/Ocelot.AcceptanceTests/RoutingTests.cs index 6470d365c..b881a831f 100644 --- a/test/Ocelot.AcceptanceTests/RoutingTests.cs +++ b/test/Ocelot.AcceptanceTests/RoutingTests.cs @@ -1210,7 +1210,7 @@ internal void ThenTheDownstreamUrlQueryStringShouldBe(string expectedQueryString new("localhost", port), }, UpstreamPathTemplate = upstream, - UpstreamHttpMethod = [HttpMethods.Get], + UpstreamHttpMethod = new() { HttpMethods.Get }, }, }, }; diff --git a/test/Ocelot.AcceptanceTests/ServiceDiscoveryTests.cs b/test/Ocelot.AcceptanceTests/ServiceDiscoveryTests.cs index c37333cf2..7ba087e55 100644 --- a/test/Ocelot.AcceptanceTests/ServiceDiscoveryTests.cs +++ b/test/Ocelot.AcceptanceTests/ServiceDiscoveryTests.cs @@ -497,7 +497,7 @@ public void Should_use_consul_service_discovery_based_on_upstream_host(string lo Address = "localhost", Port = servicePortUS, ID = Guid.NewGuid().ToString(), - Tags = ["US"], + Tags = new string[] { "US" }, }, }; var serviceEntryEU = new ServiceEntry @@ -508,20 +508,20 @@ public void Should_use_consul_service_discovery_based_on_upstream_host(string lo Address = "localhost", Port = servicePortEU, ID = Guid.NewGuid().ToString(), - Tags = ["EU"], + Tags = new string[] { "EU" }, }, }; var configuration = new FileConfiguration { - Routes = - [ + Routes = new() + { new() { DownstreamPathTemplate = "/products", DownstreamScheme = "http", UpstreamPathTemplate = "/", - UpstreamHttpMethod = ["Get"], + UpstreamHttpMethod = new() { "Get" }, UpstreamHost = upstreamHostUS, ServiceName = serviceNameUS, LoadBalancerOptions = new() { Type = loadBalancerType }, @@ -531,12 +531,12 @@ public void Should_use_consul_service_discovery_based_on_upstream_host(string lo DownstreamPathTemplate = "/products", DownstreamScheme = "http", UpstreamPathTemplate = "/", - UpstreamHttpMethod = ["Get"], + UpstreamHttpMethod = new() {"Get" }, UpstreamHost = upstreamHostEU, ServiceName = serviceNameEU, LoadBalancerOptions = new() { Type = loadBalancerType }, }, - ], + }, GlobalConfiguration = new() { ServiceDiscoveryProvider = new() diff --git a/test/Ocelot.AcceptanceTests/ServiceFabricTests.cs b/test/Ocelot.AcceptanceTests/ServiceFabricTests.cs index ec952bd42..20db1ed4a 100644 --- a/test/Ocelot.AcceptanceTests/ServiceFabricTests.cs +++ b/test/Ocelot.AcceptanceTests/ServiceFabricTests.cs @@ -142,14 +142,14 @@ public void should_support_placeholder_in_service_fabric_service_name(string ups var configuration = new FileConfiguration { - Routes = new List + Routes = new() { new() { DownstreamPathTemplate = downstream, - DownstreamScheme = "http", + DownstreamScheme = Uri.UriSchemeHttp, UpstreamPathTemplate = upstream, - UpstreamHttpMethod = ["Get"], + UpstreamHttpMethod = new() { HttpMethods.Get }, ServiceName = serviceName, }, }, diff --git a/test/Ocelot.AcceptanceTests/Steps.cs b/test/Ocelot.AcceptanceTests/Steps.cs index fe4b2bc7f..7f95a8a9d 100644 --- a/test/Ocelot.AcceptanceTests/Steps.cs +++ b/test/Ocelot.AcceptanceTests/Steps.cs @@ -804,35 +804,8 @@ public void GivenOcelotIsRunningWithEureka() _ocelotClient = _ocelotServer.CreateClient(); } - public void GivenOcelotIsRunningWithPolly() - { - _webHostBuilder = new WebHostBuilder(); - - _webHostBuilder - .ConfigureAppConfiguration((hostingContext, config) => - { - config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath); - var env = hostingContext.HostingEnvironment; - config.AddJsonFile("appsettings.json", true, false) - .AddJsonFile($"appsettings.{env.EnvironmentName}.json", true, false); - config.AddJsonFile(_ocelotConfigFileName, false, false); - config.AddEnvironmentVariables(); - }) - .ConfigureServices(s => - { - s.AddOcelot() - .AddPolly(); - }) - .Configure(app => - { - app.UseOcelot() - .Wait(); - }); - - _ocelotServer = new TestServer(_webHostBuilder); - - _ocelotClient = _ocelotServer.CreateClient(); - } + public void GivenOcelotIsRunningWithPolly() => GivenOcelotIsRunningWithServices(WithPolly); + public static void WithPolly(IServiceCollection services) => services.AddOcelot().AddPolly(); public void WhenIGetUrlOnTheApiGateway(string url) { diff --git a/test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj b/test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj index bcaf49e12..288d79019 100644 --- a/test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj +++ b/test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj @@ -13,9 +13,9 @@ false false false - ..\..\codeanalysis.ruleset True - 1591 + ..\..\codeanalysis.ruleset + $(NoWarn);CS0618;CS1591 diff --git a/test/Ocelot.Benchmarks/PayloadBenchmarks.cs b/test/Ocelot.Benchmarks/PayloadBenchmarks.cs index 7547ad921..fe776f0ea 100644 --- a/test/Ocelot.Benchmarks/PayloadBenchmarks.cs +++ b/test/Ocelot.Benchmarks/PayloadBenchmarks.cs @@ -38,20 +38,20 @@ public void SetUp() { var configuration = new FileConfiguration { - Routes = - [ + Routes = new() + { new FileRoute { DownstreamPathTemplate = "/", - DownstreamHostAndPorts = - [ + DownstreamHostAndPorts = new() + { new FileHostAndPort("localhost", 51879), - ], + }, DownstreamScheme = "http", UpstreamPathTemplate = "/", - UpstreamHttpMethod =["Post"], + UpstreamHttpMethod = new() { "Post" }, }, - ], + }, }; GivenThereIsAServiceRunningOn("http://localhost:51879", "/", 201); @@ -113,12 +113,12 @@ private static object[] GeneratePayload(int size, string directory, string fileN { var filePath = Path.Combine(directory, fileName); var generateDummy = isJson ? (Func) GenerateDummyJsonFile : GenerateDummyDatFile; - return - [ + return new object[] + { generateDummy(size, filePath), fileName, isJson, - ]; + }; } /// diff --git a/test/Ocelot.Benchmarks/ResponseBenchmarks.cs b/test/Ocelot.Benchmarks/ResponseBenchmarks.cs index f68ecb254..a7c1d85b7 100644 --- a/test/Ocelot.Benchmarks/ResponseBenchmarks.cs +++ b/test/Ocelot.Benchmarks/ResponseBenchmarks.cs @@ -41,20 +41,20 @@ public void SetUp() { var configuration = new FileConfiguration { - Routes = - [ + Routes = new() + { new FileRoute { DownstreamPathTemplate = "/", - DownstreamHostAndPorts = - [ + DownstreamHostAndPorts = new() + { new FileHostAndPort("localhost", 51879), - ], - DownstreamScheme = "http", + }, + DownstreamScheme = Uri.UriSchemeHttp, UpstreamPathTemplate = "/", - UpstreamHttpMethod =["GET"], + UpstreamHttpMethod = new() { HttpMethods.Get }, }, - ], + }, }; GivenThereIsAServiceRunningOn("http://localhost:51879", "/", 201); @@ -115,12 +115,12 @@ private static object[] GeneratePayload(int size, string directory, string fileN { var filePath = Path.Combine(directory, fileName); var generateDummy = isJson ? (Func)GenerateDummyJsonFile : GenerateDummyDatFile; - return - [ + return new object[] + { generateDummy(size, filePath), fileName, isJson, - ]; + }; } /// diff --git a/test/Ocelot.IntegrationTests/Ocelot.IntegrationTests.csproj b/test/Ocelot.IntegrationTests/Ocelot.IntegrationTests.csproj index 996603c55..857f2c0b5 100644 --- a/test/Ocelot.IntegrationTests/Ocelot.IntegrationTests.csproj +++ b/test/Ocelot.IntegrationTests/Ocelot.IntegrationTests.csproj @@ -14,9 +14,9 @@ false false false - ..\..\codeanalysis.ruleset True - 1591 + ..\..\codeanalysis.ruleset + $(NoWarn);CS0618;CS1591 diff --git a/samples/Docker/Dockerfile b/test/Ocelot.ManualTest/Dockerfile similarity index 98% rename from samples/Docker/Dockerfile rename to test/Ocelot.ManualTest/Dockerfile index dad54b20f..31b4580b3 100644 --- a/samples/Docker/Dockerfile +++ b/test/Ocelot.ManualTest/Dockerfile @@ -1,47 +1,47 @@ -#This is the base image used for any ran images -FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base -WORKDIR /app -EXPOSE 80 - -#This image is used to build the source for the runnable app -#It can also be used to run other CLI commands on the project, such as packing/deploying nuget packages. Some examples: -#Run tests: docker build --target builder -t ocelot-build . && docker run ocelot-build test --logger:trx;LogFileName=results.trx -#Run benchmarks: docker build --target builder --build-arg build_configuration=Release -t ocelot-build . && docker run ocelot-build run -c Release --project test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj -FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS builder -WORKDIR /build -#First we add only the project files so that we can cache nuget packages with dotnet restore -COPY Ocelot.sln Ocelot.sln -COPY src/Ocelot/Ocelot.csproj src/Ocelot/Ocelot.csproj -COPY src/Ocelot.Administration/Ocelot.Administration.csproj src/Ocelot.Administration/Ocelot.Administration.csproj -COPY src/Ocelot.Cache.CacheManager/Ocelot.Cache.CacheManager.csproj src/Ocelot.Cache.CacheManager/Ocelot.Cache.CacheManager.csproj -COPY src/Ocelot.Provider.Consul/Ocelot.Provider.Consul.csproj src/Ocelot.Provider.Consul/Ocelot.Provider.Consul.csproj -COPY src/Ocelot.Provider.Eureka/Ocelot.Provider.Eureka.csproj src/Ocelot.Provider.Eureka/Ocelot.Provider.Eureka.csproj -COPY src/Ocelot.Provider.Polly/Ocelot.Provider.Polly.csproj src/Ocelot.Provider.Polly/Ocelot.Provider.Polly.csproj -COPY src/Ocelot.Tracing.Butterfly/Ocelot.Tracing.Butterfly.csproj src/Ocelot.Tracing.Butterfly/Ocelot.Tracing.Butterfly.csproj -COPY src/Ocelot.Provider.Kubernetes/Ocelot.Provider.Kubernetes.csproj src/Ocelot.Provider.Kubernetes/Ocelot.Provider.Kubernetes.csproj -COPY test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj -COPY test/Ocelot.ManualTest/Ocelot.ManualTest.csproj test/Ocelot.ManualTest/Ocelot.ManualTest.csproj -COPY test/Ocelot.IntegrationTests/Ocelot.IntegrationTests.csproj test/Ocelot.IntegrationTests/Ocelot.IntegrationTests.csproj -COPY test/Ocelot.UnitTests/Ocelot.UnitTests.csproj test/Ocelot.UnitTests/Ocelot.UnitTests.csproj -COPY test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj - -RUN dotnet restore -#Now we add the rest of the source and run a complete build... --no-restore is used because nuget should be resolved at this point -COPY codeanalysis.ruleset codeanalysis.ruleset -COPY src src -COPY test test -ARG build_configuration=Debug -RUN dotnet build --no-restore -c ${build_configuration} -ENTRYPOINT ["dotnet"] - -#This is just for holding the published manual tests... -FROM builder AS manual-test-publish -ARG build_configuration=Debug -RUN dotnet publish --no-build -c ${build_configuration} -o /app test/Ocelot.ManualTest - -#Run manual tests! This is the default run option. -#docker build -t ocelot-manual-test . && docker run --net host ocelot-manual-test -FROM base AS manual-test -ENV ASPNETCORE_ENVIRONMENT=Development -COPY --from=manual-test-publish /app . -ENTRYPOINT ["dotnet", "Ocelot.ManualTest.dll"] +#This is the base image used for any ran images +FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base +WORKDIR /app +EXPOSE 80 + +#This image is used to build the source for the runnable app +#It can also be used to run other CLI commands on the project, such as packing/deploying nuget packages. Some examples: +#Run tests: docker build --target builder -t ocelot-build . && docker run ocelot-build test --logger:trx;LogFileName=results.trx +#Run benchmarks: docker build --target builder --build-arg build_configuration=Release -t ocelot-build . && docker run ocelot-build run -c Release --project test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj +FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS builder +WORKDIR /build +#First we add only the project files so that we can cache nuget packages with dotnet restore +COPY Ocelot.sln Ocelot.sln +COPY src/Ocelot/Ocelot.csproj src/Ocelot/Ocelot.csproj +COPY src/Ocelot.Administration/Ocelot.Administration.csproj src/Ocelot.Administration/Ocelot.Administration.csproj +COPY src/Ocelot.Cache.CacheManager/Ocelot.Cache.CacheManager.csproj src/Ocelot.Cache.CacheManager/Ocelot.Cache.CacheManager.csproj +COPY src/Ocelot.Provider.Consul/Ocelot.Provider.Consul.csproj src/Ocelot.Provider.Consul/Ocelot.Provider.Consul.csproj +COPY src/Ocelot.Provider.Eureka/Ocelot.Provider.Eureka.csproj src/Ocelot.Provider.Eureka/Ocelot.Provider.Eureka.csproj +COPY src/Ocelot.Provider.Polly/Ocelot.Provider.Polly.csproj src/Ocelot.Provider.Polly/Ocelot.Provider.Polly.csproj +COPY src/Ocelot.Tracing.Butterfly/Ocelot.Tracing.Butterfly.csproj src/Ocelot.Tracing.Butterfly/Ocelot.Tracing.Butterfly.csproj +COPY src/Ocelot.Provider.Kubernetes/Ocelot.Provider.Kubernetes.csproj src/Ocelot.Provider.Kubernetes/Ocelot.Provider.Kubernetes.csproj +COPY test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj test/Ocelot.AcceptanceTests/Ocelot.AcceptanceTests.csproj +COPY test/Ocelot.ManualTest/Ocelot.ManualTest.csproj test/Ocelot.ManualTest/Ocelot.ManualTest.csproj +COPY test/Ocelot.IntegrationTests/Ocelot.IntegrationTests.csproj test/Ocelot.IntegrationTests/Ocelot.IntegrationTests.csproj +COPY test/Ocelot.UnitTests/Ocelot.UnitTests.csproj test/Ocelot.UnitTests/Ocelot.UnitTests.csproj +COPY test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj + +RUN dotnet restore +#Now we add the rest of the source and run a complete build... --no-restore is used because nuget should be resolved at this point +COPY codeanalysis.ruleset codeanalysis.ruleset +COPY src src +COPY test test +ARG build_configuration=Debug +RUN dotnet build --no-restore -c ${build_configuration} +ENTRYPOINT ["dotnet"] + +#This is just for holding the published manual tests... +FROM builder AS manual-test-publish +ARG build_configuration=Debug +RUN dotnet publish --no-build -c ${build_configuration} -o /app test/Ocelot.ManualTest + +#Run manual tests! This is the default run option. +#docker build -t ocelot-manual-test . && docker run --net host ocelot-manual-test +FROM base AS manual-test +ENV ASPNETCORE_ENVIRONMENT=Development +COPY --from=manual-test-publish /app . +ENTRYPOINT ["dotnet", "Ocelot.ManualTest.dll"] diff --git a/test/Ocelot.ManualTest/Ocelot.ManualTest.csproj b/test/Ocelot.ManualTest/Ocelot.ManualTest.csproj index 81aabb2f1..919f6b913 100644 --- a/test/Ocelot.ManualTest/Ocelot.ManualTest.csproj +++ b/test/Ocelot.ManualTest/Ocelot.ManualTest.csproj @@ -9,9 +9,9 @@ Exe Ocelot.ManualTest win-x64;osx-x64 - ..\..\codeanalysis.ruleset True - 1591 + ..\..\codeanalysis.ruleset + $(NoWarn);CS0618;CS1591 diff --git a/samples/Docker-Compose/docker-compose.yaml b/test/Ocelot.ManualTest/docker-compose.yaml similarity index 95% rename from samples/Docker-Compose/docker-compose.yaml rename to test/Ocelot.ManualTest/docker-compose.yaml index 5236202fd..831368441 100644 --- a/samples/Docker-Compose/docker-compose.yaml +++ b/test/Ocelot.ManualTest/docker-compose.yaml @@ -1,24 +1,24 @@ -version: "3.4" -services: - - tests: - build: - context: . - target: builder - volumes: - - type: bind - source: . - target: /results - command: test --logger:trx -r /results - - benchmarks: - build: - context: . - target: builder - args: - build_configuration: Release - command: run -c Release --project test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj 0 1 2 3 4 - - manual-test: - build: . - ports: [ "5000:80" ] +version: "3.4" +services: + + tests: + build: + context: . + target: builder + volumes: + - type: bind + source: . + target: /results + command: test --logger:trx -r /results + + benchmarks: + build: + context: . + target: builder + args: + build_configuration: Release + command: run -c Release --project test/Ocelot.Benchmarks/Ocelot.Benchmarks.csproj 0 1 2 3 4 + + manual-test: + build: . + ports: [ "5000:80" ] diff --git a/test/Ocelot.UnitTests/Administration/OcelotAdministrationBuilderTests.cs b/test/Ocelot.UnitTests/Administration/OcelotAdministrationBuilderTests.cs index 838c6f239..15c827662 100644 --- a/test/Ocelot.UnitTests/Administration/OcelotAdministrationBuilderTests.cs +++ b/test/Ocelot.UnitTests/Administration/OcelotAdministrationBuilderTests.cs @@ -8,7 +8,7 @@ namespace Ocelot.UnitTests.Administration { - public class OcelotAdministrationBuilderTests + public class OcelotAdministrationBuilderTests : UnitTest { private readonly IServiceCollection _services; private IServiceProvider _serviceProvider; @@ -22,7 +22,7 @@ public OcelotAdministrationBuilderTests() _services = new ServiceCollection(); _services.AddSingleton(GetHostingEnvironment()); _services.AddSingleton(_configRoot); - } + } private static IWebHostEnvironment GetHostingEnvironment() { diff --git a/test/Ocelot.UnitTests/Authentication/AuthenticationMiddlewareTests.cs b/test/Ocelot.UnitTests/Authentication/AuthenticationMiddlewareTests.cs index 2201722eb..0bd9eb603 100644 --- a/test/Ocelot.UnitTests/Authentication/AuthenticationMiddlewareTests.cs +++ b/test/Ocelot.UnitTests/Authentication/AuthenticationMiddlewareTests.cs @@ -12,7 +12,7 @@ namespace Ocelot.UnitTests.Authentication { - public class AuthenticationMiddlewareTests + public class AuthenticationMiddlewareTests : UnitTest { private readonly Mock _authentication; private readonly Mock _factory; @@ -121,7 +121,7 @@ public void Should_provide_backward_compatibility_if_route_has_several_options_a { var options = new AuthenticationOptions(null, "Test", - [string.Empty, "Fail", "Test"] + new string[] { string.Empty, "Fail", "Test" } ); var methods = new List { "Get" }; this.Given(x => GivenTheDownStreamRouteIs(new DownstreamRouteBuilder() @@ -143,7 +143,7 @@ public void Should_provide_backward_compatibility_if_route_has_several_options_a public void Should_not_call_next_middleware_and_return_no_result_if_all_multiple_keys_were_failed() { var options = new AuthenticationOptions(null, null, - [string.Empty, "Fail", "Fail", "UnknownScheme"] + new string[] { string.Empty, "Fail", "Fail", "UnknownScheme" } ); var methods = new List { "Get" }; diff --git a/test/Ocelot.UnitTests/Authorization/AuthorizationMiddlewareTests.cs b/test/Ocelot.UnitTests/Authorization/AuthorizationMiddlewareTests.cs index 045257e32..717de3daf 100644 --- a/test/Ocelot.UnitTests/Authorization/AuthorizationMiddlewareTests.cs +++ b/test/Ocelot.UnitTests/Authorization/AuthorizationMiddlewareTests.cs @@ -11,7 +11,7 @@ namespace Ocelot.UnitTests.Authorization { - public class AuthorizationMiddlewareTests + public class AuthorizationMiddlewareTests : UnitTest { private readonly Mock _authService; private readonly Mock _authScopesService; diff --git a/test/Ocelot.UnitTests/Authorization/ClaimsAuthorizerTests.cs b/test/Ocelot.UnitTests/Authorization/ClaimsAuthorizerTests.cs index 45865a456..6033d0a7a 100644 --- a/test/Ocelot.UnitTests/Authorization/ClaimsAuthorizerTests.cs +++ b/test/Ocelot.UnitTests/Authorization/ClaimsAuthorizerTests.cs @@ -6,7 +6,7 @@ namespace Ocelot.UnitTests.Authorization { - public class ClaimsAuthorizerTests + public class ClaimsAuthorizerTests : UnitTest { private readonly ClaimsAuthorizer _claimsAuthorizer; private ClaimsPrincipal _claimsPrincipal; diff --git a/test/Ocelot.UnitTests/Cache/AspMemoryCacheTests.cs b/test/Ocelot.UnitTests/Cache/AspMemoryCacheTests.cs index 573c076ce..69cda7c8d 100644 --- a/test/Ocelot.UnitTests/Cache/AspMemoryCacheTests.cs +++ b/test/Ocelot.UnitTests/Cache/AspMemoryCacheTests.cs @@ -3,7 +3,7 @@ namespace Ocelot.UnitTests.Cache { - public class AspMemoryCacheTests + public class AspMemoryCacheTests : UnitTest { private readonly AspMemoryCache _cache; diff --git a/test/Ocelot.UnitTests/Cache/DefaultCacheKeyGeneratorTests.cs b/test/Ocelot.UnitTests/Cache/DefaultCacheKeyGeneratorTests.cs index a81ec7d07..be9de81e8 100644 --- a/test/Ocelot.UnitTests/Cache/DefaultCacheKeyGeneratorTests.cs +++ b/test/Ocelot.UnitTests/Cache/DefaultCacheKeyGeneratorTests.cs @@ -7,7 +7,7 @@ namespace Ocelot.UnitTests.Cache; -public sealed class DefaultCacheKeyGeneratorTests : IDisposable +public sealed class DefaultCacheKeyGeneratorTests : UnitTest, IDisposable { private readonly ICacheKeyGenerator _cacheKeyGenerator; private readonly HttpRequestMessage _request; diff --git a/test/Ocelot.UnitTests/Cache/OutputCacheMiddlewareTests.cs b/test/Ocelot.UnitTests/Cache/OutputCacheMiddlewareTests.cs index bb7e829a9..aaaf263f0 100644 --- a/test/Ocelot.UnitTests/Cache/OutputCacheMiddlewareTests.cs +++ b/test/Ocelot.UnitTests/Cache/OutputCacheMiddlewareTests.cs @@ -10,7 +10,7 @@ namespace Ocelot.UnitTests.Cache { - public class OutputCacheMiddlewareTests + public class OutputCacheMiddlewareTests : UnitTest { private readonly Mock> _cache; private readonly Mock _loggerFactory; diff --git a/test/Ocelot.UnitTests/Cache/RegionCreatorTests.cs b/test/Ocelot.UnitTests/Cache/RegionCreatorTests.cs index 841ff5166..89d552009 100644 --- a/test/Ocelot.UnitTests/Cache/RegionCreatorTests.cs +++ b/test/Ocelot.UnitTests/Cache/RegionCreatorTests.cs @@ -3,7 +3,7 @@ namespace Ocelot.UnitTests.Cache { - public class RegionCreatorTests + public class RegionCreatorTests : UnitTest { private string _result; private FileRoute _route; diff --git a/test/Ocelot.UnitTests/CacheManager/OcelotBuilderExtensionsTests.cs b/test/Ocelot.UnitTests/CacheManager/OcelotBuilderExtensionsTests.cs index 9d980aa23..410c73b64 100644 --- a/test/Ocelot.UnitTests/CacheManager/OcelotBuilderExtensionsTests.cs +++ b/test/Ocelot.UnitTests/CacheManager/OcelotBuilderExtensionsTests.cs @@ -11,7 +11,7 @@ namespace Ocelot.UnitTests.CacheManager { - public class OcelotBuilderExtensionsTests + public class OcelotBuilderExtensionsTests : UnitTest { private readonly IServiceCollection _services; private readonly IConfiguration _configRoot; diff --git a/test/Ocelot.UnitTests/CacheManager/OcelotCacheManagerCache.cs b/test/Ocelot.UnitTests/CacheManager/OcelotCacheManagerCache.cs index 82ffc5bf9..a2a662029 100644 --- a/test/Ocelot.UnitTests/CacheManager/OcelotCacheManagerCache.cs +++ b/test/Ocelot.UnitTests/CacheManager/OcelotCacheManagerCache.cs @@ -3,7 +3,7 @@ namespace Ocelot.UnitTests.CacheManager { - public class OcelotCacheManagerCache + public class OcelotCacheManagerCache : UnitTest { private readonly OcelotCacheManagerCache _ocelotOcelotCacheManager; private readonly Mock> _mockCacheManager; diff --git a/test/Ocelot.UnitTests/CacheManager/OutputCacheMiddlewareRealCacheTests.cs b/test/Ocelot.UnitTests/CacheManager/OutputCacheMiddlewareRealCacheTests.cs index ee52d3785..fc002eaab 100644 --- a/test/Ocelot.UnitTests/CacheManager/OutputCacheMiddlewareRealCacheTests.cs +++ b/test/Ocelot.UnitTests/CacheManager/OutputCacheMiddlewareRealCacheTests.cs @@ -11,7 +11,7 @@ namespace Ocelot.UnitTests.CacheManager { - public class OutputCacheMiddlewareRealCacheTests + public class OutputCacheMiddlewareRealCacheTests : UnitTest { private readonly IOcelotCache _cacheManager; private readonly ICacheKeyGenerator _cacheKeyGenerator; diff --git a/test/Ocelot.UnitTests/Claims/AddClaimsToRequestTests.cs b/test/Ocelot.UnitTests/Claims/AddClaimsToRequestTests.cs index c3d2c212e..362df7f4a 100644 --- a/test/Ocelot.UnitTests/Claims/AddClaimsToRequestTests.cs +++ b/test/Ocelot.UnitTests/Claims/AddClaimsToRequestTests.cs @@ -8,7 +8,7 @@ namespace Ocelot.UnitTests.Claims { - public class AddClaimsToRequestTests + public class AddClaimsToRequestTests : UnitTest { private readonly AddClaimsToRequest _addClaimsToRequest; private readonly Mock _parser; diff --git a/test/Ocelot.UnitTests/Claims/ClaimsToClaimsMiddlewareTests.cs b/test/Ocelot.UnitTests/Claims/ClaimsToClaimsMiddlewareTests.cs index e996968af..2fcface83 100644 --- a/test/Ocelot.UnitTests/Claims/ClaimsToClaimsMiddlewareTests.cs +++ b/test/Ocelot.UnitTests/Claims/ClaimsToClaimsMiddlewareTests.cs @@ -10,7 +10,7 @@ namespace Ocelot.UnitTests.Claims { - public class ClaimsToClaimsMiddlewareTests + public class ClaimsToClaimsMiddlewareTests : UnitTest { private readonly Mock _addHeaders; private readonly Mock _loggerFactory; diff --git a/test/Ocelot.UnitTests/Configuration/AggregatesCreatorTests.cs b/test/Ocelot.UnitTests/Configuration/AggregatesCreatorTests.cs index d4605f038..469e3d7f2 100644 --- a/test/Ocelot.UnitTests/Configuration/AggregatesCreatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/AggregatesCreatorTests.cs @@ -6,7 +6,7 @@ namespace Ocelot.UnitTests.Configuration { - public class AggregatesCreatorTests + public class AggregatesCreatorTests : UnitTest { private readonly AggregatesCreator _creator; private readonly Mock _utpCreator; diff --git a/test/Ocelot.UnitTests/Configuration/AuthenticationOptionsCreatorTests.cs b/test/Ocelot.UnitTests/Configuration/AuthenticationOptionsCreatorTests.cs index b1830ba62..d0e8d599e 100644 --- a/test/Ocelot.UnitTests/Configuration/AuthenticationOptionsCreatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/AuthenticationOptionsCreatorTests.cs @@ -46,7 +46,7 @@ public void Create_OptionsObjIsNotNull_CreatedSuccessfully(bool isAuthentication // Arrange string authenticationProviderKey = !isAuthenticationProviderKeys ? "Test" : null; string[] authenticationProviderKeys = isAuthenticationProviderKeys ? - ["Test #1", "Test #2"] : null; + new string[] { "Test #1", "Test #2" } : null; var fileRoute = new FileRoute() { AuthenticationOptions = new FileAuthenticationOptions diff --git a/test/Ocelot.UnitTests/Configuration/ChangeTracking/OcelotConfigurationChangeTokenSourceTests.cs b/test/Ocelot.UnitTests/Configuration/ChangeTracking/OcelotConfigurationChangeTokenSourceTests.cs index 299eb30ff..dd0b22bd3 100644 --- a/test/Ocelot.UnitTests/Configuration/ChangeTracking/OcelotConfigurationChangeTokenSourceTests.cs +++ b/test/Ocelot.UnitTests/Configuration/ChangeTracking/OcelotConfigurationChangeTokenSourceTests.cs @@ -2,7 +2,7 @@ namespace Ocelot.UnitTests.Configuration.ChangeTracking { - public class OcelotConfigurationChangeTokenSourceTests + public class OcelotConfigurationChangeTokenSourceTests : UnitTest { private readonly IOcelotConfigurationChangeTokenSource _source; diff --git a/test/Ocelot.UnitTests/Configuration/ChangeTracking/OcelotConfigurationChangeTokenTests.cs b/test/Ocelot.UnitTests/Configuration/ChangeTracking/OcelotConfigurationChangeTokenTests.cs index 58b20d7ea..20602553e 100644 --- a/test/Ocelot.UnitTests/Configuration/ChangeTracking/OcelotConfigurationChangeTokenTests.cs +++ b/test/Ocelot.UnitTests/Configuration/ChangeTracking/OcelotConfigurationChangeTokenTests.cs @@ -2,7 +2,7 @@ namespace Ocelot.UnitTests.Configuration.ChangeTracking { - public class OcelotConfigurationChangeTokenTests + public class OcelotConfigurationChangeTokenTests : UnitTest { [Fact] public void should_call_callback_with_state() diff --git a/test/Ocelot.UnitTests/Configuration/ClaimToThingConfigurationParserTests.cs b/test/Ocelot.UnitTests/Configuration/ClaimToThingConfigurationParserTests.cs index 6b46b0fff..553a32e89 100644 --- a/test/Ocelot.UnitTests/Configuration/ClaimToThingConfigurationParserTests.cs +++ b/test/Ocelot.UnitTests/Configuration/ClaimToThingConfigurationParserTests.cs @@ -5,7 +5,7 @@ namespace Ocelot.UnitTests.Configuration { - public class ClaimToThingConfigurationParserTests + public class ClaimToThingConfigurationParserTests : UnitTest { private Dictionary _dictionary; private readonly IClaimToThingConfigurationParser _claimToThingConfigurationParser; diff --git a/test/Ocelot.UnitTests/Configuration/ClaimsToThingCreatorTests.cs b/test/Ocelot.UnitTests/Configuration/ClaimsToThingCreatorTests.cs index 70438aed8..878d1da77 100644 --- a/test/Ocelot.UnitTests/Configuration/ClaimsToThingCreatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/ClaimsToThingCreatorTests.cs @@ -7,7 +7,7 @@ namespace Ocelot.UnitTests.Configuration { - public class ClaimsToThingCreatorTests + public class ClaimsToThingCreatorTests : UnitTest { private readonly Mock _configParser; private Dictionary _claimsToThings; diff --git a/test/Ocelot.UnitTests/Configuration/ConfigurationCreatorTests.cs b/test/Ocelot.UnitTests/Configuration/ConfigurationCreatorTests.cs index 2af3224df..8f6c7f803 100644 --- a/test/Ocelot.UnitTests/Configuration/ConfigurationCreatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/ConfigurationCreatorTests.cs @@ -6,7 +6,7 @@ namespace Ocelot.UnitTests.Configuration { - public class ConfigurationCreatorTests + public class ConfigurationCreatorTests : UnitTest { private ConfigurationCreator _creator; private InternalConfiguration _result; diff --git a/test/Ocelot.UnitTests/Configuration/DiskFileConfigurationRepositoryTests.cs b/test/Ocelot.UnitTests/Configuration/DiskFileConfigurationRepositoryTests.cs index 30a6354a1..eea4ee955 100644 --- a/test/Ocelot.UnitTests/Configuration/DiskFileConfigurationRepositoryTests.cs +++ b/test/Ocelot.UnitTests/Configuration/DiskFileConfigurationRepositoryTests.cs @@ -229,7 +229,7 @@ private static FileConfiguration FakeFileConfigurationForGet() private static FileRoute GivenRoute(string host, string downstream) => new() { - DownstreamHostAndPorts = [new(host, 80)], + DownstreamHostAndPorts = new() { new(host, 80) }, DownstreamScheme = Uri.UriSchemeHttps, DownstreamPathTemplate = downstream, }; diff --git a/test/Ocelot.UnitTests/Configuration/DownstreamAddressesCreatorTests.cs b/test/Ocelot.UnitTests/Configuration/DownstreamAddressesCreatorTests.cs index 6cb6ece1c..0fe22959f 100644 --- a/test/Ocelot.UnitTests/Configuration/DownstreamAddressesCreatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/DownstreamAddressesCreatorTests.cs @@ -4,7 +4,7 @@ namespace Ocelot.UnitTests.Configuration { - public class DownstreamAddressesCreatorTests + public class DownstreamAddressesCreatorTests : UnitTest { public DownstreamAddressesCreator _creator; private FileRoute _route; diff --git a/test/Ocelot.UnitTests/Configuration/DynamicsCreatorTests.cs b/test/Ocelot.UnitTests/Configuration/DynamicsCreatorTests.cs index 1a8b31566..aec6ffb75 100644 --- a/test/Ocelot.UnitTests/Configuration/DynamicsCreatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/DynamicsCreatorTests.cs @@ -5,7 +5,7 @@ namespace Ocelot.UnitTests.Configuration { - public class DynamicsCreatorTests + public class DynamicsCreatorTests : UnitTest { private readonly DynamicsCreator _creator; private readonly Mock _rloCreator; diff --git a/test/Ocelot.UnitTests/Configuration/FileConfigurationPollerTests.cs b/test/Ocelot.UnitTests/Configuration/FileConfigurationPollerTests.cs index 524a66dba..366f40ae8 100644 --- a/test/Ocelot.UnitTests/Configuration/FileConfigurationPollerTests.cs +++ b/test/Ocelot.UnitTests/Configuration/FileConfigurationPollerTests.cs @@ -9,7 +9,7 @@ namespace Ocelot.UnitTests.Configuration { - public class FileConfigurationPollerTests : IDisposable + public class FileConfigurationPollerTests : UnitTest, IDisposable { private readonly FileConfigurationPoller _poller; private readonly Mock _factory; diff --git a/test/Ocelot.UnitTests/Configuration/FileConfigurationSetterTests.cs b/test/Ocelot.UnitTests/Configuration/FileConfigurationSetterTests.cs index ba4df0d0f..2c2201a33 100644 --- a/test/Ocelot.UnitTests/Configuration/FileConfigurationSetterTests.cs +++ b/test/Ocelot.UnitTests/Configuration/FileConfigurationSetterTests.cs @@ -9,7 +9,7 @@ namespace Ocelot.UnitTests.Configuration { - public class FileConfigurationSetterTests + public class FileConfigurationSetterTests : UnitTest { private FileConfiguration _fileConfiguration; private readonly FileAndInternalConfigurationSetter _configSetter; diff --git a/test/Ocelot.UnitTests/Configuration/FileInternalConfigurationCreatorTests.cs b/test/Ocelot.UnitTests/Configuration/FileInternalConfigurationCreatorTests.cs index 865604071..b8fb5b7f6 100644 --- a/test/Ocelot.UnitTests/Configuration/FileInternalConfigurationCreatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/FileInternalConfigurationCreatorTests.cs @@ -9,7 +9,7 @@ namespace Ocelot.UnitTests.Configuration { - public class FileInternalConfigurationCreatorTests + public class FileInternalConfigurationCreatorTests : UnitTest { private readonly Mock _validator; private readonly Mock _routesCreator; diff --git a/test/Ocelot.UnitTests/Configuration/HeaderFindAndReplaceCreatorTests.cs b/test/Ocelot.UnitTests/Configuration/HeaderFindAndReplaceCreatorTests.cs index 854f2abea..b5f42d6e3 100644 --- a/test/Ocelot.UnitTests/Configuration/HeaderFindAndReplaceCreatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/HeaderFindAndReplaceCreatorTests.cs @@ -8,7 +8,7 @@ namespace Ocelot.UnitTests.Configuration { - public class HeaderFindAndReplaceCreatorTests + public class HeaderFindAndReplaceCreatorTests : UnitTest { private readonly HeaderFindAndReplaceCreator _creator; private FileRoute _route; diff --git a/test/Ocelot.UnitTests/Configuration/HttpHandlerOptionsCreatorTests.cs b/test/Ocelot.UnitTests/Configuration/HttpHandlerOptionsCreatorTests.cs index 8e41eec9e..33f6d629a 100644 --- a/test/Ocelot.UnitTests/Configuration/HttpHandlerOptionsCreatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/HttpHandlerOptionsCreatorTests.cs @@ -7,7 +7,7 @@ namespace Ocelot.UnitTests.Configuration { - public class HttpHandlerOptionsCreatorTests + public class HttpHandlerOptionsCreatorTests : UnitTest { private IHttpHandlerOptionsCreator _httpHandlerOptionsCreator; private FileRoute _fileRoute; diff --git a/test/Ocelot.UnitTests/Configuration/InMemoryConfigurationRepositoryTests.cs b/test/Ocelot.UnitTests/Configuration/InMemoryConfigurationRepositoryTests.cs index a9af24523..85d6bf210 100644 --- a/test/Ocelot.UnitTests/Configuration/InMemoryConfigurationRepositoryTests.cs +++ b/test/Ocelot.UnitTests/Configuration/InMemoryConfigurationRepositoryTests.cs @@ -6,7 +6,7 @@ namespace Ocelot.UnitTests.Configuration { - public class InMemoryConfigurationRepositoryTests + public class InMemoryConfigurationRepositoryTests : UnitTest { private readonly InMemoryInternalConfigurationRepository _repo; private IInternalConfiguration _config; diff --git a/test/Ocelot.UnitTests/Configuration/LoadBalancerOptionsCreatorTests.cs b/test/Ocelot.UnitTests/Configuration/LoadBalancerOptionsCreatorTests.cs index d7d2e1bac..7e1464ecd 100644 --- a/test/Ocelot.UnitTests/Configuration/LoadBalancerOptionsCreatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/LoadBalancerOptionsCreatorTests.cs @@ -4,7 +4,7 @@ namespace Ocelot.UnitTests.Configuration { - public class LoadBalancerOptionsCreatorTests + public class LoadBalancerOptionsCreatorTests : UnitTest { private readonly ILoadBalancerOptionsCreator _creator; private FileLoadBalancerOptions _fileLoadBalancerOptions; diff --git a/test/Ocelot.UnitTests/Configuration/QoSOptionsCreatorTests.cs b/test/Ocelot.UnitTests/Configuration/QoSOptionsCreatorTests.cs index 893c8630b..f394932df 100644 --- a/test/Ocelot.UnitTests/Configuration/QoSOptionsCreatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/QoSOptionsCreatorTests.cs @@ -5,7 +5,7 @@ namespace Ocelot.UnitTests.Configuration { - public class QoSOptionsCreatorTests + public class QoSOptionsCreatorTests : UnitTest { private readonly QoSOptionsCreator _creator; private FileRoute _fileRoute; diff --git a/test/Ocelot.UnitTests/Configuration/RateLimitOptionsCreatorTests.cs b/test/Ocelot.UnitTests/Configuration/RateLimitOptionsCreatorTests.cs index 63e779312..e514877d2 100644 --- a/test/Ocelot.UnitTests/Configuration/RateLimitOptionsCreatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/RateLimitOptionsCreatorTests.cs @@ -5,7 +5,7 @@ namespace Ocelot.UnitTests.Configuration { - public class RateLimitOptionsCreatorTests + public class RateLimitOptionsCreatorTests : UnitTest { private FileRoute _fileRoute; private FileGlobalConfiguration _fileGlobalConfig; diff --git a/test/Ocelot.UnitTests/Configuration/RequestIdKeyCreatorTests.cs b/test/Ocelot.UnitTests/Configuration/RequestIdKeyCreatorTests.cs index 4511c04fa..d2be4fcc5 100644 --- a/test/Ocelot.UnitTests/Configuration/RequestIdKeyCreatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/RequestIdKeyCreatorTests.cs @@ -3,7 +3,7 @@ namespace Ocelot.UnitTests.Configuration { - public class RequestIdKeyCreatorTests + public class RequestIdKeyCreatorTests : UnitTest { private FileRoute _fileRoute; private FileGlobalConfiguration _fileGlobalConfig; diff --git a/test/Ocelot.UnitTests/Configuration/RouteKeyCreatorTests.cs b/test/Ocelot.UnitTests/Configuration/RouteKeyCreatorTests.cs index 8326fb5a0..ff26b406f 100644 --- a/test/Ocelot.UnitTests/Configuration/RouteKeyCreatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/RouteKeyCreatorTests.cs @@ -4,7 +4,7 @@ namespace Ocelot.UnitTests.Configuration { - public class RouteKeyCreatorTests + public class RouteKeyCreatorTests : UnitTest { private readonly RouteKeyCreator _creator; private FileRoute _route; @@ -39,12 +39,12 @@ public void Should_return_route_key() var route = new FileRoute { UpstreamPathTemplate = "/api/product", - UpstreamHttpMethod = ["GET", "POST", "PUT"], - DownstreamHostAndPorts = - [ + UpstreamHttpMethod = new() { "GET", "POST", "PUT" }, + DownstreamHostAndPorts = new() + { new("localhost", 8080), new("localhost", 4430), - ], + }, }; this.Given(_ => GivenThe(route)) @@ -60,12 +60,12 @@ public void Should_return_route_key_with_upstream_host() { UpstreamHost = "my-host", UpstreamPathTemplate = "/api/product", - UpstreamHttpMethod = ["GET", "POST", "PUT"], - DownstreamHostAndPorts = - [ + UpstreamHttpMethod = new() { "GET", "POST", "PUT" }, + DownstreamHostAndPorts = new() + { new("localhost", 8080), new("localhost", 4430), - ], + }, }; this.Given(_ => GivenThe(route)) @@ -80,7 +80,7 @@ public void Should_return_route_key_with_svc_name() var route = new FileRoute { UpstreamPathTemplate = "/api/product", - UpstreamHttpMethod = ["GET", "POST", "PUT"], + UpstreamHttpMethod = new() { "GET", "POST", "PUT" }, ServiceName = "products-service", }; @@ -96,7 +96,7 @@ public void Should_return_route_key_with_load_balancer_options() var route = new FileRoute { UpstreamPathTemplate = "/api/product", - UpstreamHttpMethod = ["GET", "POST", "PUT"], + UpstreamHttpMethod = new() { "GET", "POST", "PUT" }, ServiceName = "products-service", LoadBalancerOptions = new FileLoadBalancerOptions { diff --git a/test/Ocelot.UnitTests/Configuration/RouteOptionsCreatorTests.cs b/test/Ocelot.UnitTests/Configuration/RouteOptionsCreatorTests.cs index bfb2927e5..21f9058ae 100644 --- a/test/Ocelot.UnitTests/Configuration/RouteOptionsCreatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/RouteOptionsCreatorTests.cs @@ -4,7 +4,7 @@ namespace Ocelot.UnitTests.Configuration; -public class RouteOptionsCreatorTests +public class RouteOptionsCreatorTests : UnitTest { private readonly RouteOptionsCreator _creator; @@ -126,7 +126,7 @@ public void Create_RouteOptions_HappyPath(bool isAuthenticationProviderKeys) { AuthenticationProviderKey = !isAuthenticationProviderKeys ? "Test" : null, AuthenticationProviderKeys = isAuthenticationProviderKeys ? - [string.Empty, "Test #1"] : null, + new string[] { string.Empty, "Test #1" } : null, }, RouteClaimsRequirement = new Dictionary { diff --git a/test/Ocelot.UnitTests/Configuration/RoutesCreatorTests.cs b/test/Ocelot.UnitTests/Configuration/RoutesCreatorTests.cs index cf5f38e7b..382eb3a44 100644 --- a/test/Ocelot.UnitTests/Configuration/RoutesCreatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/RoutesCreatorTests.cs @@ -7,7 +7,7 @@ namespace Ocelot.UnitTests.Configuration { - public class RoutesCreatorTests + public class RoutesCreatorTests : UnitTest { private readonly RoutesCreator _creator; private readonly Mock _cthCreator; diff --git a/test/Ocelot.UnitTests/Configuration/SecurityOptionsCreatorTests.cs b/test/Ocelot.UnitTests/Configuration/SecurityOptionsCreatorTests.cs index 6c2968020..81d9fd36d 100644 --- a/test/Ocelot.UnitTests/Configuration/SecurityOptionsCreatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/SecurityOptionsCreatorTests.cs @@ -4,7 +4,7 @@ namespace Ocelot.UnitTests.Configuration { - public class SecurityOptionsCreatorTests + public class SecurityOptionsCreatorTests : UnitTest { private FileRoute _fileRoute; private SecurityOptions _result; diff --git a/test/Ocelot.UnitTests/Configuration/ServiceProviderCreatorTests.cs b/test/Ocelot.UnitTests/Configuration/ServiceProviderCreatorTests.cs index ac92db206..aaa238cca 100644 --- a/test/Ocelot.UnitTests/Configuration/ServiceProviderCreatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/ServiceProviderCreatorTests.cs @@ -5,7 +5,7 @@ namespace Ocelot.UnitTests.Configuration { - public class ServiceProviderCreatorTests + public class ServiceProviderCreatorTests : UnitTest { private readonly ServiceProviderConfigurationCreator _creator; private FileGlobalConfiguration _globalConfig; diff --git a/test/Ocelot.UnitTests/Configuration/UpstreamTemplatePatternCreatorTests.cs b/test/Ocelot.UnitTests/Configuration/UpstreamTemplatePatternCreatorTests.cs index 4028d456b..76cb789d3 100644 --- a/test/Ocelot.UnitTests/Configuration/UpstreamTemplatePatternCreatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/UpstreamTemplatePatternCreatorTests.cs @@ -4,7 +4,7 @@ namespace Ocelot.UnitTests.Configuration { - public class UpstreamTemplatePatternCreatorTests + public class UpstreamTemplatePatternCreatorTests : UnitTest { private FileRoute _fileRoute; private readonly UpstreamTemplatePatternCreator _creator; diff --git a/test/Ocelot.UnitTests/Configuration/Validation/FileConfigurationFluentValidatorTests.cs b/test/Ocelot.UnitTests/Configuration/Validation/FileConfigurationFluentValidatorTests.cs index c45cb9d54..3a87dec2f 100644 --- a/test/Ocelot.UnitTests/Configuration/Validation/FileConfigurationFluentValidatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/Validation/FileConfigurationFluentValidatorTests.cs @@ -18,7 +18,7 @@ namespace Ocelot.UnitTests.Configuration.Validation { - public class FileConfigurationFluentValidatorTests + public class FileConfigurationFluentValidatorTests : UnitTest { private IConfigurationValidator _configurationValidator; private FileConfiguration _fileConfiguration; @@ -201,19 +201,15 @@ public void Configuration_is_valid_if_aggregates_are_valid() var route2 = GivenDefaultRoute("/tom", "/"); route2.Key = "Tom"; var configuration = GivenAConfiguration(route, route2); - configuration.Aggregates = - [ + configuration.Aggregates = new() + { new() { UpstreamPathTemplate = "/", UpstreamHost = "localhost", - RouteKeys = - [ - "Tom", - "Laura", - ], + RouteKeys = new() { "Tom", "Laura" }, }, - ]; + }; this.Given(x => x.GivenAConfiguration(configuration)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsValid()) @@ -229,19 +225,15 @@ public void Configuration_is_invalid_if_aggregates_are_duplicate_of_routes() route2.Key = "Tom"; route2.UpstreamHost = "localhost"; var configuration = GivenAConfiguration(route, route2); - configuration.Aggregates = - [ + configuration.Aggregates = new() + { new() { UpstreamPathTemplate = "/tom", UpstreamHost = "localhost", - RouteKeys = - [ - "Tom", - "Laura", - ], + RouteKeys = new() { "Tom", "Laura" }, }, - ]; + }; this.Given(x => x.GivenAConfiguration(configuration)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) @@ -256,21 +248,17 @@ public void Configuration_is_valid_if_aggregates_are_not_duplicate_of_routes() route.Key = "Laura"; var route2 = GivenDefaultRoute("/tom", "/"); route2.Key = "Tom"; - route2.UpstreamHttpMethod = ["Post"]; + route2.UpstreamHttpMethod = new() { "Post" }; var configuration = GivenAConfiguration(route, route2); - configuration.Aggregates = - [ + configuration.Aggregates = new() + { new() { UpstreamPathTemplate = "/tom", UpstreamHost = "localhost", - RouteKeys = - [ - "Tom", - "Laura", - ], + RouteKeys = new() { "Tom", "Laura" }, }, - ]; + }; this.Given(x => x.GivenAConfiguration(configuration)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsValid()) @@ -285,29 +273,21 @@ public void Configuration_is_invalid_if_aggregates_are_duplicate_of_aggregates() var route2 = GivenDefaultRoute("/lol", "/"); route2.Key = "Tom"; var configuration = GivenAConfiguration(route, route2); - configuration.Aggregates = - [ + configuration.Aggregates = new() + { new() { UpstreamPathTemplate = "/tom", UpstreamHost = "localhost", - RouteKeys = - [ - "Tom", - "Laura", - ], + RouteKeys = new() { "Tom", "Laura" }, }, new() { UpstreamPathTemplate = "/tom", UpstreamHost = "localhost", - RouteKeys = - [ - "Tom", - "Laura", - ], + RouteKeys = new() { "Tom", "Laura" }, }, - ]; + }; this.Given(x => x.GivenAConfiguration(configuration)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) @@ -321,19 +301,15 @@ public void Configuration_is_invalid_if_routes_dont_exist_for_aggregate() var route = GivenDefaultRoute("/laura", "/"); route.Key = "Laura"; var configuration = GivenAConfiguration(route); - configuration.Aggregates = - [ + configuration.Aggregates = new() + { new() { UpstreamPathTemplate = "/", UpstreamHost = "localhost", - RouteKeys = - [ - "Tom", - "Laura", - ], + RouteKeys = new() { "Tom", "Laura" }, }, - ]; + }; this.Given(x => x.GivenAConfiguration(configuration)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) @@ -350,19 +326,15 @@ public void Configuration_is_invalid_if_aggregate_has_routes_with_specific_reque route2.Key = "Tom"; route2.RequestIdKey = "should_fail"; var configuration = GivenAConfiguration(route, route2); - configuration.Aggregates = - [ + configuration.Aggregates = new() + { new() { UpstreamPathTemplate = "/", UpstreamHost = "localhost", - RouteKeys = - [ - "Tom", - "Laura", - ], + RouteKeys = new() { "Tom", "Laura" }, }, - ]; + }; this.Given(x => x.GivenAConfiguration(configuration)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) @@ -455,7 +427,7 @@ public void Configuration_is_invalid_with_invalid_authentication_provider() route.AuthenticationOptions = new FileAuthenticationOptions() { AuthenticationProviderKey = "Test", - AuthenticationProviderKeys = ["Test #1", "Test #2"], + AuthenticationProviderKeys = new string[] { "Test #1", "Test #2" }, }; this.Given(x => x.GivenAConfiguration(route)) .When(x => x.WhenIValidateTheConfiguration()) @@ -495,7 +467,7 @@ public void Configuration_is_not_valid_with_duplicate_routes_specific_verbs() { var route = GivenDefaultRoute(); var duplicate = GivenDefaultRoute(null, "/www/test/"); - duplicate.UpstreamHttpMethod = ["Get"]; + duplicate.UpstreamHttpMethod = new() { "Get" }; this.Given(x => x.GivenAConfiguration(route, duplicate)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) @@ -508,7 +480,7 @@ public void Configuration_is_valid_with_duplicate_routes_different_verbs() { var route = GivenDefaultRoute(); // "Get" verb is inside var duplicate = GivenDefaultRoute(null, "/www/test/"); - duplicate.UpstreamHttpMethod = ["Post"]; + duplicate.UpstreamHttpMethod = new() { "Post" }; this.Given(x => x.GivenAConfiguration(route, duplicate)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsValid()) @@ -519,11 +491,11 @@ public void Configuration_is_valid_with_duplicate_routes_different_verbs() public void Configuration_is_not_valid_with_duplicate_routes_with_duplicated_upstreamhosts() { var route = GivenDefaultRoute(); - route.UpstreamHttpMethod = []; + route.UpstreamHttpMethod = new(); route.UpstreamHost = "upstreamhost"; var duplicate = GivenDefaultRoute(null, "/www/test/"); - duplicate.UpstreamHttpMethod = []; + duplicate.UpstreamHttpMethod = new(); duplicate.UpstreamHost = "upstreamhost"; this.Given(x => x.GivenAConfiguration(route, duplicate)) @@ -537,11 +509,11 @@ public void Configuration_is_not_valid_with_duplicate_routes_with_duplicated_ups public void Configuration_is_valid_with_duplicate_routes_but_different_upstreamhosts() { var route = GivenDefaultRoute(); - route.UpstreamHttpMethod = []; + route.UpstreamHttpMethod = new(); route.UpstreamHost = "upstreamhost111"; var duplicate = GivenDefaultRoute(null, "/www/test/"); - duplicate.UpstreamHttpMethod = []; + duplicate.UpstreamHttpMethod = new(); duplicate.UpstreamHost = "upstreamhost222"; this.Given(x => x.GivenAConfiguration(route, duplicate)) @@ -554,11 +526,11 @@ public void Configuration_is_valid_with_duplicate_routes_but_different_upstreamh public void Configuration_is_valid_with_duplicate_routes_but_one_upstreamhost_is_not_set() { var route = GivenDefaultRoute(); - route.UpstreamHttpMethod = []; + route.UpstreamHttpMethod = new(); route.UpstreamHost = "upstreamhost"; var duplicate = GivenDefaultRoute(null, "/www/test/"); - duplicate.UpstreamHttpMethod = []; + duplicate.UpstreamHttpMethod = new(); this.Given(x => x.GivenAConfiguration(route, duplicate)) .When(x => x.WhenIValidateTheConfiguration()) @@ -697,10 +669,10 @@ public void HaveServiceDiscoveryProviderRegistered_ServiceDiscoveryFinderDelegat public void Configuration_is_valid_when_not_using_service_discovery_and_host_is_set() { var route = GivenDefaultRoute(); - route.DownstreamHostAndPorts = - [ + route.DownstreamHostAndPorts = new() + { new("bbc.co.uk", 123), - ]; + }; this.Given(x => x.GivenAConfiguration(route)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsValid()) @@ -711,10 +683,10 @@ public void Configuration_is_valid_when_not_using_service_discovery_and_host_is_ public void Configuration_is_valid_when_no_downstream_but_has_host_and_port() { var route = GivenDefaultRoute(); - route.DownstreamHostAndPorts = - [ + route.DownstreamHostAndPorts = new() + { new("test", 123), - ]; + }; this.Given(x => x.GivenAConfiguration(route)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsValid()) @@ -725,7 +697,7 @@ public void Configuration_is_valid_when_no_downstream_but_has_host_and_port() public void Configuration_is_not_valid_when_no_host_and_port() { var route = GivenDefaultRoute(); - route.DownstreamHostAndPorts = []; + route.DownstreamHostAndPorts = new(); this.Given(x => x.GivenAConfiguration(route)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) @@ -737,10 +709,10 @@ public void Configuration_is_not_valid_when_no_host_and_port() public void Configuration_is_not_valid_when_host_and_port_is_empty() { var route = GivenDefaultRoute(); - route.DownstreamHostAndPorts = - [ + route.DownstreamHostAndPorts = new() + { new(), - ]; + }; this.Given(x => x.GivenAConfiguration(route)) .When(x => x.WhenIValidateTheConfiguration()) .Then(x => x.ThenTheResultIsNotValid()) @@ -815,19 +787,19 @@ public void Configuration_is_invalid_when_placeholder_is_used_twice_in_downstrea private static FileRoute GivenDefaultRoute(string upstream, string downstream, string host) => new() { - UpstreamHttpMethod = [HttpMethods.Get], + UpstreamHttpMethod = new() { HttpMethods.Get }, UpstreamPathTemplate = upstream ?? "/asdf/", DownstreamPathTemplate = downstream ?? "/api/products/", - DownstreamHostAndPorts = - [ + DownstreamHostAndPorts = new() + { new(host ?? "bbc.co.uk", 12345), - ], + }, DownstreamScheme = Uri.UriSchemeHttp, }; private static FileRoute GivenServiceDiscoveryRoute() => new() { - UpstreamHttpMethod = [HttpMethods.Get], + UpstreamHttpMethod = new() { HttpMethods.Get }, UpstreamPathTemplate = "/laura", DownstreamPathTemplate = "/", DownstreamScheme = Uri.UriSchemeHttp, @@ -918,7 +890,7 @@ private void GivenAServiceDiscoveryHandler() private class FakeServiceDiscoveryProvider : IServiceDiscoveryProvider { - public Task> GetAsync() => Task.FromResult>([]); + public Task> GetAsync() => Task.FromResult>(new()); } private class TestOptions : AuthenticationSchemeOptions { } diff --git a/test/Ocelot.UnitTests/Configuration/Validation/FileQoSOptionsFluentValidatorTests.cs b/test/Ocelot.UnitTests/Configuration/Validation/FileQoSOptionsFluentValidatorTests.cs index 69a7401e9..84d041e23 100644 --- a/test/Ocelot.UnitTests/Configuration/Validation/FileQoSOptionsFluentValidatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/Validation/FileQoSOptionsFluentValidatorTests.cs @@ -9,7 +9,7 @@ namespace Ocelot.UnitTests.Configuration.Validation { - public class FileQoSOptionsFluentValidatorTests + public class FileQoSOptionsFluentValidatorTests : UnitTest { private FileQoSOptionsFluentValidator _validator; private readonly ServiceCollection _services; diff --git a/test/Ocelot.UnitTests/Configuration/Validation/HostAndPortValidatorTests.cs b/test/Ocelot.UnitTests/Configuration/Validation/HostAndPortValidatorTests.cs index 9ea2bb364..af975654f 100644 --- a/test/Ocelot.UnitTests/Configuration/Validation/HostAndPortValidatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/Validation/HostAndPortValidatorTests.cs @@ -4,7 +4,7 @@ namespace Ocelot.UnitTests.Configuration.Validation { - public class HostAndPortValidatorTests + public class HostAndPortValidatorTests : UnitTest { private HostAndPortValidator _validator; private ValidationResult _result; diff --git a/test/Ocelot.UnitTests/Configuration/Validation/RouteFluentValidatorTests.cs b/test/Ocelot.UnitTests/Configuration/Validation/RouteFluentValidatorTests.cs index 2e696f41d..1b2bfadb3 100644 --- a/test/Ocelot.UnitTests/Configuration/Validation/RouteFluentValidatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/Validation/RouteFluentValidatorTests.cs @@ -7,7 +7,7 @@ namespace Ocelot.UnitTests.Configuration.Validation { - public class RouteFluentValidatorTests + public class RouteFluentValidatorTests : UnitTest { private readonly RouteFluentValidator _validator; private readonly Mock _authProvider; diff --git a/test/Ocelot.UnitTests/Configuration/VersionCreatorTests.cs b/test/Ocelot.UnitTests/Configuration/VersionCreatorTests.cs index dde40682a..129ff791a 100644 --- a/test/Ocelot.UnitTests/Configuration/VersionCreatorTests.cs +++ b/test/Ocelot.UnitTests/Configuration/VersionCreatorTests.cs @@ -2,7 +2,7 @@ namespace Ocelot.UnitTests.Configuration { - public class VersionCreatorTests + public class VersionCreatorTests : UnitTest { private readonly HttpVersionCreator _creator; private string _input; diff --git a/test/Ocelot.UnitTests/Consul/ConsulFileConfigurationRepositoryTests.cs b/test/Ocelot.UnitTests/Consul/ConsulFileConfigurationRepositoryTests.cs index e7f49f3d2..2b2ee6557 100644 --- a/test/Ocelot.UnitTests/Consul/ConsulFileConfigurationRepositoryTests.cs +++ b/test/Ocelot.UnitTests/Consul/ConsulFileConfigurationRepositoryTests.cs @@ -10,7 +10,7 @@ namespace Ocelot.UnitTests.Consul { - public class ConsulFileConfigurationRepositoryTests + public class ConsulFileConfigurationRepositoryTests : UnitTest { private ConsulFileConfigurationRepository _repo; private readonly Mock> _options; diff --git a/test/Ocelot.UnitTests/Consul/ConsulServiceDiscoveryProviderTests.cs b/test/Ocelot.UnitTests/Consul/ConsulServiceDiscoveryProviderTests.cs index bf570142c..7df0a2c60 100644 --- a/test/Ocelot.UnitTests/Consul/ConsulServiceDiscoveryProviderTests.cs +++ b/test/Ocelot.UnitTests/Consul/ConsulServiceDiscoveryProviderTests.cs @@ -10,7 +10,7 @@ namespace Ocelot.UnitTests.Consul { - public class ConsulServiceDiscoveryProviderTests : IDisposable + public class ConsulServiceDiscoveryProviderTests : UnitTest, IDisposable { private IWebHost _fakeConsulBuilder; private readonly List _serviceEntries; diff --git a/test/Ocelot.UnitTests/Consul/OcelotBuilderExtensionsTests.cs b/test/Ocelot.UnitTests/Consul/OcelotBuilderExtensionsTests.cs index f324f4b4d..b9c7532c0 100644 --- a/test/Ocelot.UnitTests/Consul/OcelotBuilderExtensionsTests.cs +++ b/test/Ocelot.UnitTests/Consul/OcelotBuilderExtensionsTests.cs @@ -7,7 +7,7 @@ namespace Ocelot.UnitTests.Consul { - public class OcelotBuilderExtensionsTests + public class OcelotBuilderExtensionsTests : UnitTest { private readonly IServiceCollection _services; private readonly IConfiguration _configRoot; diff --git a/test/Ocelot.UnitTests/Consul/PollingConsulServiceDiscoveryProviderTests.cs b/test/Ocelot.UnitTests/Consul/PollingConsulServiceDiscoveryProviderTests.cs index a5dc99585..5b8eda527 100644 --- a/test/Ocelot.UnitTests/Consul/PollingConsulServiceDiscoveryProviderTests.cs +++ b/test/Ocelot.UnitTests/Consul/PollingConsulServiceDiscoveryProviderTests.cs @@ -6,7 +6,7 @@ namespace Ocelot.UnitTests.Consul { - public class PollingConsulServiceDiscoveryProviderTests + public class PollingConsulServiceDiscoveryProviderTests : UnitTest { private readonly int _delay; private readonly List _services; diff --git a/test/Ocelot.UnitTests/Controllers/FileConfigurationControllerTests.cs b/test/Ocelot.UnitTests/Controllers/FileConfigurationControllerTests.cs index 1b143273f..aa21ff625 100644 --- a/test/Ocelot.UnitTests/Controllers/FileConfigurationControllerTests.cs +++ b/test/Ocelot.UnitTests/Controllers/FileConfigurationControllerTests.cs @@ -8,7 +8,7 @@ namespace Ocelot.UnitTests.Controllers { - public class FileConfigurationControllerTests + public class FileConfigurationControllerTests : UnitTest { private readonly FileConfigurationController _controller; private readonly Mock _repo; diff --git a/test/Ocelot.UnitTests/Controllers/OutputCacheControllerTests.cs b/test/Ocelot.UnitTests/Controllers/OutputCacheControllerTests.cs index 067d06c68..71c2b4fa6 100644 --- a/test/Ocelot.UnitTests/Controllers/OutputCacheControllerTests.cs +++ b/test/Ocelot.UnitTests/Controllers/OutputCacheControllerTests.cs @@ -3,7 +3,7 @@ namespace Ocelot.UnitTests.Controllers { - public class OutputCacheControllerTests + public class OutputCacheControllerTests : UnitTest { private readonly OutputCacheController _controller; private readonly Mock> _cache; diff --git a/test/Ocelot.UnitTests/DependencyInjection/ConfigurationBuilderExtensionsTests.cs b/test/Ocelot.UnitTests/DependencyInjection/ConfigurationBuilderExtensionsTests.cs index 3514ca97d..f0e322fa8 100644 --- a/test/Ocelot.UnitTests/DependencyInjection/ConfigurationBuilderExtensionsTests.cs +++ b/test/Ocelot.UnitTests/DependencyInjection/ConfigurationBuilderExtensionsTests.cs @@ -199,14 +199,14 @@ private void GivenMultipleConfigurationFiles(string folder, bool withEnvironment RequestIdKey = "RequestIdKey", }; - private static List GetFileAggregatesRouteData() => - [ + private static List GetFileAggregatesRouteData() => new() + { new() { - RouteKeys = [ "KeyB", "KeyBB" ], + RouteKeys = new() { "KeyB", "KeyBB" }, UpstreamPathTemplate = "UpstreamPathTemplate", }, - ]; + }; private static FileRoute GetRoute(string suffix) => new() { @@ -214,16 +214,16 @@ private static List GetFileAggregatesRouteData() => DownstreamPathTemplate = "DownstreamPathTemplate" + suffix, Key = "Key" + suffix, UpstreamHost = "UpstreamHost" + suffix, - UpstreamHttpMethod = ["UpstreamHttpMethod" + suffix], - DownstreamHostAndPorts = - [ + UpstreamHttpMethod = new() { "UpstreamHttpMethod" + suffix }, + DownstreamHostAndPorts = new() + { new("Host"+suffix, 80), - ], + }, }; - private static List GetServiceARoutes() => [GetRoute("A")]; - private static List GetServiceBRoutes() => [GetRoute("B"), GetRoute("BB")]; - private static List GetEnvironmentSpecificRoutes() => [GetRoute("Spec")]; + private static List GetServiceARoutes() => new() { GetRoute("A") }; + private static List GetServiceBRoutes() => new() { GetRoute("B"), GetRoute("BB") }; + private static List GetEnvironmentSpecificRoutes() => new() { GetRoute("Spec") }; private void GivenTheEnvironmentIs(string folder, [CallerMemberName] string testName = null) { diff --git a/test/Ocelot.UnitTests/DependencyInjection/OcelotBuilderTests.cs b/test/Ocelot.UnitTests/DependencyInjection/OcelotBuilderTests.cs index 3879d4c0a..262014927 100644 --- a/test/Ocelot.UnitTests/DependencyInjection/OcelotBuilderTests.cs +++ b/test/Ocelot.UnitTests/DependencyInjection/OcelotBuilderTests.cs @@ -27,7 +27,7 @@ namespace Ocelot.UnitTests.DependencyInjection { - public class OcelotBuilderTests + public class OcelotBuilderTests : UnitTest { private readonly IConfiguration _configRoot; private readonly IServiceCollection _services; diff --git a/test/Ocelot.UnitTests/DependencyInjection/ServiceCollectionExtensionsTests.cs b/test/Ocelot.UnitTests/DependencyInjection/ServiceCollectionExtensionsTests.cs index 2ff94d48f..87a7c97d9 100644 --- a/test/Ocelot.UnitTests/DependencyInjection/ServiceCollectionExtensionsTests.cs +++ b/test/Ocelot.UnitTests/DependencyInjection/ServiceCollectionExtensionsTests.cs @@ -41,7 +41,7 @@ public void FindConfiguration_HasDescriptor_HappyPath(bool hasConfig) // Act var method = typeof(Extensions).GetMethod("FindConfiguration", BindingFlags.NonPublic | BindingFlags.Static); - var actual = (IConfiguration)method.Invoke(null, [services, env]); + var actual = (IConfiguration)method.Invoke(null, new object[] { services, env }); // Assert actual.ShouldNotBeNull(); diff --git a/test/Ocelot.UnitTests/DownstreamPathManipulation/ChangeDownstreamPathTemplateTests.cs b/test/Ocelot.UnitTests/DownstreamPathManipulation/ChangeDownstreamPathTemplateTests.cs index 3281aaa1a..efe212166 100644 --- a/test/Ocelot.UnitTests/DownstreamPathManipulation/ChangeDownstreamPathTemplateTests.cs +++ b/test/Ocelot.UnitTests/DownstreamPathManipulation/ChangeDownstreamPathTemplateTests.cs @@ -11,7 +11,7 @@ namespace Ocelot.UnitTests.DownstreamPathManipulation { - public class ChangeDownstreamPathTemplateTests + public class ChangeDownstreamPathTemplateTests : UnitTest { private readonly ChangeDownstreamPathTemplate _changeDownstreamPath; private DownstreamPathTemplate _downstreamPathTemplate; diff --git a/test/Ocelot.UnitTests/DownstreamPathManipulation/ClaimsToDownstreamPathMiddlewareTests.cs b/test/Ocelot.UnitTests/DownstreamPathManipulation/ClaimsToDownstreamPathMiddlewareTests.cs index 9be0a8f02..4a1fcd7f3 100644 --- a/test/Ocelot.UnitTests/DownstreamPathManipulation/ClaimsToDownstreamPathMiddlewareTests.cs +++ b/test/Ocelot.UnitTests/DownstreamPathManipulation/ClaimsToDownstreamPathMiddlewareTests.cs @@ -13,7 +13,7 @@ namespace Ocelot.UnitTests.DownstreamPathManipulation { - public class ClaimsToDownstreamPathMiddlewareTests + public class ClaimsToDownstreamPathMiddlewareTests : UnitTest { private readonly Mock _changePath; private readonly Mock _loggerFactory; diff --git a/test/Ocelot.UnitTests/DownstreamRouteFinder/DownstreamRouteCreatorTests.cs b/test/Ocelot.UnitTests/DownstreamRouteFinder/DownstreamRouteCreatorTests.cs index 0ead908aa..86ba4078a 100644 --- a/test/Ocelot.UnitTests/DownstreamRouteFinder/DownstreamRouteCreatorTests.cs +++ b/test/Ocelot.UnitTests/DownstreamRouteFinder/DownstreamRouteCreatorTests.cs @@ -7,7 +7,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder { - public class DownstreamRouteCreatorTests + public class DownstreamRouteCreatorTests : UnitTest { private readonly DownstreamRouteCreator _creator; private readonly QoSOptions _qoSOptions; diff --git a/test/Ocelot.UnitTests/DownstreamRouteFinder/DownstreamRouteFinderMiddlewareTests.cs b/test/Ocelot.UnitTests/DownstreamRouteFinder/DownstreamRouteFinderMiddlewareTests.cs index f743f6914..6d331a36e 100644 --- a/test/Ocelot.UnitTests/DownstreamRouteFinder/DownstreamRouteFinderMiddlewareTests.cs +++ b/test/Ocelot.UnitTests/DownstreamRouteFinder/DownstreamRouteFinderMiddlewareTests.cs @@ -11,7 +11,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder { - public class DownstreamRouteFinderMiddlewareTests + public class DownstreamRouteFinderMiddlewareTests : UnitTest { private readonly Mock _finder; private readonly Mock _factory; diff --git a/test/Ocelot.UnitTests/DownstreamRouteFinder/DownstreamRouteFinderTests.cs b/test/Ocelot.UnitTests/DownstreamRouteFinder/DownstreamRouteFinderTests.cs index 46654d8f4..e9b2bf8ed 100644 --- a/test/Ocelot.UnitTests/DownstreamRouteFinder/DownstreamRouteFinderTests.cs +++ b/test/Ocelot.UnitTests/DownstreamRouteFinder/DownstreamRouteFinderTests.cs @@ -8,7 +8,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder { - public class DownstreamRouteFinderTests + public class DownstreamRouteFinderTests : UnitTest { private readonly IDownstreamRouteProvider _downstreamRouteFinder; private readonly Mock _mockMatcher; diff --git a/test/Ocelot.UnitTests/DownstreamRouteFinder/DownstreamRouteProviderFactoryTests.cs b/test/Ocelot.UnitTests/DownstreamRouteFinder/DownstreamRouteProviderFactoryTests.cs index 209d67b72..db89a5eeb 100644 --- a/test/Ocelot.UnitTests/DownstreamRouteFinder/DownstreamRouteProviderFactoryTests.cs +++ b/test/Ocelot.UnitTests/DownstreamRouteFinder/DownstreamRouteProviderFactoryTests.cs @@ -9,7 +9,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder { using Ocelot.DownstreamRouteFinder.Finder; - public class DownstreamRouteProviderFactoryTests + public class DownstreamRouteProviderFactoryTests : UnitTest { private readonly DownstreamRouteProviderFactory _factory; private IInternalConfiguration _config; diff --git a/test/Ocelot.UnitTests/DownstreamRouteFinder/UrlMatcher/RegExUrlMatcherTests.cs b/test/Ocelot.UnitTests/DownstreamRouteFinder/UrlMatcher/RegExUrlMatcherTests.cs index 6cddb2f53..4117fc562 100644 --- a/test/Ocelot.UnitTests/DownstreamRouteFinder/UrlMatcher/RegExUrlMatcherTests.cs +++ b/test/Ocelot.UnitTests/DownstreamRouteFinder/UrlMatcher/RegExUrlMatcherTests.cs @@ -4,7 +4,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder.UrlMatcher { - public class RegExUrlMatcherTests + public class RegExUrlMatcherTests : UnitTest { private readonly IUrlPathToUrlTemplateMatcher _urlMatcher; private string _path; diff --git a/test/Ocelot.UnitTests/DownstreamRouteFinder/UrlMatcher/UrlPathPlaceholderNameAndValueFinderTests.cs b/test/Ocelot.UnitTests/DownstreamRouteFinder/UrlMatcher/UrlPathPlaceholderNameAndValueFinderTests.cs index 606b63714..4dc610a50 100644 --- a/test/Ocelot.UnitTests/DownstreamRouteFinder/UrlMatcher/UrlPathPlaceholderNameAndValueFinderTests.cs +++ b/test/Ocelot.UnitTests/DownstreamRouteFinder/UrlMatcher/UrlPathPlaceholderNameAndValueFinderTests.cs @@ -3,7 +3,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder.UrlMatcher { - public class UrlPathPlaceholderNameAndValueFinderTests + public class UrlPathPlaceholderNameAndValueFinderTests : UnitTest { private readonly IPlaceholderNameAndValueFinder _finder; private string _downstreamUrlPath; diff --git a/test/Ocelot.UnitTests/DownstreamUrlCreator/DownstreamPathPlaceholderReplacerTests.cs b/test/Ocelot.UnitTests/DownstreamUrlCreator/DownstreamPathPlaceholderReplacerTests.cs index b7ff203dd..0f25294ee 100644 --- a/test/Ocelot.UnitTests/DownstreamUrlCreator/DownstreamPathPlaceholderReplacerTests.cs +++ b/test/Ocelot.UnitTests/DownstreamUrlCreator/DownstreamPathPlaceholderReplacerTests.cs @@ -7,7 +7,7 @@ namespace Ocelot.UnitTests.DownstreamUrlCreator { - public class DownstreamPathPlaceholderReplacerTests + public class DownstreamPathPlaceholderReplacerTests : UnitTest { private DownstreamRouteHolder _downstreamRoute; private Response _result; diff --git a/test/Ocelot.UnitTests/DownstreamUrlCreator/DownstreamUrlCreatorMiddlewareTests.cs b/test/Ocelot.UnitTests/DownstreamUrlCreator/DownstreamUrlCreatorMiddlewareTests.cs index c6529e33d..615eb704e 100644 --- a/test/Ocelot.UnitTests/DownstreamUrlCreator/DownstreamUrlCreatorMiddlewareTests.cs +++ b/test/Ocelot.UnitTests/DownstreamUrlCreator/DownstreamUrlCreatorMiddlewareTests.cs @@ -14,7 +14,7 @@ namespace Ocelot.UnitTests.DownstreamUrlCreator { - public class DownstreamUrlCreatorMiddlewareTests + public class DownstreamUrlCreatorMiddlewareTests : UnitTest { private readonly Mock _downstreamUrlTemplateVariableReplacer; private OkResponse _downstreamPath; diff --git a/test/Ocelot.UnitTests/Errors/ExceptionHandlerMiddlewareTests.cs b/test/Ocelot.UnitTests/Errors/ExceptionHandlerMiddlewareTests.cs index b59c0bb68..ab72f90e2 100644 --- a/test/Ocelot.UnitTests/Errors/ExceptionHandlerMiddlewareTests.cs +++ b/test/Ocelot.UnitTests/Errors/ExceptionHandlerMiddlewareTests.cs @@ -7,7 +7,7 @@ namespace Ocelot.UnitTests.Errors { - public class ExceptionHandlerMiddlewareTests + public class ExceptionHandlerMiddlewareTests : UnitTest { private bool _shouldThrowAnException; private readonly Mock _repo; diff --git a/test/Ocelot.UnitTests/Eureka/EurekaServiceDiscoveryProviderTests.cs b/test/Ocelot.UnitTests/Eureka/EurekaServiceDiscoveryProviderTests.cs index b14534afc..fe92101c3 100644 --- a/test/Ocelot.UnitTests/Eureka/EurekaServiceDiscoveryProviderTests.cs +++ b/test/Ocelot.UnitTests/Eureka/EurekaServiceDiscoveryProviderTests.cs @@ -5,7 +5,7 @@ namespace Ocelot.UnitTests.Eureka { - public class EurekaServiceDiscoveryProviderTests + public class EurekaServiceDiscoveryProviderTests : UnitTest { private readonly _Eureka_ _provider; private readonly Mock _client; diff --git a/test/Ocelot.UnitTests/FileUnitTest.cs b/test/Ocelot.UnitTests/FileUnitTest.cs index 1b81b7e8b..34c9de0a7 100644 --- a/test/Ocelot.UnitTests/FileUnitTest.cs +++ b/test/Ocelot.UnitTests/FileUnitTest.cs @@ -16,12 +16,17 @@ protected FileUnitTest(string folder) { folder ??= TestID; Directory.CreateDirectory(folder); - _folders = [folder]; + _folders = new() { folder }; _primaryConfigFileName = Path.Combine(folder, ConfigurationBuilderExtensions.PrimaryConfigFile); _globalConfigFileName = Path.Combine(folder, ConfigurationBuilderExtensions.GlobalConfigFile); _environmentConfigFileName = Path.Combine(folder, string.Format(ConfigurationBuilderExtensions.EnvironmentConfigFile, EnvironmentName())); - _files = [_primaryConfigFileName, _globalConfigFileName, _environmentConfigFileName]; + _files = new() + { + _primaryConfigFileName, + _globalConfigFileName, + _environmentConfigFileName, + }; } protected virtual string EnvironmentName() => TestID; diff --git a/test/Ocelot.UnitTests/Headers/AddHeadersToRequestClaimToThingTests.cs b/test/Ocelot.UnitTests/Headers/AddHeadersToRequestClaimToThingTests.cs index 8cfcca4fd..d2a1cda2d 100644 --- a/test/Ocelot.UnitTests/Headers/AddHeadersToRequestClaimToThingTests.cs +++ b/test/Ocelot.UnitTests/Headers/AddHeadersToRequestClaimToThingTests.cs @@ -10,7 +10,7 @@ namespace Ocelot.UnitTests.Headers { - public class AddHeadersToRequestClaimToThingTests + public class AddHeadersToRequestClaimToThingTests : UnitTest { private readonly AddHeadersToRequest _addHeadersToRequest; private readonly Mock _parser; diff --git a/test/Ocelot.UnitTests/Headers/AddHeadersToRequestPlainTests.cs b/test/Ocelot.UnitTests/Headers/AddHeadersToRequestPlainTests.cs index d4c75ed7e..0b30141cf 100644 --- a/test/Ocelot.UnitTests/Headers/AddHeadersToRequestPlainTests.cs +++ b/test/Ocelot.UnitTests/Headers/AddHeadersToRequestPlainTests.cs @@ -10,7 +10,7 @@ namespace Ocelot.UnitTests.Headers { - public class AddHeadersToRequestPlainTests + public class AddHeadersToRequestPlainTests : UnitTest { private readonly AddHeadersToRequest _addHeadersToRequest; private HttpContext _context; diff --git a/test/Ocelot.UnitTests/Headers/AddHeadersToResponseTests.cs b/test/Ocelot.UnitTests/Headers/AddHeadersToResponseTests.cs index 4563965bb..b0a6e0514 100644 --- a/test/Ocelot.UnitTests/Headers/AddHeadersToResponseTests.cs +++ b/test/Ocelot.UnitTests/Headers/AddHeadersToResponseTests.cs @@ -8,7 +8,7 @@ namespace Ocelot.UnitTests.Headers { - public class AddHeadersToResponseTests + public class AddHeadersToResponseTests : UnitTest { private readonly IAddHeadersToResponse _adder; private readonly Mock _placeholders; diff --git a/test/Ocelot.UnitTests/Headers/ClaimsToHeadersMiddlewareTests.cs b/test/Ocelot.UnitTests/Headers/ClaimsToHeadersMiddlewareTests.cs index 7188500fd..9e2eec2b1 100644 --- a/test/Ocelot.UnitTests/Headers/ClaimsToHeadersMiddlewareTests.cs +++ b/test/Ocelot.UnitTests/Headers/ClaimsToHeadersMiddlewareTests.cs @@ -11,7 +11,7 @@ namespace Ocelot.UnitTests.Headers { - public class ClaimsToHeadersMiddlewareTests + public class ClaimsToHeadersMiddlewareTests : UnitTest { private readonly Mock _addHeaders; private Response _downstreamRoute; diff --git a/test/Ocelot.UnitTests/Headers/HttpContextRequestHeaderReplacerTests.cs b/test/Ocelot.UnitTests/Headers/HttpContextRequestHeaderReplacerTests.cs index 51fe342b1..18021084d 100644 --- a/test/Ocelot.UnitTests/Headers/HttpContextRequestHeaderReplacerTests.cs +++ b/test/Ocelot.UnitTests/Headers/HttpContextRequestHeaderReplacerTests.cs @@ -5,7 +5,7 @@ namespace Ocelot.UnitTests.Headers { - public class HttpContextRequestHeaderReplacerTests + public class HttpContextRequestHeaderReplacerTests : UnitTest { private HttpContext _context; private List _fAndRs; diff --git a/test/Ocelot.UnitTests/Headers/HttpHeadersTransformationMiddlewareTests.cs b/test/Ocelot.UnitTests/Headers/HttpHeadersTransformationMiddlewareTests.cs index d9441462b..f61c72896 100644 --- a/test/Ocelot.UnitTests/Headers/HttpHeadersTransformationMiddlewareTests.cs +++ b/test/Ocelot.UnitTests/Headers/HttpHeadersTransformationMiddlewareTests.cs @@ -10,7 +10,7 @@ namespace Ocelot.UnitTests.Headers { - public class HttpHeadersTransformationMiddlewareTests + public class HttpHeadersTransformationMiddlewareTests : UnitTest { private readonly Mock _preReplacer; private readonly Mock _postReplacer; diff --git a/test/Ocelot.UnitTests/Headers/HttpResponseHeaderReplacerTests.cs b/test/Ocelot.UnitTests/Headers/HttpResponseHeaderReplacerTests.cs index 82e98c0f2..8ccef9447 100644 --- a/test/Ocelot.UnitTests/Headers/HttpResponseHeaderReplacerTests.cs +++ b/test/Ocelot.UnitTests/Headers/HttpResponseHeaderReplacerTests.cs @@ -9,7 +9,7 @@ namespace Ocelot.UnitTests.Headers { - public class HttpResponseHeaderReplacerTests + public class HttpResponseHeaderReplacerTests : UnitTest { private DownstreamResponse _response; private readonly Placeholders _placeholders; diff --git a/test/Ocelot.UnitTests/Headers/RemoveHeadersTests.cs b/test/Ocelot.UnitTests/Headers/RemoveHeadersTests.cs index 12df11575..f39192295 100644 --- a/test/Ocelot.UnitTests/Headers/RemoveHeadersTests.cs +++ b/test/Ocelot.UnitTests/Headers/RemoveHeadersTests.cs @@ -3,7 +3,7 @@ namespace Ocelot.UnitTests.Headers { - public class RemoveHeadersTests + public class RemoveHeadersTests : UnitTest { private List
_headers; private readonly Ocelot.Headers.RemoveOutputHeaders _removeOutputHeaders; diff --git a/test/Ocelot.UnitTests/Infrastructure/ClaimParserTests.cs b/test/Ocelot.UnitTests/Infrastructure/ClaimParserTests.cs index ddcf726ac..9c5f7bf10 100644 --- a/test/Ocelot.UnitTests/Infrastructure/ClaimParserTests.cs +++ b/test/Ocelot.UnitTests/Infrastructure/ClaimParserTests.cs @@ -5,7 +5,7 @@ namespace Ocelot.UnitTests.Infrastructure { - public class ClaimParserTests + public class ClaimParserTests : UnitTest { private readonly IClaimsParser _claimsParser; private readonly List _claims; diff --git a/test/Ocelot.UnitTests/Infrastructure/HttpDataRepositoryTests.cs b/test/Ocelot.UnitTests/Infrastructure/HttpDataRepositoryTests.cs index 191cc0499..17e21a622 100644 --- a/test/Ocelot.UnitTests/Infrastructure/HttpDataRepositoryTests.cs +++ b/test/Ocelot.UnitTests/Infrastructure/HttpDataRepositoryTests.cs @@ -4,7 +4,7 @@ namespace Ocelot.UnitTests.Infrastructure { - public class HttpDataRepositoryTests + public class HttpDataRepositoryTests : UnitTest { private readonly HttpContext _httpContext; private readonly IHttpContextAccessor _httpContextAccessor; diff --git a/test/Ocelot.UnitTests/Infrastructure/IScopedRequestDataRepository.cs b/test/Ocelot.UnitTests/Infrastructure/IScopedRequestDataRepository.cs deleted file mode 100644 index 8b1378917..000000000 --- a/test/Ocelot.UnitTests/Infrastructure/IScopedRequestDataRepository.cs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/Ocelot.UnitTests/Infrastructure/ScopesAuthorizerTests.cs b/test/Ocelot.UnitTests/Infrastructure/ScopesAuthorizerTests.cs index f580a746a..b94774bbe 100644 --- a/test/Ocelot.UnitTests/Infrastructure/ScopesAuthorizerTests.cs +++ b/test/Ocelot.UnitTests/Infrastructure/ScopesAuthorizerTests.cs @@ -6,7 +6,7 @@ namespace Ocelot.UnitTests.Infrastructure { - public class ScopesAuthorizerTests + public class ScopesAuthorizerTests : UnitTest { private readonly ScopesAuthorizer _authorizer; public Mock _parser; diff --git a/test/Ocelot.UnitTests/Kubernetes/KubeTests.cs b/test/Ocelot.UnitTests/Kubernetes/KubeTests.cs index 49e91fe6e..10207d6f4 100644 --- a/test/Ocelot.UnitTests/Kubernetes/KubeTests.cs +++ b/test/Ocelot.UnitTests/Kubernetes/KubeTests.cs @@ -10,7 +10,7 @@ namespace Ocelot.UnitTests.Kubernetes { - public class KubeTests : IDisposable + public class KubeTests : UnitTest, IDisposable { private IWebHost _fakeKubeBuilder; private readonly Kube _provider; diff --git a/test/Ocelot.UnitTests/Kubernetes/OcelotBuilderExtensionsTests.cs b/test/Ocelot.UnitTests/Kubernetes/OcelotBuilderExtensionsTests.cs index 2f32b562d..d3c0b9967 100644 --- a/test/Ocelot.UnitTests/Kubernetes/OcelotBuilderExtensionsTests.cs +++ b/test/Ocelot.UnitTests/Kubernetes/OcelotBuilderExtensionsTests.cs @@ -7,7 +7,7 @@ namespace Ocelot.UnitTests.Kubernetes { - public class OcelotBuilderExtensionsTests + public class OcelotBuilderExtensionsTests : UnitTest { private readonly IServiceCollection _services; private readonly IConfiguration _configRoot; diff --git a/test/Ocelot.UnitTests/Kubernetes/PollKubeTests.cs b/test/Ocelot.UnitTests/Kubernetes/PollKubeTests.cs index d041288f6..794589bc3 100644 --- a/test/Ocelot.UnitTests/Kubernetes/PollKubeTests.cs +++ b/test/Ocelot.UnitTests/Kubernetes/PollKubeTests.cs @@ -6,7 +6,7 @@ namespace Ocelot.UnitTests.Kubernetes { - public class PollKubeTests + public class PollKubeTests : UnitTest { private readonly int _delay; private PollKube _provider; diff --git a/test/Ocelot.UnitTests/LoadBalancer/CookieStickySessionsCreatorTests.cs b/test/Ocelot.UnitTests/LoadBalancer/CookieStickySessionsCreatorTests.cs index 601e837e9..682ea9d41 100644 --- a/test/Ocelot.UnitTests/LoadBalancer/CookieStickySessionsCreatorTests.cs +++ b/test/Ocelot.UnitTests/LoadBalancer/CookieStickySessionsCreatorTests.cs @@ -6,7 +6,7 @@ namespace Ocelot.UnitTests.LoadBalancer { - public class CookieStickySessionsCreatorTests + public class CookieStickySessionsCreatorTests : UnitTest { private readonly CookieStickySessionsCreator _creator; private readonly Mock _serviceProvider; diff --git a/test/Ocelot.UnitTests/LoadBalancer/CookieStickySessionsTests.cs b/test/Ocelot.UnitTests/LoadBalancer/CookieStickySessionsTests.cs index 615218deb..71c4d0517 100644 --- a/test/Ocelot.UnitTests/LoadBalancer/CookieStickySessionsTests.cs +++ b/test/Ocelot.UnitTests/LoadBalancer/CookieStickySessionsTests.cs @@ -8,7 +8,7 @@ namespace Ocelot.UnitTests.LoadBalancer { - public class CookieStickySessionsTests + public class CookieStickySessionsTests : UnitTest { private readonly CookieStickySessions _stickySessions; private readonly Mock _loadBalancer; diff --git a/test/Ocelot.UnitTests/LoadBalancer/DelegateInvokingLoadBalancerCreatorTests.cs b/test/Ocelot.UnitTests/LoadBalancer/DelegateInvokingLoadBalancerCreatorTests.cs index 6631051fc..deb25a12e 100644 --- a/test/Ocelot.UnitTests/LoadBalancer/DelegateInvokingLoadBalancerCreatorTests.cs +++ b/test/Ocelot.UnitTests/LoadBalancer/DelegateInvokingLoadBalancerCreatorTests.cs @@ -8,7 +8,7 @@ namespace Ocelot.UnitTests.LoadBalancer { - public class DelegateInvokingLoadBalancerCreatorTests + public class DelegateInvokingLoadBalancerCreatorTests : UnitTest { private DelegateInvokingLoadBalancerCreator _creator; private Func _creatorFunc; diff --git a/test/Ocelot.UnitTests/LoadBalancer/LeastConnectionCreatorTests.cs b/test/Ocelot.UnitTests/LoadBalancer/LeastConnectionCreatorTests.cs index e94cfc5b6..e56fa8f7b 100644 --- a/test/Ocelot.UnitTests/LoadBalancer/LeastConnectionCreatorTests.cs +++ b/test/Ocelot.UnitTests/LoadBalancer/LeastConnectionCreatorTests.cs @@ -6,7 +6,7 @@ namespace Ocelot.UnitTests.LoadBalancer { - public class LeastConnectionCreatorTests + public class LeastConnectionCreatorTests : UnitTest { private readonly LeastConnectionCreator _creator; private readonly Mock _serviceProvider; diff --git a/test/Ocelot.UnitTests/LoadBalancer/LeastConnectionTests.cs b/test/Ocelot.UnitTests/LoadBalancer/LeastConnectionTests.cs index 2766f58ab..368e866e6 100644 --- a/test/Ocelot.UnitTests/LoadBalancer/LeastConnectionTests.cs +++ b/test/Ocelot.UnitTests/LoadBalancer/LeastConnectionTests.cs @@ -5,7 +5,7 @@ namespace Ocelot.UnitTests.LoadBalancer { - public class LeastConnectionTests + public class LeastConnectionTests : UnitTest { private ServiceHostAndPort _hostAndPort; private Response _result; diff --git a/test/Ocelot.UnitTests/LoadBalancer/LoadBalancerFactoryTests.cs b/test/Ocelot.UnitTests/LoadBalancer/LoadBalancerFactoryTests.cs index 5eb21c6d7..616168548 100644 --- a/test/Ocelot.UnitTests/LoadBalancer/LoadBalancerFactoryTests.cs +++ b/test/Ocelot.UnitTests/LoadBalancer/LoadBalancerFactoryTests.cs @@ -10,7 +10,7 @@ namespace Ocelot.UnitTests.LoadBalancer { - public class LoadBalancerFactoryTests + public class LoadBalancerFactoryTests : UnitTest { private DownstreamRoute _route; private readonly LoadBalancerFactory _factory; diff --git a/test/Ocelot.UnitTests/LoadBalancer/LoadBalancerHouseTests.cs b/test/Ocelot.UnitTests/LoadBalancer/LoadBalancerHouseTests.cs index 216bda84e..fa0b835ff 100644 --- a/test/Ocelot.UnitTests/LoadBalancer/LoadBalancerHouseTests.cs +++ b/test/Ocelot.UnitTests/LoadBalancer/LoadBalancerHouseTests.cs @@ -7,7 +7,7 @@ namespace Ocelot.UnitTests.LoadBalancer { - public class LoadBalancerHouseTests + public class LoadBalancerHouseTests : UnitTest { private DownstreamRoute _route; private ILoadBalancer _loadBalancer; diff --git a/test/Ocelot.UnitTests/LoadBalancer/LoadBalancerMiddlewareTests.cs b/test/Ocelot.UnitTests/LoadBalancer/LoadBalancerMiddlewareTests.cs index 411c43fd4..f5b5dd925 100644 --- a/test/Ocelot.UnitTests/LoadBalancer/LoadBalancerMiddlewareTests.cs +++ b/test/Ocelot.UnitTests/LoadBalancer/LoadBalancerMiddlewareTests.cs @@ -13,7 +13,7 @@ namespace Ocelot.UnitTests.LoadBalancer { - public class LoadBalancerMiddlewareTests + public class LoadBalancerMiddlewareTests : UnitTest { private readonly Mock _loadBalancerHouse; private readonly Mock _loadBalancer; diff --git a/test/Ocelot.UnitTests/LoadBalancer/NoLoadBalancerCreatorTests.cs b/test/Ocelot.UnitTests/LoadBalancer/NoLoadBalancerCreatorTests.cs index df478ec24..dadf453e1 100644 --- a/test/Ocelot.UnitTests/LoadBalancer/NoLoadBalancerCreatorTests.cs +++ b/test/Ocelot.UnitTests/LoadBalancer/NoLoadBalancerCreatorTests.cs @@ -6,7 +6,7 @@ namespace Ocelot.UnitTests.LoadBalancer { - public class NoLoadBalancerCreatorTests + public class NoLoadBalancerCreatorTests : UnitTest { private readonly NoLoadBalancerCreator _creator; private readonly Mock _serviceProvider; diff --git a/test/Ocelot.UnitTests/LoadBalancer/NoLoadBalancerTests.cs b/test/Ocelot.UnitTests/LoadBalancer/NoLoadBalancerTests.cs index 5e562352a..e1490e898 100644 --- a/test/Ocelot.UnitTests/LoadBalancer/NoLoadBalancerTests.cs +++ b/test/Ocelot.UnitTests/LoadBalancer/NoLoadBalancerTests.cs @@ -5,7 +5,7 @@ namespace Ocelot.UnitTests.LoadBalancer { - public class NoLoadBalancerTests + public class NoLoadBalancerTests : UnitTest { private readonly List _services; private NoLoadBalancer _loadBalancer; diff --git a/test/Ocelot.UnitTests/LoadBalancer/RoundRobinCreatorTests.cs b/test/Ocelot.UnitTests/LoadBalancer/RoundRobinCreatorTests.cs index 2b3d00d8a..13f5b6622 100644 --- a/test/Ocelot.UnitTests/LoadBalancer/RoundRobinCreatorTests.cs +++ b/test/Ocelot.UnitTests/LoadBalancer/RoundRobinCreatorTests.cs @@ -6,7 +6,7 @@ namespace Ocelot.UnitTests.LoadBalancer { - public class RoundRobinCreatorTests + public class RoundRobinCreatorTests : UnitTest { private readonly RoundRobinCreator _creator; private readonly Mock _serviceProvider; diff --git a/test/Ocelot.UnitTests/LoadBalancer/RoundRobinTests.cs b/test/Ocelot.UnitTests/LoadBalancer/RoundRobinTests.cs index 78196c13e..af55d65aa 100644 --- a/test/Ocelot.UnitTests/LoadBalancer/RoundRobinTests.cs +++ b/test/Ocelot.UnitTests/LoadBalancer/RoundRobinTests.cs @@ -6,7 +6,7 @@ namespace Ocelot.UnitTests.LoadBalancer { - public class RoundRobinTests + public class RoundRobinTests : UnitTest { private readonly RoundRobin _roundRobin; private readonly List _services; diff --git a/test/Ocelot.UnitTests/Logging/OcelotDiagnosticListenerTests.cs b/test/Ocelot.UnitTests/Logging/OcelotDiagnosticListenerTests.cs index d7ac54b64..94d3da1c7 100644 --- a/test/Ocelot.UnitTests/Logging/OcelotDiagnosticListenerTests.cs +++ b/test/Ocelot.UnitTests/Logging/OcelotDiagnosticListenerTests.cs @@ -4,7 +4,7 @@ namespace Ocelot.UnitTests.Logging { - public class OcelotDiagnosticListenerTests + public class OcelotDiagnosticListenerTests : UnitTest { private readonly OcelotDiagnosticListener _listener; private readonly Mock _factory; diff --git a/test/Ocelot.UnitTests/Middleware/BaseUrlFinderTests.cs b/test/Ocelot.UnitTests/Middleware/BaseUrlFinderTests.cs index 4049e08aa..e6db74c33 100644 --- a/test/Ocelot.UnitTests/Middleware/BaseUrlFinderTests.cs +++ b/test/Ocelot.UnitTests/Middleware/BaseUrlFinderTests.cs @@ -4,7 +4,7 @@ namespace Ocelot.UnitTests.Middleware { - public class BaseUrlFinderTests + public class BaseUrlFinderTests : UnitTest { private BaseUrlFinder _baseUrlFinder; private IConfiguration _config; diff --git a/test/Ocelot.UnitTests/Middleware/OcelotPipelineExtensionsTests.cs b/test/Ocelot.UnitTests/Middleware/OcelotPipelineExtensionsTests.cs index f7f41ae6a..7d2e4b75a 100644 --- a/test/Ocelot.UnitTests/Middleware/OcelotPipelineExtensionsTests.cs +++ b/test/Ocelot.UnitTests/Middleware/OcelotPipelineExtensionsTests.cs @@ -12,7 +12,7 @@ namespace Ocelot.UnitTests.Middleware { - public class OcelotPipelineExtensionsTests + public class OcelotPipelineExtensionsTests : UnitTest { private ApplicationBuilder _builder; private RequestDelegate _handlers; diff --git a/test/Ocelot.UnitTests/Middleware/OcelotPiplineBuilderTests.cs b/test/Ocelot.UnitTests/Middleware/OcelotPiplineBuilderTests.cs index 0cd2147c3..2948b70a6 100644 --- a/test/Ocelot.UnitTests/Middleware/OcelotPiplineBuilderTests.cs +++ b/test/Ocelot.UnitTests/Middleware/OcelotPiplineBuilderTests.cs @@ -11,7 +11,7 @@ namespace Ocelot.UnitTests.Middleware { - public class OcelotPiplineBuilderTests + public class OcelotPiplineBuilderTests : UnitTest { private readonly IServiceCollection _services; private readonly IConfiguration _configRoot; diff --git a/test/Ocelot.UnitTests/Multiplexing/DefinedAggregatorProviderTests.cs b/test/Ocelot.UnitTests/Multiplexing/DefinedAggregatorProviderTests.cs index b9a6c91b3..7a1c8e914 100644 --- a/test/Ocelot.UnitTests/Multiplexing/DefinedAggregatorProviderTests.cs +++ b/test/Ocelot.UnitTests/Multiplexing/DefinedAggregatorProviderTests.cs @@ -7,7 +7,7 @@ namespace Ocelot.UnitTests.Multiplexing { - public class DefinedAggregatorProviderTests + public class DefinedAggregatorProviderTests : UnitTest { private ServiceLocatorDefinedAggregatorProvider _provider; private Response _aggregator; diff --git a/test/Ocelot.UnitTests/Multiplexing/MultiplexingMiddlewareTests.cs b/test/Ocelot.UnitTests/Multiplexing/MultiplexingMiddlewareTests.cs index 633fae43b..95f41e863 100644 --- a/test/Ocelot.UnitTests/Multiplexing/MultiplexingMiddlewareTests.cs +++ b/test/Ocelot.UnitTests/Multiplexing/MultiplexingMiddlewareTests.cs @@ -13,7 +13,7 @@ namespace Ocelot.UnitTests.Multiplexing { - public class MultiplexingMiddlewareTests + public class MultiplexingMiddlewareTests : UnitTest { private MultiplexingMiddleware _middleware; private Ocelot.DownstreamRouteFinder.DownstreamRouteHolder _downstreamRoute; @@ -68,7 +68,7 @@ public void CreateThreadContext_CopyUser_ToTarget() // Act var method = _middleware.GetType().GetMethod("CreateThreadContext", BindingFlags.NonPublic | BindingFlags.Static); - var actual = (HttpContext)method.Invoke(_middleware, [_httpContext]); + var actual = (HttpContext)method.Invoke(_middleware, new object[] { _httpContext }); // Assert AssertUsers(actual); @@ -318,13 +318,11 @@ private static Route GivenRoutesWithAggregator() b.WithDownstreamRoute(route2); b.WithDownstreamRoute(route3); - b.WithAggregateRouteConfig( - [ - new AggregateRouteConfig - { RouteKey = "UserDetails", JsonPath = "$[*].writerId", Parameter = "userId" }, - new AggregateRouteConfig - { RouteKey = "PostDetails", JsonPath = "$[*].postId", Parameter = "postId" } - ]); + b.WithAggregateRouteConfig(new() + { + new AggregateRouteConfig { RouteKey = "UserDetails", JsonPath = "$[*].writerId", Parameter = "userId" }, + new AggregateRouteConfig { RouteKey = "PostDetails", JsonPath = "$[*].postId", Parameter = "postId" }, + }); b.WithAggregator("TestAggregator"); diff --git a/test/Ocelot.UnitTests/Multiplexing/ResponseAggregatorFactoryTests.cs b/test/Ocelot.UnitTests/Multiplexing/ResponseAggregatorFactoryTests.cs index 7db1d8faf..15a229573 100644 --- a/test/Ocelot.UnitTests/Multiplexing/ResponseAggregatorFactoryTests.cs +++ b/test/Ocelot.UnitTests/Multiplexing/ResponseAggregatorFactoryTests.cs @@ -4,7 +4,7 @@ namespace Ocelot.UnitTests.Multiplexing { - public class ResponseAggregatorFactoryTests + public class ResponseAggregatorFactoryTests : UnitTest { private readonly InMemoryResponseAggregatorFactory _factory; private readonly Mock _provider; diff --git a/test/Ocelot.UnitTests/Multiplexing/SimpleJsonResponseAggregatorTests.cs b/test/Ocelot.UnitTests/Multiplexing/SimpleJsonResponseAggregatorTests.cs index 45f7f2d92..fafda9bfd 100644 --- a/test/Ocelot.UnitTests/Multiplexing/SimpleJsonResponseAggregatorTests.cs +++ b/test/Ocelot.UnitTests/Multiplexing/SimpleJsonResponseAggregatorTests.cs @@ -11,7 +11,7 @@ namespace Ocelot.UnitTests.Multiplexing { - public class SimpleJsonResponseAggregatorTests + public class SimpleJsonResponseAggregatorTests : UnitTest { private readonly SimpleJsonResponseAggregator _aggregator; private List _downstreamContexts; diff --git a/test/Ocelot.UnitTests/Multiplexing/UserDefinedResponseAggregatorTests.cs b/test/Ocelot.UnitTests/Multiplexing/UserDefinedResponseAggregatorTests.cs index a960dc119..4a0349795 100644 --- a/test/Ocelot.UnitTests/Multiplexing/UserDefinedResponseAggregatorTests.cs +++ b/test/Ocelot.UnitTests/Multiplexing/UserDefinedResponseAggregatorTests.cs @@ -8,7 +8,7 @@ namespace Ocelot.UnitTests.Multiplexing { - public class UserDefinedResponseAggregatorTests + public class UserDefinedResponseAggregatorTests : UnitTest { private readonly UserDefinedResponseAggregator _aggregator; private readonly Mock _provider; diff --git a/test/Ocelot.UnitTests/Ocelot.UnitTests.csproj b/test/Ocelot.UnitTests/Ocelot.UnitTests.csproj index d9af1c858..30c2ca794 100644 --- a/test/Ocelot.UnitTests/Ocelot.UnitTests.csproj +++ b/test/Ocelot.UnitTests/Ocelot.UnitTests.csproj @@ -16,7 +16,8 @@ false ..\..\codeanalysis.ruleset True - 1591;CS0618 + ..\..\codeanalysis.ruleset + $(NoWarn);CS0618;CS1591 full diff --git a/test/Ocelot.UnitTests/Polly/PollyResiliencePipelineDelegatingHandlerTests.cs b/test/Ocelot.UnitTests/Polly/PollyResiliencePipelineDelegatingHandlerTests.cs index b1f448c6a..f144fe305 100644 --- a/test/Ocelot.UnitTests/Polly/PollyResiliencePipelineDelegatingHandlerTests.cs +++ b/test/Ocelot.UnitTests/Polly/PollyResiliencePipelineDelegatingHandlerTests.cs @@ -88,7 +88,7 @@ public async void SendAsync_OnePolicy() private async Task InvokeAsync(string methodName) { var m = typeof(PollyResiliencePipelineDelegatingHandler).GetMethod(methodName, BindingFlags.Instance | BindingFlags.NonPublic); - var task = (Task)m.Invoke(_sut, [new HttpRequestMessage(), CancellationToken.None]); + var task = (Task)m.Invoke(_sut, new object[] { new HttpRequestMessage(), CancellationToken.None }); var actual = await task!; return actual; } diff --git a/test/Ocelot.UnitTests/QueryStrings/AddQueriesToRequestTests.cs b/test/Ocelot.UnitTests/QueryStrings/AddQueriesToRequestTests.cs index 83c5b320a..5c2c3b794 100644 --- a/test/Ocelot.UnitTests/QueryStrings/AddQueriesToRequestTests.cs +++ b/test/Ocelot.UnitTests/QueryStrings/AddQueriesToRequestTests.cs @@ -8,7 +8,7 @@ namespace Ocelot.UnitTests.QueryStrings { - public class AddQueriesToRequestTests + public class AddQueriesToRequestTests : UnitTest { private readonly AddQueriesToRequest _addQueriesToRequest; private DownstreamRequest _downstreamRequest; diff --git a/test/Ocelot.UnitTests/QueryStrings/ClaimsToQueryStringMiddlewareTests.cs b/test/Ocelot.UnitTests/QueryStrings/ClaimsToQueryStringMiddlewareTests.cs index 731f3fa0e..bfb0af8aa 100644 --- a/test/Ocelot.UnitTests/QueryStrings/ClaimsToQueryStringMiddlewareTests.cs +++ b/test/Ocelot.UnitTests/QueryStrings/ClaimsToQueryStringMiddlewareTests.cs @@ -13,7 +13,7 @@ namespace Ocelot.UnitTests.QueryStrings { - public class ClaimsToQueryStringMiddlewareTests + public class ClaimsToQueryStringMiddlewareTests : UnitTest { private readonly Mock _addQueries; private readonly Mock _loggerFactory; diff --git a/test/Ocelot.UnitTests/RateLimit/ClientRateLimitMiddlewareTests.cs b/test/Ocelot.UnitTests/RateLimit/ClientRateLimitMiddlewareTests.cs index 0e6c66068..1c2267ae2 100644 --- a/test/Ocelot.UnitTests/RateLimit/ClientRateLimitMiddlewareTests.cs +++ b/test/Ocelot.UnitTests/RateLimit/ClientRateLimitMiddlewareTests.cs @@ -10,7 +10,7 @@ namespace Ocelot.UnitTests.RateLimit { - public class ClientRateLimitMiddlewareTests + public class ClientRateLimitMiddlewareTests : UnitTest { private readonly IRateLimitCounterHandler _rateLimitCounterHandler; private readonly Mock _loggerFactory; diff --git a/test/Ocelot.UnitTests/Repository/ScopedRequestDataRepositoryTests.cs b/test/Ocelot.UnitTests/Repository/ScopedRequestDataRepositoryTests.cs index 33b797025..ba6e2c9a3 100644 --- a/test/Ocelot.UnitTests/Repository/ScopedRequestDataRepositoryTests.cs +++ b/test/Ocelot.UnitTests/Repository/ScopedRequestDataRepositoryTests.cs @@ -4,7 +4,7 @@ namespace Ocelot.UnitTests.Repository { - public class ScopedRequestDataRepositoryTests + public class ScopedRequestDataRepositoryTests : UnitTest { private readonly IRequestScopedDataRepository _requestScopedDataRepository; private readonly IHttpContextAccessor _httpContextAccesor; diff --git a/test/Ocelot.UnitTests/Request/Creator/DownstreamRequestCreatorTests.cs b/test/Ocelot.UnitTests/Request/Creator/DownstreamRequestCreatorTests.cs index e61811314..7426b77aa 100644 --- a/test/Ocelot.UnitTests/Request/Creator/DownstreamRequestCreatorTests.cs +++ b/test/Ocelot.UnitTests/Request/Creator/DownstreamRequestCreatorTests.cs @@ -4,7 +4,7 @@ namespace Ocelot.UnitTests.Request.Creator { - public class DownstreamRequestCreatorTests + public class DownstreamRequestCreatorTests : UnitTest { private readonly Mock _framework; private readonly DownstreamRequestCreator _downstreamRequestCreator; diff --git a/test/Ocelot.UnitTests/Request/DownstreamRequestInitialiserMiddlewareTests.cs b/test/Ocelot.UnitTests/Request/DownstreamRequestInitialiserMiddlewareTests.cs index 854b70e6d..ed19d1aae 100644 --- a/test/Ocelot.UnitTests/Request/DownstreamRequestInitialiserMiddlewareTests.cs +++ b/test/Ocelot.UnitTests/Request/DownstreamRequestInitialiserMiddlewareTests.cs @@ -10,7 +10,7 @@ namespace Ocelot.UnitTests.Request; -public class DownstreamRequestInitialiserMiddlewareTests +public class DownstreamRequestInitialiserMiddlewareTests : UnitTest { private readonly DownstreamRequestInitialiserMiddleware _middleware; private readonly HttpContext _httpContext; diff --git a/test/Ocelot.UnitTests/Request/Mapper/RequestMapperTests.cs b/test/Ocelot.UnitTests/Request/Mapper/RequestMapperTests.cs index 624dc779e..6f06d0295 100644 --- a/test/Ocelot.UnitTests/Request/Mapper/RequestMapperTests.cs +++ b/test/Ocelot.UnitTests/Request/Mapper/RequestMapperTests.cs @@ -9,7 +9,7 @@ namespace Ocelot.UnitTests.Request.Mapper; -public class RequestMapperTests +public class RequestMapperTests : UnitTest { private readonly HttpRequest _inputRequest; private readonly RequestMapper _requestMapper; @@ -206,8 +206,9 @@ public void Should_handle_no_content_length() [Fact] public void Should_map_content_headers() - { - var md5Bytes = MD5.HashData("some md5"u8.ToArray()); + { + var bytes = Encoding.UTF8.GetBytes("some md5"); + var md5Bytes = MD5.HashData(bytes); this.Given(_ => GivenTheInputRequestHasContent("This is my content")) .And(_ => GivenTheContentTypeIs("application/json")) diff --git a/test/Ocelot.UnitTests/Request/Mapper/StreamHttpContentTests.cs b/test/Ocelot.UnitTests/Request/Mapper/StreamHttpContentTests.cs index b8ae8a50f..105bb85de 100644 --- a/test/Ocelot.UnitTests/Request/Mapper/StreamHttpContentTests.cs +++ b/test/Ocelot.UnitTests/Request/Mapper/StreamHttpContentTests.cs @@ -35,8 +35,9 @@ public async Task Copy_body_to_stream_with_unknown_length_and_stream_content_sho var bytes = Encoding.UTF8.GetBytes(PayLoad); using var inputStream = new MemoryStream(bytes); using var outputStream = new MemoryStream(); - await CopyAsyncTest(new StreamHttpContent(_httpContext), - [inputStream, outputStream, StreamHttpContent.UnknownLength, false, CancellationToken.None]); + await CopyAsyncTest( + new StreamHttpContent(_httpContext), + new object[] { inputStream, outputStream, StreamHttpContent.UnknownLength, false, CancellationToken.None }); inputStream.Position = 0; outputStream.Position = 0; var result = Encoding.UTF8.GetString(outputStream.ToArray()); @@ -49,8 +50,9 @@ public async Task Copy_body_to_stream_with_body_length_and_stream_content_should var bytes = Encoding.UTF8.GetBytes(PayLoad); using var inputStream = new MemoryStream(bytes); using var outputStream = new MemoryStream(); - await CopyAsyncTest(new StreamHttpContent(_httpContext), - [inputStream, outputStream, bytes.Length, false, CancellationToken.None]); + await CopyAsyncTest( + new StreamHttpContent(_httpContext), + new object[] { inputStream, outputStream, bytes.Length, false, CancellationToken.None }); inputStream.Position = 0; outputStream.Position = 0; var result = Encoding.UTF8.GetString(outputStream.ToArray()); @@ -64,8 +66,9 @@ public async Task Should_throw_if_passed_body_length_does_not_match_real_body_le using var inputStream = new MemoryStream(bytes); using var outputStream = new MemoryStream(); await Assert.ThrowsAsync(async () => - await CopyAsyncTest(new StreamHttpContent(_httpContext), - [inputStream, outputStream, 10, false, CancellationToken.None])); + await CopyAsyncTest( + new StreamHttpContent(_httpContext), + new object[] { inputStream, outputStream, 10, false, CancellationToken.None })); } private StreamHttpContent StreamHttpContentFactory() diff --git a/test/Ocelot.UnitTests/RequestId/RequestIdMiddlewareTests.cs b/test/Ocelot.UnitTests/RequestId/RequestIdMiddlewareTests.cs index 641f9c9cc..bac14d857 100644 --- a/test/Ocelot.UnitTests/RequestId/RequestIdMiddlewareTests.cs +++ b/test/Ocelot.UnitTests/RequestId/RequestIdMiddlewareTests.cs @@ -11,7 +11,7 @@ namespace Ocelot.UnitTests.RequestId { - public class RequestIdMiddlewareTests + public class RequestIdMiddlewareTests : UnitTest { private readonly HttpRequestMessage _downstreamRequest; private string _value; diff --git a/test/Ocelot.UnitTests/Requester/DelegatingHandlerHandlerProviderFactoryTests.cs b/test/Ocelot.UnitTests/Requester/DelegatingHandlerHandlerProviderFactoryTests.cs index a6c74c115..dde971d69 100644 --- a/test/Ocelot.UnitTests/Requester/DelegatingHandlerHandlerProviderFactoryTests.cs +++ b/test/Ocelot.UnitTests/Requester/DelegatingHandlerHandlerProviderFactoryTests.cs @@ -10,7 +10,7 @@ namespace Ocelot.UnitTests.Requester { - public class DelegatingHandlerHandlerProviderFactoryTests + public class DelegatingHandlerHandlerProviderFactoryTests : UnitTest { private DelegatingHandlerHandlerFactory _factory; private readonly Mock _loggerFactory; diff --git a/test/Ocelot.UnitTests/Requester/HttpRequesterMiddlewareTests.cs b/test/Ocelot.UnitTests/Requester/HttpRequesterMiddlewareTests.cs index 717ca04ad..9060494b6 100644 --- a/test/Ocelot.UnitTests/Requester/HttpRequesterMiddlewareTests.cs +++ b/test/Ocelot.UnitTests/Requester/HttpRequesterMiddlewareTests.cs @@ -9,7 +9,7 @@ namespace Ocelot.UnitTests.Requester { - public class HttpRequesterMiddlewareTests + public class HttpRequesterMiddlewareTests : UnitTest { private readonly Mock _requester; private Response _response; diff --git a/test/Ocelot.UnitTests/Requester/MessageInvokerPoolTests.cs b/test/Ocelot.UnitTests/Requester/MessageInvokerPoolTests.cs index fd4eb7d4d..57e3b803a 100644 --- a/test/Ocelot.UnitTests/Requester/MessageInvokerPoolTests.cs +++ b/test/Ocelot.UnitTests/Requester/MessageInvokerPoolTests.cs @@ -14,7 +14,7 @@ namespace Ocelot.UnitTests.Requester; [Trait("PR", "1824")] -public class MessageInvokerPoolTests +public class MessageInvokerPoolTests : UnitTest { private DownstreamRoute _downstreamRoute1; private DownstreamRoute _downstreamRoute2; @@ -321,7 +321,7 @@ private Mock GetHandlerFactory() { var handlerFactory = new Mock(); handlerFactory.Setup(x => x.Get(It.IsAny())) - .Returns(new OkResponse>>([])); + .Returns(new OkResponse>>(new())); return handlerFactory; } @@ -333,7 +333,7 @@ private DownstreamRoute DownstreamRouteFactory(string path) .WithLoadBalancerKey(string.Empty) .WithUpstreamPathTemplate(new UpstreamPathTemplateBuilder().WithOriginalValue(string.Empty).Build()) .WithHttpHandlerOptions(new HttpHandlerOptions(false, false, false, false, 10, TimeSpan.FromSeconds(120))) - .WithUpstreamHttpMethod(["Get"]) + .WithUpstreamHttpMethod(new() { "Get" }) .Build(); return downstreamRoute; diff --git a/test/Ocelot.UnitTests/Responder/ErrorsToHttpStatusCodeMapperTests.cs b/test/Ocelot.UnitTests/Responder/ErrorsToHttpStatusCodeMapperTests.cs index e80551117..da55e1752 100644 --- a/test/Ocelot.UnitTests/Responder/ErrorsToHttpStatusCodeMapperTests.cs +++ b/test/Ocelot.UnitTests/Responder/ErrorsToHttpStatusCodeMapperTests.cs @@ -3,7 +3,7 @@ namespace Ocelot.UnitTests.Responder { - public class ErrorsToHttpStatusCodeMapperTests + public class ErrorsToHttpStatusCodeMapperTests : UnitTest { private readonly IErrorsToHttpStatusCodeMapper _codeMapper; private int _result; @@ -86,7 +86,7 @@ public void should_return_not_found(OcelotErrorCode errorCode) [Fact] public void should_return_request_entity_too_large() { - ShouldMapErrorsToStatusCode([OcelotErrorCode.PayloadTooLargeError], HttpStatusCode.RequestEntityTooLarge); + ShouldMapErrorsToStatusCode(new() { OcelotErrorCode.PayloadTooLargeError }, HttpStatusCode.RequestEntityTooLarge); } [Fact] diff --git a/test/Ocelot.UnitTests/Responder/ResponderMiddlewareTests.cs b/test/Ocelot.UnitTests/Responder/ResponderMiddlewareTests.cs index bde95def8..5a8bc5644 100644 --- a/test/Ocelot.UnitTests/Responder/ResponderMiddlewareTests.cs +++ b/test/Ocelot.UnitTests/Responder/ResponderMiddlewareTests.cs @@ -8,7 +8,7 @@ namespace Ocelot.UnitTests.Responder { - public class ResponderMiddlewareTests + public class ResponderMiddlewareTests : UnitTest { private readonly Mock _responder; private readonly Mock _codeMapper; diff --git a/test/Ocelot.UnitTests/Security/IPSecurityPolicyTests.cs b/test/Ocelot.UnitTests/Security/IPSecurityPolicyTests.cs index bdc86842d..f32d46bb1 100644 --- a/test/Ocelot.UnitTests/Security/IPSecurityPolicyTests.cs +++ b/test/Ocelot.UnitTests/Security/IPSecurityPolicyTests.cs @@ -10,7 +10,7 @@ namespace Ocelot.UnitTests.Security { - public class IPSecurityPolicyTests + public class IPSecurityPolicyTests : UnitTest { private readonly DownstreamRouteBuilder _downstreamRouteBuilder; private readonly IPSecurityPolicy _ipSecurityPolicy; diff --git a/test/Ocelot.UnitTests/Security/SecurityMiddlewareTests.cs b/test/Ocelot.UnitTests/Security/SecurityMiddlewareTests.cs index e8310bb92..c24ccffc2 100644 --- a/test/Ocelot.UnitTests/Security/SecurityMiddlewareTests.cs +++ b/test/Ocelot.UnitTests/Security/SecurityMiddlewareTests.cs @@ -9,7 +9,7 @@ namespace Ocelot.UnitTests.Security { - public class SecurityMiddlewareTests + public class SecurityMiddlewareTests : UnitTest { private readonly List> _securityPolicyList; private readonly Mock _loggerFactory; diff --git a/test/Ocelot.UnitTests/ServiceDiscovery/ConfigurationServiceProviderTests.cs b/test/Ocelot.UnitTests/ServiceDiscovery/ConfigurationServiceProviderTests.cs index 1de3f5cea..ad1f7bb72 100644 --- a/test/Ocelot.UnitTests/ServiceDiscovery/ConfigurationServiceProviderTests.cs +++ b/test/Ocelot.UnitTests/ServiceDiscovery/ConfigurationServiceProviderTests.cs @@ -3,7 +3,7 @@ namespace Ocelot.UnitTests.ServiceDiscovery { - public class ConfigurationServiceProviderTests + public class ConfigurationServiceProviderTests : UnitTest { private ConfigurationServiceProvider _serviceProvider; private List _result; diff --git a/test/Ocelot.UnitTests/ServiceDiscovery/ServiceDiscoveryProviderFactoryTests.cs b/test/Ocelot.UnitTests/ServiceDiscovery/ServiceDiscoveryProviderFactoryTests.cs index 88d33f89c..8f416b2d4 100644 --- a/test/Ocelot.UnitTests/ServiceDiscovery/ServiceDiscoveryProviderFactoryTests.cs +++ b/test/Ocelot.UnitTests/ServiceDiscovery/ServiceDiscoveryProviderFactoryTests.cs @@ -11,7 +11,7 @@ namespace Ocelot.UnitTests.ServiceDiscovery { - public class ServiceDiscoveryProviderFactoryTests + public class ServiceDiscoveryProviderFactoryTests : UnitTest { private ServiceProviderConfiguration _serviceConfig; private Response _result; diff --git a/test/Ocelot.UnitTests/ServiceDiscovery/ServiceFabricServiceDiscoveryProviderTests.cs b/test/Ocelot.UnitTests/ServiceDiscovery/ServiceFabricServiceDiscoveryProviderTests.cs index 0836afffc..1032cbac5 100644 --- a/test/Ocelot.UnitTests/ServiceDiscovery/ServiceFabricServiceDiscoveryProviderTests.cs +++ b/test/Ocelot.UnitTests/ServiceDiscovery/ServiceFabricServiceDiscoveryProviderTests.cs @@ -4,7 +4,7 @@ namespace Ocelot.UnitTests.ServiceDiscovery { - public class ServiceFabricServiceDiscoveryProviderTests + public class ServiceFabricServiceDiscoveryProviderTests : UnitTest { private ServiceFabricServiceDiscoveryProvider _provider; private ServiceFabricConfiguration _config; diff --git a/test/Ocelot.UnitTests/ServiceDiscovery/ServiceRegistryTests.cs b/test/Ocelot.UnitTests/ServiceDiscovery/ServiceRegistryTests.cs index 22e6dc316..33670a0dd 100644 --- a/test/Ocelot.UnitTests/ServiceDiscovery/ServiceRegistryTests.cs +++ b/test/Ocelot.UnitTests/ServiceDiscovery/ServiceRegistryTests.cs @@ -3,7 +3,7 @@ // nothing in use namespace Ocelot.UnitTests.ServiceDiscovery { - public class ServiceRegistryTests + public class ServiceRegistryTests : UnitTest { private Service _service; private List _services; diff --git a/test/Ocelot.UnitTests/UnitTest.cs b/test/Ocelot.UnitTests/UnitTest.cs index aa7b716b3..a50782f5a 100644 --- a/test/Ocelot.UnitTests/UnitTest.cs +++ b/test/Ocelot.UnitTests/UnitTest.cs @@ -1,7 +1,14 @@ -namespace Ocelot.UnitTests; +using TestStack.BDDfy.Configuration; + +namespace Ocelot.UnitTests; public class UnitTest { + public UnitTest() + { + Configurator.Processors.ConsoleReport.Disable(); + } + protected readonly Guid _testId = Guid.NewGuid(); protected string TestID { get => _testId.ToString("N"); } diff --git a/test/Ocelot.UnitTests/WebSockets/WebSocketsProxyMiddlewareTests.cs b/test/Ocelot.UnitTests/WebSockets/WebSocketsProxyMiddlewareTests.cs index d5190ce01..42af9716d 100644 --- a/test/Ocelot.UnitTests/WebSockets/WebSocketsProxyMiddlewareTests.cs +++ b/test/Ocelot.UnitTests/WebSockets/WebSocketsProxyMiddlewareTests.cs @@ -9,7 +9,7 @@ namespace Ocelot.UnitTests.WebSockets; -public class WebSocketsProxyMiddlewareTests +public class WebSocketsProxyMiddlewareTests : UnitTest { private readonly WebSocketsProxyMiddleware _middleware;