reorganised project so its a bit more vertical for features

This commit is contained in:
TomPallister 2016-10-18 18:52:43 +01:00
parent 2e6640c6ef
commit f79b76b414
77 changed files with 324 additions and 298 deletions

View File

@ -1,7 +1,7 @@
namespace Ocelot.Library.Authentication
{
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http;
namespace Ocelot.Library.Authentication.Handler
{
public class AuthenticationHandler
{
public AuthenticationHandler(string provider, RequestDelegate handler)

View File

@ -1,9 +1,10 @@
namespace Ocelot.Library.Authentication
{
using IdentityServer4.AccessTokenValidation;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Responses;
using Ocelot.Library.Responses;
namespace Ocelot.Library.Authentication.Handler.Creator
{
using AuthenticationOptions = Configuration.AuthenticationOptions;
/// <summary>

View File

@ -1,8 +1,9 @@
namespace Ocelot.Library.Authentication
{
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Responses;
using Ocelot.Library.Responses;
namespace Ocelot.Library.Authentication.Handler.Creator
{
using AuthenticationOptions = Configuration.AuthenticationOptions;
public interface IAuthenticationHandlerCreator

View File

@ -1,9 +1,11 @@
namespace Ocelot.Library.Authentication
{
using System.Collections.Generic;
using Errors;
using Microsoft.AspNetCore.Builder;
using Responses;
using Ocelot.Library.Authentication.Handler.Creator;
using Ocelot.Library.Errors;
using Ocelot.Library.Responses;
namespace Ocelot.Library.Authentication.Handler.Factory
{
using AuthenticationOptions = Configuration.AuthenticationOptions;
public class AuthenticationHandlerFactory : IAuthenticationHandlerFactory

View File

@ -1,7 +1,8 @@
namespace Ocelot.Library.Authentication
using Microsoft.AspNetCore.Builder;
using Ocelot.Library.Responses;
namespace Ocelot.Library.Authentication.Handler.Factory
{
using Microsoft.AspNetCore.Builder;
using Responses;
using AuthenticationOptions = Configuration.AuthenticationOptions;
public interface IAuthenticationHandlerFactory

View File

@ -1,7 +1,7 @@
namespace Ocelot.Library.Authentication
{
using Errors;
using Ocelot.Library.Errors;
namespace Ocelot.Library.Authentication.Handler.Factory
{
public class UnableToCreateAuthenticationHandlerError : Error
{
public UnableToCreateAuthenticationHandlerError(string message)

View File

@ -0,0 +1,7 @@
namespace Ocelot.Library.Authentication.Handler
{
public enum SupportedAuthenticationProviders
{
IdentityServer
}
}

View File

@ -1,15 +1,16 @@
namespace Ocelot.Library.Middleware
{
using System.Collections.Generic;
using System.Collections.Generic;
using System.Threading.Tasks;
using Authentication;
using Configuration;
using DownstreamRouteFinder;
using Errors;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Repository;
using Ocelot.Library.Authentication.Handler.Factory;
using Ocelot.Library.Configuration;
using Ocelot.Library.DownstreamRouteFinder;
using Ocelot.Library.Errors;
using Ocelot.Library.Middleware;
using Ocelot.Library.ScopedData;
namespace Ocelot.Library.Authentication.Middleware
{
public class AuthenticationMiddleware : OcelotMiddleware
{
private readonly RequestDelegate _next;

View File

@ -1,7 +1,7 @@
namespace Ocelot.Library.Middleware
{
using Microsoft.AspNetCore.Builder;
namespace Ocelot.Library.Authentication.Middleware
{
public static class AuthenticationMiddlewareMiddlewareExtensions
{
public static IApplicationBuilder UseAuthenticationMiddleware(this IApplicationBuilder builder)

View File

@ -1,7 +0,0 @@
namespace Ocelot.Library.Authentication
{
public enum SupportAuthenticationProviders
{
IdentityServer
}
}

View File

@ -2,13 +2,12 @@ using System;
using System.Collections.Generic;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Ocelot.Library.Configuration.Creator;
using Ocelot.Library.Configuration.Parser;
using Ocelot.Library.Configuration.Repository;
using Ocelot.Library.Errors;
using Ocelot.Library.Configuration.Validator;
using Ocelot.Library.Configuration.Yaml;
using Ocelot.Library.Responses;
namespace Ocelot.Library.Configuration.Yaml
namespace Ocelot.Library.Configuration.Creator
{
/// <summary>
/// Register as singleton

View File

@ -1,6 +1,6 @@
using Ocelot.Library.Errors;
namespace Ocelot.Library.RequestBuilder
namespace Ocelot.Library.Configuration.Parser
{
public class InstructionNotForClaimsError : Error
{

View File

@ -1,6 +1,6 @@
using Ocelot.Library.Errors;
namespace Ocelot.Library.RequestBuilder
namespace Ocelot.Library.Configuration.Parser
{
public class NoInstructionsError : Error
{

View File

@ -1,7 +1,7 @@
using System;
using Ocelot.Library.Errors;
namespace Ocelot.Library.RequestBuilder
namespace Ocelot.Library.Configuration.Parser
{
public class ParsingConfigurationHeaderError : Error
{

View File

@ -1,9 +1,8 @@
using Ocelot.Library.Configuration.Creator;
using Ocelot.Library.Configuration.Provider;
using Ocelot.Library.Configuration.Repository;
using Ocelot.Library.Responses;
namespace Ocelot.Library.Configuration.Yaml
namespace Ocelot.Library.Configuration.Provider
{
/// <summary>
/// Register as singleton

View File

@ -1,8 +1,8 @@
namespace Ocelot.Library.Configuration.Yaml
{
using System.Collections.Generic;
using Errors;
using System.Collections.Generic;
using Ocelot.Library.Errors;
namespace Ocelot.Library.Configuration.Validator
{
public class ConfigurationValidationResult
{
public ConfigurationValidationResult(bool isError)

View File

@ -1,12 +1,14 @@
namespace Ocelot.Library.Configuration.Yaml
{
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using Authentication;
using Errors;
using Responses;
using Ocelot.Library.Authentication;
using Ocelot.Library.Authentication.Handler;
using Ocelot.Library.Configuration.Yaml;
using Ocelot.Library.Errors;
using Ocelot.Library.Responses;
namespace Ocelot.Library.Configuration.Validator
{
public class ConfigurationValidator : IConfigurationValidator
{
public Response<ConfigurationValidationResult> IsValid(YamlConfiguration configuration)
@ -57,7 +59,7 @@
private bool IsSupportedAuthenticationProvider(string provider)
{
SupportAuthenticationProviders supportedProvider;
SupportedAuthenticationProviders supportedProvider;
return Enum.TryParse(provider, true, out supportedProvider);
}

View File

@ -1,7 +1,7 @@
namespace Ocelot.Library.Configuration.Yaml
{
using Errors;
using Ocelot.Library.Errors;
namespace Ocelot.Library.Configuration.Validator
{
public class DownstreamTemplateAlreadyUsedError : Error
{
public DownstreamTemplateAlreadyUsedError(string message) : base(message, OcelotErrorCode.DownstreamTemplateAlreadyUsedError)

View File

@ -1,7 +1,8 @@
namespace Ocelot.Library.Configuration.Yaml
{
using Responses;
using Ocelot.Library.Configuration.Yaml;
using Ocelot.Library.Responses;
namespace Ocelot.Library.Configuration.Validator
{
public interface IConfigurationValidator
{
Response<ConfigurationValidationResult> IsValid(YamlConfiguration configuration);

View File

@ -1,7 +1,7 @@
namespace Ocelot.Library.Configuration.Yaml
{
using Errors;
using Ocelot.Library.Errors;
namespace Ocelot.Library.Configuration.Validator
{
public class UnsupportedAuthenticationProviderError : Error
{
public UnsupportedAuthenticationProviderError(string message)

View File

@ -1,7 +1,17 @@
using Ocelot.Library.Configuration.Creator;
using Ocelot.Library.Authentication.Handler.Creator;
using Ocelot.Library.Authentication.Handler.Factory;
using Ocelot.Library.Configuration.Creator;
using Ocelot.Library.Configuration.Parser;
using Ocelot.Library.Configuration.Provider;
using Ocelot.Library.Configuration.Repository;
using Ocelot.Library.Configuration.Validator;
using Ocelot.Library.DownstreamRouteFinder.Finder;
using Ocelot.Library.DownstreamRouteFinder.UrlMatcher;
using Ocelot.Library.DownstreamUrlCreator.UrlTemplateReplacer;
using Ocelot.Library.HeaderBuilder;
using Ocelot.Library.HeaderBuilder.Parser;
using Ocelot.Library.RequestBuilder.Builder;
using Ocelot.Library.ScopedData;
namespace Ocelot.Library.DependencyInjection
{
@ -12,12 +22,9 @@ namespace Ocelot.Library.DependencyInjection
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Repository;
using RequestBuilder;
using Requester;
using Responder;
using UrlMatcher;
using UrlTemplateReplacer;
public static class ServiceCollectionExtensions
{
@ -48,7 +55,7 @@ namespace Ocelot.Library.DependencyInjection
services.AddSingleton<IUrlPathToUrlTemplateMatcher, RegExUrlMatcher>();
services.AddSingleton<ITemplateVariableNameAndValueFinder, TemplateVariableNameAndValueFinder>();
services.AddSingleton<IDownstreamUrlTemplateVariableReplacer, DownstreamUrlTemplateVariableReplacer>();
services.AddSingleton<IDownstreamRouteFinder, DownstreamRouteFinder>();
services.AddSingleton<IDownstreamRouteFinder, DownstreamRouteFinder.Finder.DownstreamRouteFinder>();
services.AddSingleton<IHttpRequester, HttpClientHttpRequester>();
services.AddSingleton<IHttpResponder, HttpContextResponder>();
services.AddSingleton<IRequestBuilder, HttpRequestBuilder>();

View File

@ -1,8 +1,9 @@
namespace Ocelot.Library.DownstreamRouteFinder
using Ocelot.Library.DownstreamRouteFinder.UrlMatcher;
namespace Ocelot.Library.DownstreamRouteFinder
{
using System.Collections.Generic;
using Configuration;
using UrlMatcher;
public class DownstreamRoute
{

View File

@ -2,11 +2,11 @@
using System.Collections.Generic;
using System.Linq;
using Ocelot.Library.Configuration.Provider;
using Ocelot.Library.DownstreamRouteFinder.UrlMatcher;
using Ocelot.Library.Errors;
using Ocelot.Library.Responses;
using Ocelot.Library.UrlMatcher;
namespace Ocelot.Library.DownstreamRouteFinder
namespace Ocelot.Library.DownstreamRouteFinder.Finder
{
public class DownstreamRouteFinder : IDownstreamRouteFinder
{

View File

@ -1,7 +1,7 @@
namespace Ocelot.Library.DownstreamRouteFinder
{
using Responses;
using Ocelot.Library.Responses;
namespace Ocelot.Library.DownstreamRouteFinder.Finder
{
public interface IDownstreamRouteFinder
{
Response<DownstreamRoute> FindDownstreamRoute(string upstreamUrlPath, string upstreamHttpMethod);

View File

@ -1,7 +1,7 @@
namespace Ocelot.Library.DownstreamRouteFinder
{
using Errors;
using Ocelot.Library.Errors;
namespace Ocelot.Library.DownstreamRouteFinder.Finder
{
public class UnableToFindDownstreamRouteError : Error
{
public UnableToFindDownstreamRouteError() : base("UnableToFindDownstreamRouteError", OcelotErrorCode.UnableToFindDownstreamRouteError)

View File

@ -1,10 +1,11 @@
namespace Ocelot.Library.Middleware
{
using System.Threading.Tasks;
using DownstreamRouteFinder;
using Microsoft.AspNetCore.Http;
using Repository;
using Ocelot.Library.DownstreamRouteFinder.Finder;
using Ocelot.Library.Middleware;
using Ocelot.Library.ScopedData;
namespace Ocelot.Library.DownstreamRouteFinder.Middleware
{
public class DownstreamRouteFinderMiddleware : OcelotMiddleware
{
private readonly RequestDelegate _next;

View File

@ -1,7 +1,7 @@
namespace Ocelot.Library.Middleware
{
using Microsoft.AspNetCore.Builder;
namespace Ocelot.Library.DownstreamRouteFinder.Middleware
{
public static class DownstreamRouteFinderMiddlewareExtensions
{
public static IApplicationBuilder UseDownstreamRouteFinderMiddleware(this IApplicationBuilder builder)

View File

@ -1,8 +1,8 @@
namespace Ocelot.Library.UrlMatcher
{
using System.Collections.Generic;
using Responses;
using System.Collections.Generic;
using Ocelot.Library.Responses;
namespace Ocelot.Library.DownstreamRouteFinder.UrlMatcher
{
public interface ITemplateVariableNameAndValueFinder
{
Response<List<TemplateVariableNameAndValue>> Find(string upstreamUrlPath, string upstreamUrlPathTemplate);

View File

@ -1,7 +1,7 @@
namespace Ocelot.Library.UrlMatcher
{
using Responses;
using Ocelot.Library.Responses;
namespace Ocelot.Library.DownstreamRouteFinder.UrlMatcher
{
public interface IUrlPathToUrlTemplateMatcher
{
Response<UrlMatch> Match(string upstreamUrlPath, string upstreamUrlPathTemplate);

View File

@ -1,8 +1,8 @@
namespace Ocelot.Library.UrlMatcher
{
using System.Text.RegularExpressions;
using Responses;
using System.Text.RegularExpressions;
using Ocelot.Library.Responses;
namespace Ocelot.Library.DownstreamRouteFinder.UrlMatcher
{
public class RegExUrlMatcher : IUrlPathToUrlTemplateMatcher
{
public Response<UrlMatch> Match(string upstreamUrlPath, string upstreamUrlPathTemplate)

View File

@ -1,4 +1,4 @@
namespace Ocelot.Library.UrlMatcher
namespace Ocelot.Library.DownstreamRouteFinder.UrlMatcher
{
public class TemplateVariableNameAndValue
{

View File

@ -1,8 +1,8 @@
namespace Ocelot.Library.UrlMatcher
{
using System.Collections.Generic;
using Responses;
using Ocelot.Library.Responses;
namespace Ocelot.Library.DownstreamRouteFinder.UrlMatcher
{
public class TemplateVariableNameAndValueFinder : ITemplateVariableNameAndValueFinder
{
public Response<List<TemplateVariableNameAndValue>> Find(string upstreamUrlPath, string upstreamUrlPathTemplate)

View File

@ -1,4 +1,4 @@
namespace Ocelot.Library.UrlMatcher
namespace Ocelot.Library.DownstreamRouteFinder.UrlMatcher
{
public class UrlMatch
{

View File

@ -1,11 +1,12 @@
namespace Ocelot.Library.Middleware
{
using System.Threading.Tasks;
using DownstreamRouteFinder;
using Microsoft.AspNetCore.Http;
using Repository;
using UrlTemplateReplacer;
using Ocelot.Library.DownstreamRouteFinder;
using Ocelot.Library.DownstreamUrlCreator.UrlTemplateReplacer;
using Ocelot.Library.Middleware;
using Ocelot.Library.ScopedData;
namespace Ocelot.Library.DownstreamUrlCreator.Middleware
{
public class DownstreamUrlCreatorMiddleware : OcelotMiddleware
{
private readonly RequestDelegate _next;

View File

@ -1,7 +1,7 @@
namespace Ocelot.Library.Middleware
{
using Microsoft.AspNetCore.Builder;
namespace Ocelot.Library.DownstreamUrlCreator.Middleware
{
public static class DownstreamUrlCreatorMiddlewareExtensions
{
public static IApplicationBuilder UseDownstreamUrlCreatorMiddleware(this IApplicationBuilder builder)

View File

@ -1,9 +1,9 @@
namespace Ocelot.Library.UrlTemplateReplacer
{
using System.Text;
using DownstreamRouteFinder;
using Responses;
using Ocelot.Library.DownstreamRouteFinder;
using Ocelot.Library.Responses;
namespace Ocelot.Library.DownstreamUrlCreator.UrlTemplateReplacer
{
public class DownstreamUrlTemplateVariableReplacer : IDownstreamUrlTemplateVariableReplacer
{
public Response<string> ReplaceTemplateVariables(DownstreamRoute downstreamRoute)

View File

@ -1,8 +1,8 @@
namespace Ocelot.Library.UrlTemplateReplacer
{
using DownstreamRouteFinder;
using Responses;
using Ocelot.Library.DownstreamRouteFinder;
using Ocelot.Library.Responses;
namespace Ocelot.Library.DownstreamUrlCreator.UrlTemplateReplacer
{
public interface IDownstreamUrlTemplateVariableReplacer
{
Response<string> ReplaceTemplateVariables(DownstreamRoute downstreamRoute);

View File

@ -3,9 +3,10 @@ using System.Linq;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Primitives;
using Ocelot.Library.Configuration;
using Ocelot.Library.HeaderBuilder.Parser;
using Ocelot.Library.Responses;
namespace Ocelot.Library.RequestBuilder
namespace Ocelot.Library.HeaderBuilder
{
public class AddHeadersToRequest : IAddHeadersToRequest
{

View File

@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Http;
using Ocelot.Library.Configuration;
using Ocelot.Library.Responses;
namespace Ocelot.Library.RequestBuilder
namespace Ocelot.Library.HeaderBuilder
{
public interface IAddHeadersToRequest
{

View File

@ -1,15 +1,12 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.Primitives;
using Ocelot.Library.DownstreamRouteFinder;
using Ocelot.Library.RequestBuilder;
namespace Ocelot.Library.Middleware
{
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Repository;
using Ocelot.Library.DownstreamRouteFinder;
using Ocelot.Library.Middleware;
using Ocelot.Library.ScopedData;
namespace Ocelot.Library.HeaderBuilder.Middleware
{
public class HttpRequestHeadersBuilderMiddleware : OcelotMiddleware
{
private readonly RequestDelegate _next;

View File

@ -1,7 +1,7 @@
namespace Ocelot.Library.Middleware
{
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Builder;
namespace Ocelot.Library.HeaderBuilder.Middleware
{
public static class HttpRequestHeadersBuilderMiddlewareExtensions
{
public static IApplicationBuilder UseHttpRequestHeadersBuilderMiddleware(this IApplicationBuilder builder)

View File

@ -1,6 +1,6 @@
using Ocelot.Library.Errors;
namespace Ocelot.Library.RequestBuilder
namespace Ocelot.Library.HeaderBuilder.Parser
{
public class CannotFindClaimError : Error
{

View File

@ -4,7 +4,7 @@ using System.Security.Claims;
using Ocelot.Library.Errors;
using Ocelot.Library.Responses;
namespace Ocelot.Library.RequestBuilder
namespace Ocelot.Library.HeaderBuilder.Parser
{
public class ClaimsParser : IClaimsParser
{

View File

@ -2,7 +2,7 @@
using System.Security.Claims;
using Ocelot.Library.Responses;
namespace Ocelot.Library.RequestBuilder
namespace Ocelot.Library.HeaderBuilder.Parser
{
public interface IClaimsParser
{

View File

@ -1,8 +1,9 @@
namespace Ocelot.Library.Middleware
using Ocelot.Library.ScopedData;
namespace Ocelot.Library.Middleware
{
using System.Collections.Generic;
using Errors;
using Repository;
public abstract class OcelotMiddleware
{

View File

@ -1,4 +1,12 @@
namespace Ocelot.Library.Middleware
using Ocelot.Library.Authentication.Middleware;
using Ocelot.Library.DownstreamRouteFinder.Middleware;
using Ocelot.Library.DownstreamUrlCreator.Middleware;
using Ocelot.Library.HeaderBuilder.Middleware;
using Ocelot.Library.RequestBuilder.Middleware;
using Ocelot.Library.Requester.Middleware;
using Ocelot.Library.Responder.Middleware;
namespace Ocelot.Library.Middleware
{
using Microsoft.AspNetCore.Builder;

View File

@ -1,14 +1,14 @@
namespace Ocelot.Library.RequestBuilder
{
using System;
using System;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Responses;
using Ocelot.Library.Responses;
namespace Ocelot.Library.RequestBuilder.Builder
{
public class HttpRequestBuilder : IRequestBuilder
{
public async Task<Response<Request>> Build(string httpMethod, string downstreamUrl, Stream content, IHeaderDictionary headers,

View File

@ -1,10 +1,10 @@
namespace Ocelot.Library.RequestBuilder
{
using System.IO;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Responses;
using Ocelot.Library.Responses;
namespace Ocelot.Library.RequestBuilder.Builder
{
public interface IRequestBuilder
{
Task<Response<Request>> Build(string httpMethod,

View File

@ -1,10 +1,11 @@
namespace Ocelot.Library.Middleware
{
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Repository;
using RequestBuilder;
using Ocelot.Library.Middleware;
using Ocelot.Library.RequestBuilder.Builder;
using Ocelot.Library.ScopedData;
namespace Ocelot.Library.RequestBuilder.Middleware
{
public class HttpRequestBuilderMiddleware : OcelotMiddleware
{
private readonly RequestDelegate _next;

View File

@ -1,7 +1,7 @@
namespace Ocelot.Library.Middleware
{
using Microsoft.AspNetCore.Builder;
namespace Ocelot.Library.RequestBuilder.Middleware
{
public static class HttpRequestBuilderMiddlewareExtensions
{
public static IApplicationBuilder UseHttpRequestBuilderMiddleware(this IApplicationBuilder builder)

View File

@ -1,11 +1,11 @@
namespace Ocelot.Library.Middleware
{
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Repository;
using RequestBuilder;
using Requester;
using Ocelot.Library.Middleware;
using Ocelot.Library.RequestBuilder;
using Ocelot.Library.ScopedData;
namespace Ocelot.Library.Requester.Middleware
{
public class HttpRequesterMiddleware : OcelotMiddleware
{
private readonly RequestDelegate _next;

View File

@ -1,7 +1,7 @@
namespace Ocelot.Library.Middleware
{
using Microsoft.AspNetCore.Builder;
namespace Ocelot.Library.Requester.Middleware
{
public static class HttpRequesterMiddlewareExtensions
{
public static IApplicationBuilder UseHttpRequesterMiddleware(this IApplicationBuilder builder)

View File

@ -1,11 +1,11 @@
namespace Ocelot.Library.Middleware
{
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Repository;
using Responder;
using Ocelot.Library.Middleware;
using Ocelot.Library.ScopedData;
namespace Ocelot.Library.Responder.Middleware
{
public class HttpResponderMiddleware : OcelotMiddleware
{
private readonly RequestDelegate _next;

View File

@ -1,7 +1,7 @@
namespace Ocelot.Library.Middleware
{
using Microsoft.AspNetCore.Builder;
namespace Ocelot.Library.Responder.Middleware
{
public static class HttpResponderMiddlewareExtensions
{
public static IApplicationBuilder UseHttpResponderMiddleware(this IApplicationBuilder builder)

View File

@ -1,7 +1,7 @@
namespace Ocelot.Library.Repository
{
using Errors;
using Ocelot.Library.Errors;
namespace Ocelot.Library.ScopedData
{
public class CannotAddDataError : Error
{
public CannotAddDataError(string message) : base(message, OcelotErrorCode.CannotAddDataError)

View File

@ -1,7 +1,7 @@
namespace Ocelot.Library.Repository
{
using Errors;
using Ocelot.Library.Errors;
namespace Ocelot.Library.ScopedData
{
public class CannotFindDataError : Error
{
public CannotFindDataError(string message) : base(message, OcelotErrorCode.CannotFindDataError)

View File

@ -1,7 +1,7 @@
namespace Ocelot.Library.Repository
{
using Responses;
using Ocelot.Library.Responses;
namespace Ocelot.Library.ScopedData
{
public interface IScopedRequestDataRepository
{
Response Add<T>(string key, T value);

View File

@ -1,11 +1,11 @@
namespace Ocelot.Library.Repository
{
using System;
using System;
using System.Collections.Generic;
using Errors;
using Microsoft.AspNetCore.Http;
using Responses;
using Ocelot.Library.Errors;
using Ocelot.Library.Responses;
namespace Ocelot.Library.ScopedData
{
public class ScopedRequestDataRepository : IScopedRequestDataRepository
{
private readonly IHttpContextAccessor _httpContextAccessor;

View File

@ -3,6 +3,9 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Moq;
using Ocelot.Library.Authentication.Handler;
using Ocelot.Library.Authentication.Handler.Creator;
using Ocelot.Library.Authentication.Handler.Factory;
using Shouldly;
using TestStack.BDDfy;
using Xunit;

View File

@ -6,19 +6,18 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.DependencyInjection;
using Moq;
using Ocelot.Library.Authentication.Handler.Factory;
using Ocelot.Library.Authentication.Middleware;
using Ocelot.Library.Configuration.Builder;
using Ocelot.Library.DownstreamRouteFinder;
using Ocelot.Library.DownstreamRouteFinder.UrlMatcher;
using Ocelot.Library.Responses;
using Ocelot.Library.ScopedData;
using TestStack.BDDfy;
using Xunit;
namespace Ocelot.UnitTests.Middleware
namespace Ocelot.UnitTests.Authentication
{
using Library.Authentication;
using Library.DownstreamRouteFinder;
using Library.Middleware;
using Library.Repository;
using Library.Responses;
using Library.UrlMatcher;
public class AuthenticationMiddlewareTests : IDisposable
{
private readonly Mock<IScopedRequestDataRepository> _scopedRepository;

View File

@ -3,13 +3,12 @@ using System.Linq;
using Ocelot.Library.Configuration;
using Ocelot.Library.Configuration.Parser;
using Ocelot.Library.Errors;
using Ocelot.Library.RequestBuilder;
using Ocelot.Library.Responses;
using Shouldly;
using TestStack.BDDfy;
using Xunit;
namespace Ocelot.UnitTests.RequestBuilder
namespace Ocelot.UnitTests.Configuration
{
public class ConfigurationHeadersExtractorTests
{

View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using Ocelot.Library.Configuration.Validator;
using Shouldly;
using TestStack.BDDfy;
using Xunit;

View File

@ -3,8 +3,10 @@ using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Moq;
using Ocelot.Library.Configuration.Builder;
using Ocelot.Library.Configuration.Creator;
using Ocelot.Library.Configuration.Parser;
using Ocelot.Library.Configuration.Repository;
using Ocelot.Library.Configuration.Validator;
using Ocelot.Library.RequestBuilder;
using Shouldly;
using TestStack.BDDfy;

View File

@ -7,17 +7,17 @@ using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.DependencyInjection;
using Moq;
using Ocelot.Library.Configuration.Builder;
using Ocelot.Library.DownstreamRouteFinder;
using Ocelot.Library.DownstreamRouteFinder.Finder;
using Ocelot.Library.DownstreamRouteFinder.Middleware;
using Ocelot.Library.DownstreamRouteFinder.UrlMatcher;
using Ocelot.Library.Responses;
using Ocelot.Library.ScopedData;
using TestStack.BDDfy;
using Xunit;
namespace Ocelot.UnitTests.Middleware
namespace Ocelot.UnitTests.DownstreamRouteFinder
{
using Library.DownstreamRouteFinder;
using Library.Middleware;
using Library.Repository;
using Library.Responses;
using Library.UrlMatcher;
public class DownstreamRouteFinderMiddlewareTests : IDisposable
{
private readonly Mock<IDownstreamRouteFinder> _downstreamRouteFinder;

View File

@ -2,6 +2,8 @@
using Moq;
using Ocelot.Library.Configuration.Builder;
using Ocelot.Library.Configuration.Provider;
using Ocelot.Library.DownstreamRouteFinder.Finder;
using Ocelot.Library.DownstreamRouteFinder.UrlMatcher;
using Shouldly;
using TestStack.BDDfy;
using Xunit;
@ -11,7 +13,6 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
using Library.Configuration;
using Library.DownstreamRouteFinder;
using Library.Responses;
using Library.UrlMatcher;
public class DownstreamRouteFinderTests
{
@ -30,7 +31,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
_mockConfig = new Mock<IOcelotConfigurationProvider>();
_mockMatcher = new Mock<IUrlPathToUrlTemplateMatcher>();
_finder = new Mock<ITemplateVariableNameAndValueFinder>();
_downstreamRouteFinder = new DownstreamRouteFinder(_mockConfig.Object, _mockMatcher.Object, _finder.Object);
_downstreamRouteFinder = new Library.DownstreamRouteFinder.Finder.DownstreamRouteFinder(_mockConfig.Object, _mockMatcher.Object, _finder.Object);
}
[Fact]

View File

@ -1,12 +1,11 @@
using Ocelot.Library.DownstreamRouteFinder.UrlMatcher;
using Ocelot.Library.Responses;
using Shouldly;
using TestStack.BDDfy;
using Xunit;
namespace Ocelot.UnitTests.UrlMatcher
namespace Ocelot.UnitTests.DownstreamRouteFinder.UrlMatcher
{
using Library.Responses;
using Library.UrlMatcher;
public class RegExUrlMatcherTests
{
private readonly IUrlPathToUrlTemplateMatcher _urlMatcher;

View File

@ -1,14 +1,13 @@
using System.Collections.Generic;
using System.Linq;
using Ocelot.Library.DownstreamRouteFinder.UrlMatcher;
using Ocelot.Library.Responses;
using Shouldly;
using TestStack.BDDfy;
using Xunit;
namespace Ocelot.UnitTests.UrlMatcher
namespace Ocelot.UnitTests.DownstreamRouteFinder.UrlMatcher
{
using Library.Responses;
using Library.UrlMatcher;
public class UrlPathToUrlTemplateMatcherTests
{
private readonly ITemplateVariableNameAndValueFinder _finder;

View File

@ -1,24 +1,23 @@
using Ocelot.Library.Configuration.Builder;
namespace Ocelot.UnitTests.Middleware
{
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Http;
using Library.DownstreamRouteFinder;
using Library.Middleware;
using Library.Repository;
using Library.Responses;
using Library.UrlMatcher;
using Library.UrlTemplateReplacer;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.DependencyInjection;
using Moq;
using Ocelot.Library.Configuration.Builder;
using Ocelot.Library.DownstreamRouteFinder;
using Ocelot.Library.DownstreamRouteFinder.UrlMatcher;
using Ocelot.Library.DownstreamUrlCreator.Middleware;
using Ocelot.Library.DownstreamUrlCreator.UrlTemplateReplacer;
using Ocelot.Library.Responses;
using Ocelot.Library.ScopedData;
using TestStack.BDDfy;
using Xunit;
namespace Ocelot.UnitTests.DownstreamUrlCreator
{
public class DownstreamUrlCreatorMiddlewareTests : IDisposable
{
private readonly Mock<IDownstreamUrlTemplateVariableReplacer> _downstreamUrlTemplateVariableReplacer;

View File

@ -1,16 +1,15 @@
using System.Collections.Generic;
using Ocelot.Library.Configuration.Builder;
using Ocelot.Library.DownstreamRouteFinder;
using Ocelot.Library.DownstreamRouteFinder.UrlMatcher;
using Ocelot.Library.DownstreamUrlCreator.UrlTemplateReplacer;
using Ocelot.Library.Responses;
using Shouldly;
using TestStack.BDDfy;
using Xunit;
namespace Ocelot.UnitTests.UrlTemplateReplacer
namespace Ocelot.UnitTests.DownstreamUrlCreator.UrlTemplateReplacer
{
using Library.DownstreamRouteFinder;
using Library.Responses;
using Library.UrlMatcher;
using Library.UrlTemplateReplacer;
public class UpstreamUrlPathTemplateVariableReplacerTests
{
private DownstreamRoute _downstreamRoute;

View File

@ -6,13 +6,14 @@ using Microsoft.Extensions.Primitives;
using Moq;
using Ocelot.Library.Configuration;
using Ocelot.Library.Errors;
using Ocelot.Library.RequestBuilder;
using Ocelot.Library.HeaderBuilder;
using Ocelot.Library.HeaderBuilder.Parser;
using Ocelot.Library.Responses;
using Shouldly;
using TestStack.BDDfy;
using Xunit;
namespace Ocelot.UnitTests.RequestBuilder
namespace Ocelot.UnitTests.HeaderBuilder
{
public class AddHeadersToRequestTests
{

View File

@ -1,13 +1,13 @@
using System.Collections.Generic;
using System.Security.Claims;
using Ocelot.Library.Errors;
using Ocelot.Library.RequestBuilder;
using Ocelot.Library.HeaderBuilder.Parser;
using Ocelot.Library.Responses;
using Shouldly;
using TestStack.BDDfy;
using Xunit;
namespace Ocelot.UnitTests.RequestBuilder
namespace Ocelot.UnitTests.HeaderBuilder
{
public class ClaimParserTests
{
@ -21,7 +21,7 @@ namespace Ocelot.UnitTests.RequestBuilder
public ClaimParserTests()
{
_claims = new List<Claim>();
_claimsParser = new Library.RequestBuilder.ClaimsParser();
_claimsParser = new ClaimsParser();
}
[Fact]

View File

@ -10,15 +10,15 @@ using Moq;
using Ocelot.Library.Configuration;
using Ocelot.Library.Configuration.Builder;
using Ocelot.Library.DownstreamRouteFinder;
using Ocelot.Library.Middleware;
using Ocelot.Library.Repository;
using Ocelot.Library.RequestBuilder;
using Ocelot.Library.DownstreamRouteFinder.UrlMatcher;
using Ocelot.Library.HeaderBuilder;
using Ocelot.Library.HeaderBuilder.Middleware;
using Ocelot.Library.Responses;
using Ocelot.Library.UrlMatcher;
using Ocelot.Library.ScopedData;
using TestStack.BDDfy;
using Xunit;
namespace Ocelot.UnitTests.Middleware
namespace Ocelot.UnitTests.HeaderBuilder
{
public class HttpRequestHeadersBuilderMiddlewareTests : IDisposable
{

View File

@ -1,11 +1,11 @@
using Microsoft.AspNetCore.Http;
using Ocelot.Library.ScopedData;
using Shouldly;
using TestStack.BDDfy;
using Xunit;
namespace Ocelot.UnitTests.Repository
{
using Library.Repository;
using Library.Responses;
public class ScopedRequestDataRepositoryTests

View File

@ -7,16 +7,16 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.DependencyInjection;
using Moq;
using Ocelot.Library.RequestBuilder;
using Ocelot.Library.RequestBuilder.Builder;
using Ocelot.Library.RequestBuilder.Middleware;
using Ocelot.Library.Responses;
using Ocelot.Library.ScopedData;
using TestStack.BDDfy;
using Xunit;
namespace Ocelot.UnitTests.Middleware
namespace Ocelot.UnitTests.RequestBuilder
{
using Library.Middleware;
using Library.Repository;
using Library.RequestBuilder;
using Library.Responses;
public class HttpRequestBuilderMiddlewareTests : IDisposable
{
private readonly Mock<IRequestBuilder> _requestBuilder;

View File

@ -5,6 +5,7 @@ using System.Net;
using System.Net.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Internal;
using Ocelot.Library.RequestBuilder.Builder;
using Shouldly;
using TestStack.BDDfy;
using Xunit;

View File

@ -6,17 +6,16 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.DependencyInjection;
using Moq;
using Ocelot.Library.RequestBuilder;
using Ocelot.Library.Requester;
using Ocelot.Library.Requester.Middleware;
using Ocelot.Library.Responses;
using Ocelot.Library.ScopedData;
using TestStack.BDDfy;
using Xunit;
namespace Ocelot.UnitTests.Middleware
namespace Ocelot.UnitTests.Requester
{
using Library.Middleware;
using Library.Repository;
using Library.RequestBuilder;
using Library.Requester;
using Library.Responses;
public class HttpRequesterMiddlewareTests : IDisposable
{
private readonly Mock<IHttpRequester> _requester;

View File

@ -6,16 +6,15 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.DependencyInjection;
using Moq;
using Ocelot.Library.Responder;
using Ocelot.Library.Responder.Middleware;
using Ocelot.Library.Responses;
using Ocelot.Library.ScopedData;
using TestStack.BDDfy;
using Xunit;
namespace Ocelot.UnitTests.Middleware
namespace Ocelot.UnitTests.Responder
{
using Library.Middleware;
using Library.Repository;
using Library.Responder;
using Library.Responses;
public class HttpResponderMiddlewareTests : IDisposable
{
private readonly Mock<IHttpResponder> _responder;