mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-19 16:18:14 +08:00
Fixed Merge Conflicts
This commit is contained in:
@ -1,18 +1,15 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.Middleware;
|
||||
using Ocelot.Middleware.Multiplexer;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.Middleware;
|
||||
using Ocelot.Middleware.Multiplexer;
|
||||
using Shouldly;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -422,7 +419,6 @@ namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
"Laura",
|
||||
"Tom"
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using IdentityServer4.Test;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Security.Claims;
|
||||
using IdentityServer4.AccessTokenValidation;
|
||||
using IdentityServer4.Models;
|
||||
using IdentityServer4.Test;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Ocelot.Configuration.File;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Security.Claims;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -46,10 +46,10 @@ namespace Ocelot.AcceptanceTests
|
||||
public void should_return_401_using_identity_server_access_token()
|
||||
{
|
||||
int port = 54329;
|
||||
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
{
|
||||
new FileReRoute
|
||||
{
|
||||
@ -70,8 +70,8 @@ namespace Ocelot.AcceptanceTests
|
||||
AuthenticationProviderKey = "Test"
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn(_identityServerRootUrl, "api", "api2", AccessTokenType.Jwt))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn($"{_downstreamServiceUrl}{port}", 201, string.Empty))
|
||||
@ -88,9 +88,9 @@ namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
int port = 54099;
|
||||
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
{
|
||||
new FileReRoute
|
||||
{
|
||||
@ -111,19 +111,19 @@ namespace Ocelot.AcceptanceTests
|
||||
AuthenticationProviderKey = "Test"
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn(_identityServerRootUrl, "api", "api2", AccessTokenType.Jwt))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn($"{_downstreamServiceUrl}{port}", 200, "Hello from Laura"))
|
||||
.And(x => _steps.GivenIHaveAToken(_identityServerRootUrl))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning(_options, "Test"))
|
||||
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
||||
.And(x => _steps.ThenTheResponseBodyShouldBe("Hello from Laura"))
|
||||
.BDDfy();
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn(_identityServerRootUrl, "api", "api2", AccessTokenType.Jwt))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn($"{_downstreamServiceUrl}{port}", 200, "Hello from Laura"))
|
||||
.And(x => _steps.GivenIHaveAToken(_identityServerRootUrl))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning(_options, "Test"))
|
||||
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
||||
.And(x => _steps.ThenTheResponseBodyShouldBe("Hello from Laura"))
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -131,9 +131,9 @@ namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
int port = 54196;
|
||||
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
{
|
||||
new FileReRoute
|
||||
{
|
||||
@ -154,18 +154,18 @@ namespace Ocelot.AcceptanceTests
|
||||
AuthenticationProviderKey = "Test"
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn(_identityServerRootUrl, "api", "api2", AccessTokenType.Jwt))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn($"{_downstreamServiceUrl}{port}", 200, "Hello from Laura"))
|
||||
.And(x => _steps.GivenIHaveATokenForApi2(_identityServerRootUrl))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning(_options, "Test"))
|
||||
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.Unauthorized))
|
||||
.BDDfy();
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn(_identityServerRootUrl, "api", "api2", AccessTokenType.Jwt))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn($"{_downstreamServiceUrl}{port}", 200, "Hello from Laura"))
|
||||
.And(x => _steps.GivenIHaveATokenForApi2(_identityServerRootUrl))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning(_options, "Test"))
|
||||
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.Unauthorized))
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -173,9 +173,9 @@ namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
int port = 52226;
|
||||
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
{
|
||||
new FileReRoute
|
||||
{
|
||||
@ -196,19 +196,19 @@ namespace Ocelot.AcceptanceTests
|
||||
AuthenticationProviderKey = "Test"
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn(_identityServerRootUrl, "api", "api2", AccessTokenType.Jwt))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn($"{_downstreamServiceUrl}{port}", 201, string.Empty))
|
||||
.And(x => _steps.GivenIHaveAToken(_identityServerRootUrl))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning(_options, "Test"))
|
||||
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||
.And(x => _steps.GivenThePostHasContent("postContent"))
|
||||
.When(x => _steps.WhenIPostUrlOnTheApiGateway("/"))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.Created))
|
||||
.BDDfy();
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn(_identityServerRootUrl, "api", "api2", AccessTokenType.Jwt))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn($"{_downstreamServiceUrl}{port}", 201, string.Empty))
|
||||
.And(x => _steps.GivenIHaveAToken(_identityServerRootUrl))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning(_options, "Test"))
|
||||
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||
.And(x => _steps.GivenThePostHasContent("postContent"))
|
||||
.When(x => _steps.WhenIPostUrlOnTheApiGateway("/"))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.Created))
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -216,9 +216,9 @@ namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
int port = 52222;
|
||||
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
{
|
||||
new FileReRoute
|
||||
{
|
||||
@ -239,19 +239,19 @@ namespace Ocelot.AcceptanceTests
|
||||
AuthenticationProviderKey = "Test"
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn(_identityServerRootUrl, "api", "api2", AccessTokenType.Reference))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn($"{_downstreamServiceUrl}{port}", 201, string.Empty))
|
||||
.And(x => _steps.GivenIHaveAToken(_identityServerRootUrl))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning(_options, "Test"))
|
||||
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||
.And(x => _steps.GivenThePostHasContent("postContent"))
|
||||
.When(x => _steps.WhenIPostUrlOnTheApiGateway("/"))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.Created))
|
||||
.BDDfy();
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn(_identityServerRootUrl, "api", "api2", AccessTokenType.Reference))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn($"{_downstreamServiceUrl}{port}", 201, string.Empty))
|
||||
.And(x => _steps.GivenIHaveAToken(_identityServerRootUrl))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning(_options, "Test"))
|
||||
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||
.And(x => _steps.GivenThePostHasContent("postContent"))
|
||||
.When(x => _steps.WhenIPostUrlOnTheApiGateway("/"))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.Created))
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
private void GivenThereIsAServiceRunningOn(string url, int statusCode, string responseBody)
|
||||
@ -373,4 +373,4 @@ namespace Ocelot.AcceptanceTests
|
||||
_identityServerBuilder?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,20 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Security.Claims;
|
||||
using IdentityServer4.AccessTokenValidation;
|
||||
using IdentityServer4.Models;
|
||||
using IdentityServer4.Test;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Ocelot.Configuration.File;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Security.Claims;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
using IdentityServer4.Test;
|
||||
|
||||
public class AuthorisationTests : IDisposable
|
||||
{
|
||||
@ -44,8 +44,8 @@ namespace Ocelot.AcceptanceTests
|
||||
int port = 52875;
|
||||
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
{
|
||||
new FileReRoute
|
||||
{
|
||||
@ -84,18 +84,18 @@ namespace Ocelot.AcceptanceTests
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:51888", "api", AccessTokenType.Jwt))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}", 200, "Hello from Laura"))
|
||||
.And(x => _steps.GivenIHaveAToken("http://localhost:51888"))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning(_options, "Test"))
|
||||
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
||||
.And(x => _steps.ThenTheResponseBodyShouldBe("Hello from Laura"))
|
||||
.BDDfy();
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:51888", "api", AccessTokenType.Jwt))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}", 200, "Hello from Laura"))
|
||||
.And(x => _steps.GivenIHaveAToken("http://localhost:51888"))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning(_options, "Test"))
|
||||
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
||||
.And(x => _steps.ThenTheResponseBodyShouldBe("Hello from Laura"))
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -103,9 +103,9 @@ namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
int port = 59471;
|
||||
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
{
|
||||
new FileReRoute
|
||||
{
|
||||
@ -142,18 +142,18 @@ namespace Ocelot.AcceptanceTests
|
||||
{"UserType", "registered"}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:51888", "api", AccessTokenType.Jwt))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}", 200, "Hello from Laura"))
|
||||
.And(x => _steps.GivenIHaveAToken("http://localhost:51888"))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning(_options, "Test"))
|
||||
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.Forbidden))
|
||||
.BDDfy();
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:51888", "api", AccessTokenType.Jwt))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}", 200, "Hello from Laura"))
|
||||
.And(x => _steps.GivenIHaveAToken("http://localhost:51888"))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning(_options, "Test"))
|
||||
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.Forbidden))
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -161,9 +161,9 @@ namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
int port = 63471;
|
||||
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
{
|
||||
new FileReRoute
|
||||
{
|
||||
@ -185,18 +185,18 @@ namespace Ocelot.AcceptanceTests
|
||||
AllowedScopes = new List<string>{ "api", "api.readOnly", "openid", "offline_access" },
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:51888", "api", AccessTokenType.Jwt))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}", 200, "Hello from Laura"))
|
||||
.And(x => _steps.GivenIHaveATokenForApiReadOnlyScope("http://localhost:51888"))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning(_options, "Test"))
|
||||
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
||||
.BDDfy();
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:51888", "api", AccessTokenType.Jwt))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}", 200, "Hello from Laura"))
|
||||
.And(x => _steps.GivenIHaveATokenForApiReadOnlyScope("http://localhost:51888"))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning(_options, "Test"))
|
||||
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -204,9 +204,9 @@ namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
int port = 60571;
|
||||
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
{
|
||||
new FileReRoute
|
||||
{
|
||||
@ -228,18 +228,18 @@ namespace Ocelot.AcceptanceTests
|
||||
AllowedScopes = new List<string>{ "api", "openid", "offline_access" },
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:51888", "api", AccessTokenType.Jwt))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}", 200, "Hello from Laura"))
|
||||
.And(x => _steps.GivenIHaveATokenForApiReadOnlyScope("http://localhost:51888"))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning(_options, "Test"))
|
||||
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.Forbidden))
|
||||
.BDDfy();
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:51888", "api", AccessTokenType.Jwt))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}", 200, "Hello from Laura"))
|
||||
.And(x => _steps.GivenIHaveATokenForApiReadOnlyScope("http://localhost:51888"))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning(_options, "Test"))
|
||||
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.Forbidden))
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -247,9 +247,9 @@ namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
int port = 61071;
|
||||
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
{
|
||||
new FileReRoute
|
||||
{
|
||||
@ -274,8 +274,8 @@ namespace Ocelot.AcceptanceTests
|
||||
{"Role", "User"}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
var users = new List<TestUser>
|
||||
{
|
||||
@ -286,22 +286,22 @@ namespace Ocelot.AcceptanceTests
|
||||
SubjectId = "registered|1231231",
|
||||
Claims = new List<Claim>
|
||||
{
|
||||
new Claim("Role", "AdminUser"),
|
||||
new Claim("Role", "AdminUser"),
|
||||
new Claim("Role", "User")
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:51888", "api", AccessTokenType.Jwt, users))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}", 200, "Hello from Laura"))
|
||||
.And(x => _steps.GivenIHaveAToken("http://localhost:51888"))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning(_options, "Test"))
|
||||
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
||||
.And(x => _steps.ThenTheResponseBodyShouldBe("Hello from Laura"))
|
||||
.BDDfy();
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:51888", "api", AccessTokenType.Jwt, users))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}", 200, "Hello from Laura"))
|
||||
.And(x => _steps.GivenIHaveAToken("http://localhost:51888"))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning(_options, "Test"))
|
||||
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
||||
.And(x => _steps.ThenTheResponseBodyShouldBe("Hello from Laura"))
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
private void GivenThereIsAServiceRunningOn(string url, int statusCode, string responseBody)
|
||||
@ -467,4 +467,4 @@ namespace Ocelot.AcceptanceTests
|
||||
_identityServerBuilder?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ using Newtonsoft.Json;
|
||||
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
class BearerToken
|
||||
internal class BearerToken
|
||||
{
|
||||
[JsonProperty("access_token")]
|
||||
public string AccessToken { get; set; }
|
||||
@ -13,4 +13,4 @@ namespace Ocelot.AcceptanceTests
|
||||
[JsonProperty("token_type")]
|
||||
public string TokenType { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,5 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using Butterfly.Client.AspNetCore;
|
||||
using Configuration.File;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
@ -11,6 +7,10 @@ namespace Ocelot.AcceptanceTests
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Rafty.Infrastructure;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
@ -157,7 +157,8 @@ namespace Ocelot.AcceptanceTests
|
||||
.UseKestrel()
|
||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||
.UseIISIntegration()
|
||||
.ConfigureServices(services => {
|
||||
.ConfigureServices(services =>
|
||||
{
|
||||
services.AddButterfly(option =>
|
||||
{
|
||||
option.CollectorUrl = butterflyUrl;
|
||||
@ -169,10 +170,10 @@ namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
app.UsePathBase(basePath);
|
||||
app.Run(async context =>
|
||||
{
|
||||
{
|
||||
_downstreamPathOne = !string.IsNullOrEmpty(context.Request.PathBase.Value) ? context.Request.PathBase.Value : context.Request.Path.Value;
|
||||
|
||||
if(_downstreamPathOne != basePath)
|
||||
if (_downstreamPathOne != basePath)
|
||||
{
|
||||
context.Response.StatusCode = statusCode;
|
||||
await context.Response.WriteAsync("downstream path didnt match base path");
|
||||
@ -216,7 +217,8 @@ namespace Ocelot.AcceptanceTests
|
||||
.UseKestrel()
|
||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||
.UseIISIntegration()
|
||||
.ConfigureServices(services => {
|
||||
.ConfigureServices(services =>
|
||||
{
|
||||
services.AddButterfly(option =>
|
||||
{
|
||||
option.CollectorUrl = butterflyUrl;
|
||||
@ -228,10 +230,10 @@ namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
app.UsePathBase(basePath);
|
||||
app.Run(async context =>
|
||||
{
|
||||
{
|
||||
_downstreamPathTwo = !string.IsNullOrEmpty(context.Request.PathBase.Value) ? context.Request.PathBase.Value : context.Request.Path.Value;
|
||||
|
||||
if(_downstreamPathTwo != basePath)
|
||||
if (_downstreamPathTwo != basePath)
|
||||
{
|
||||
context.Response.StatusCode = statusCode;
|
||||
await context.Response.WriteAsync("downstream path didnt match base path");
|
||||
|
@ -1,12 +1,12 @@
|
||||
namespace Ocelot.AcceptanceTests.Caching
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Linq;
|
||||
using CacheManager.Core;
|
||||
using CacheManager.Core.Internal;
|
||||
using CacheManager.Core.Logging;
|
||||
using CacheManager.Core.Utility;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Linq;
|
||||
|
||||
public class InMemoryJsonHandle<TCacheValue> : BaseCacheHandle<TCacheValue>
|
||||
{
|
||||
|
@ -1,11 +1,11 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using Configuration.File;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using Configuration.File;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Ocelot.Configuration.File;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Xunit;
|
||||
|
||||
public class CannotStartOcelotTests : IDisposable
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -237,4 +237,4 @@ namespace Ocelot.AcceptanceTests
|
||||
_steps.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,23 @@
|
||||
using Xunit;
|
||||
|
||||
[assembly: CollectionBehavior(DisableTestParallelization = true)]
|
||||
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using IdentityServer4.AccessTokenValidation;
|
||||
using IdentityServer4.Models;
|
||||
using IdentityServer4.Test;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Ocelot.Configuration.File;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Security.Claims;
|
||||
using IdentityServer4.AccessTokenValidation;
|
||||
using IdentityServer4.Models;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Ocelot.Configuration.File;
|
||||
using TestStack.BDDfy;
|
||||
|
||||
public class ClaimsToHeadersForwardingTests : IDisposable
|
||||
@ -43,22 +44,22 @@ namespace Ocelot.AcceptanceTests
|
||||
|
||||
[Fact]
|
||||
public void should_return_response_200_and_foward_claim_as_header()
|
||||
{
|
||||
var user = new TestUser()
|
||||
{
|
||||
Username = "test",
|
||||
Password = "test",
|
||||
SubjectId = "registered|1231231",
|
||||
Claims = new List<Claim>
|
||||
{
|
||||
var user = new TestUser()
|
||||
{
|
||||
Username = "test",
|
||||
Password = "test",
|
||||
SubjectId = "registered|1231231",
|
||||
Claims = new List<Claim>
|
||||
{
|
||||
new Claim("CustomerId", "123"),
|
||||
new Claim("LocationId", "1")
|
||||
}
|
||||
};
|
||||
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
}
|
||||
};
|
||||
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
{
|
||||
new FileReRoute
|
||||
{
|
||||
@ -90,19 +91,19 @@ namespace Ocelot.AcceptanceTests
|
||||
{"UserId", "Claims[sub] > value[1] > |"}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:52888", "api", AccessTokenType.Jwt, user))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn("http://localhost:52876", 200))
|
||||
.And(x => _steps.GivenIHaveAToken("http://localhost:52888"))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning(_options, "Test"))
|
||||
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
||||
.And(x => _steps.ThenTheResponseBodyShouldBe("CustomerId: 123 LocationId: 1 UserType: registered UserId: 1231231"))
|
||||
.BDDfy();
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:52888", "api", AccessTokenType.Jwt, user))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn("http://localhost:52876", 200))
|
||||
.And(x => _steps.GivenIHaveAToken("http://localhost:52888"))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning(_options, "Test"))
|
||||
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
||||
.And(x => _steps.ThenTheResponseBodyShouldBe("CustomerId: 123 LocationId: 1 UserType: registered UserId: 1231231"))
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
private void GivenThereIsAServiceRunningOn(string url, int statusCode)
|
||||
@ -196,4 +197,4 @@ namespace Ocelot.AcceptanceTests
|
||||
_identityServerBuilder?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Security.Claims;
|
||||
using IdentityServer4.AccessTokenValidation;
|
||||
using IdentityServer4.AccessTokenValidation;
|
||||
using IdentityServer4.Models;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
@ -12,12 +6,16 @@ using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Primitives;
|
||||
using Ocelot.Configuration.File;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Security.Claims;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using IdentityServer4;
|
||||
using IdentityServer4.Test;
|
||||
using Shouldly;
|
||||
|
||||
@ -45,22 +43,22 @@ namespace Ocelot.AcceptanceTests
|
||||
|
||||
[Fact]
|
||||
public void should_return_response_200_and_foward_claim_as_query_string()
|
||||
{
|
||||
var user = new TestUser()
|
||||
{
|
||||
Username = "test",
|
||||
Password = "test",
|
||||
SubjectId = "registered|1231231",
|
||||
Claims = new List<Claim>
|
||||
{
|
||||
var user = new TestUser()
|
||||
{
|
||||
Username = "test",
|
||||
Password = "test",
|
||||
SubjectId = "registered|1231231",
|
||||
Claims = new List<Claim>
|
||||
{
|
||||
new Claim("CustomerId", "123"),
|
||||
new Claim("LocationId", "1")
|
||||
}
|
||||
};
|
||||
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
}
|
||||
};
|
||||
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
{
|
||||
new FileReRoute
|
||||
{
|
||||
@ -92,39 +90,39 @@ namespace Ocelot.AcceptanceTests
|
||||
{"UserId", "Claims[sub] > value[1] > |"}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:57888", "api", AccessTokenType.Jwt, user))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn("http://localhost:57876", 200))
|
||||
.And(x => _steps.GivenIHaveAToken("http://localhost:57888"))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning(_options, "Test"))
|
||||
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
||||
.And(x => _steps.ThenTheResponseBodyShouldBe("CustomerId: 123 LocationId: 1 UserType: registered UserId: 1231231"))
|
||||
.BDDfy();
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:57888", "api", AccessTokenType.Jwt, user))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn("http://localhost:57876", 200))
|
||||
.And(x => _steps.GivenIHaveAToken("http://localhost:57888"))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning(_options, "Test"))
|
||||
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
||||
.And(x => _steps.ThenTheResponseBodyShouldBe("CustomerId: 123 LocationId: 1 UserType: registered UserId: 1231231"))
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void should_return_response_200_and_foward_claim_as_query_string_and_preserve_original_string()
|
||||
{
|
||||
var user = new TestUser()
|
||||
{
|
||||
Username = "test",
|
||||
Password = "test",
|
||||
SubjectId = "registered|1231231",
|
||||
Claims = new List<Claim>
|
||||
{
|
||||
var user = new TestUser()
|
||||
{
|
||||
Username = "test",
|
||||
Password = "test",
|
||||
SubjectId = "registered|1231231",
|
||||
Claims = new List<Claim>
|
||||
{
|
||||
new Claim("CustomerId", "123"),
|
||||
new Claim("LocationId", "1")
|
||||
}
|
||||
};
|
||||
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
}
|
||||
};
|
||||
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
{
|
||||
new FileReRoute
|
||||
{
|
||||
@ -156,20 +154,20 @@ namespace Ocelot.AcceptanceTests
|
||||
{"UserId", "Claims[sub] > value[1] > |"}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:57888", "api", AccessTokenType.Jwt, user))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn("http://localhost:57876", 200))
|
||||
.And(x => _steps.GivenIHaveAToken("http://localhost:57888"))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning(_options, "Test"))
|
||||
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/?test=1&test=2"))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
||||
.And(x => _steps.ThenTheResponseBodyShouldBe("CustomerId: 123 LocationId: 1 UserType: registered UserId: 1231231"))
|
||||
.And(_ => _downstreamQueryString.ShouldBe("?test=1&test=2&CustomerId=123&LocationId=1&UserId=1231231&UserType=registered"))
|
||||
.BDDfy();
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:57888", "api", AccessTokenType.Jwt, user))
|
||||
.And(x => x.GivenThereIsAServiceRunningOn("http://localhost:57876", 200))
|
||||
.And(x => _steps.GivenIHaveAToken("http://localhost:57888"))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning(_options, "Test"))
|
||||
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/?test=1&test=2"))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
||||
.And(x => _steps.ThenTheResponseBodyShouldBe("CustomerId: 123 LocationId: 1 UserType: registered UserId: 1231231"))
|
||||
.And(_ => _downstreamQueryString.ShouldBe("?test=1&test=2&CustomerId=123&LocationId=1&UserId=1231231&UserType=registered"))
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
private void GivenThereIsAServiceRunningOn(string url, int statusCode)
|
||||
@ -284,4 +282,4 @@ namespace Ocelot.AcceptanceTests
|
||||
_identityServerBuilder?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -60,20 +60,20 @@
|
||||
DisableRateLimitHeaders = false,
|
||||
QuotaExceededMessage = "",
|
||||
RateLimitCounterPrefix = "",
|
||||
HttpStatusCode = 428
|
||||
HttpStatusCode = 428
|
||||
},
|
||||
RequestIdKey ="oceclientrequest"
|
||||
RequestIdKey = "oceclientrequest"
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:51876", "/api/ClientRateLimit"))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGatewayMultipleTimesForRateLimit("/api/ClientRateLimit",1))
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGatewayMultipleTimesForRateLimit("/api/ClientRateLimit", 1))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(200))
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGatewayMultipleTimesForRateLimit("/api/ClientRateLimit", 2))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(200))
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGatewayMultipleTimesForRateLimit("/api/ClientRateLimit",1))
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGatewayMultipleTimesForRateLimit("/api/ClientRateLimit", 1))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(428))
|
||||
.BDDfy();
|
||||
}
|
||||
@ -100,7 +100,7 @@
|
||||
UpstreamPathTemplate = "/api/ClientRateLimit",
|
||||
UpstreamHttpMethod = new List<string> { "Get" },
|
||||
RequestIdKey = _steps.RequestIdKey,
|
||||
|
||||
|
||||
RateLimitOptions = new FileRateLimitRule()
|
||||
{
|
||||
EnableRateLimiting = true,
|
||||
@ -121,24 +121,24 @@
|
||||
RateLimitCounterPrefix = "",
|
||||
HttpStatusCode = 428
|
||||
},
|
||||
RequestIdKey ="oceclientrequest"
|
||||
RequestIdKey = "oceclientrequest"
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:51926", "/api/ClientRateLimit"))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGatewayMultipleTimesForRateLimit("/api/ClientRateLimit",1))
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGatewayMultipleTimesForRateLimit("/api/ClientRateLimit", 1))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(200))
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGatewayMultipleTimesForRateLimit("/api/ClientRateLimit", 2))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(200))
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGatewayMultipleTimesForRateLimit("/api/ClientRateLimit",1))
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGatewayMultipleTimesForRateLimit("/api/ClientRateLimit", 1))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(428))
|
||||
.And(x => _steps.GivenIWait(1000))
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGatewayMultipleTimesForRateLimit("/api/ClientRateLimit",1))
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGatewayMultipleTimesForRateLimit("/api/ClientRateLimit", 1))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(428))
|
||||
.And(x => _steps.GivenIWait(1000))
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGatewayMultipleTimesForRateLimit("/api/ClientRateLimit",1))
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGatewayMultipleTimesForRateLimit("/api/ClientRateLimit", 1))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(200))
|
||||
.BDDfy();
|
||||
}
|
||||
|
@ -1,16 +1,16 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using Configuration.File;
|
||||
using Consul;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -96,7 +96,7 @@ namespace Ocelot.AcceptanceTests
|
||||
var kvp = new FakeConsulGetResponse(base64);
|
||||
|
||||
await context.Response.WriteJsonAsync(new FakeConsulGetResponse[] { kvp });
|
||||
}
|
||||
}
|
||||
else if (context.Request.Method.ToLower() == "put" && context.Request.Path.Value == "/v1/kv/InternalConfiguration")
|
||||
{
|
||||
try
|
||||
|
@ -1,10 +1,5 @@
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.Configuration.Setter;
|
||||
using Ocelot.Middleware;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -39,7 +34,7 @@ namespace Ocelot.AcceptanceTests
|
||||
|
||||
[Fact]
|
||||
public void should_reload_config_on_change()
|
||||
{
|
||||
{
|
||||
this.Given(x => _steps.GivenThereIsAConfiguration(_initialConfig))
|
||||
.And(x => _steps.GivenOcelotIsRunningReloadingConfig(true))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(_anotherConfig))
|
||||
@ -51,7 +46,6 @@ namespace Ocelot.AcceptanceTests
|
||||
[Fact]
|
||||
public void should_not_reload_config_on_change()
|
||||
{
|
||||
|
||||
this.Given(x => _steps.GivenThereIsAConfiguration(_initialConfig))
|
||||
.And(x => _steps.GivenOcelotIsRunningReloadingConfig(false))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(_anotherConfig))
|
||||
|
@ -1,10 +1,5 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using Cache;
|
||||
using Configuration.File;
|
||||
using Consul;
|
||||
@ -14,6 +9,11 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Newtonsoft.Json;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -312,7 +312,8 @@
|
||||
|
||||
private void ThenTheConfigIsUpdatedInOcelot()
|
||||
{
|
||||
var result = Wait.WaitFor(20000).Until(() => {
|
||||
var result = Wait.WaitFor(20000).Until(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
_steps.WhenIGetUrlOnTheApiGateway("/cs/status/awesome");
|
||||
@ -444,7 +445,7 @@
|
||||
_steps.Dispose();
|
||||
}
|
||||
|
||||
class FakeCache : IOcelotCache<FileConfiguration>
|
||||
private class FakeCache : IOcelotCache<FileConfiguration>
|
||||
{
|
||||
public void Add(string key, FileConfiguration value, TimeSpan ttl, string region)
|
||||
{
|
||||
|
@ -1,16 +1,16 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using Configuration.File;
|
||||
using Consul;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Newtonsoft.Json;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.WebSockets;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Configuration.File;
|
||||
using Consul;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Newtonsoft.Json;
|
||||
using Shouldly;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -130,7 +130,7 @@
|
||||
{
|
||||
if (context.Request.Path.Value == $"/v1/health/service/{serviceName}")
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(_serviceEntries);
|
||||
var json = JsonConvert.SerializeObject(_serviceEntries);
|
||||
context.Response.Headers.Add("Content-Type", "application/json");
|
||||
await context.Response.WriteAsync(json);
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -123,7 +123,6 @@ namespace Ocelot.AcceptanceTests
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:51359", "/", 201, string.Empty))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning())
|
||||
|
@ -1,14 +1,14 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.Middleware;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.Middleware;
|
||||
using Shouldly;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -283,8 +283,8 @@
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
||||
.And(x => x.ThenTheCounterIs(1))
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[Fact(Skip = "This is just an example to show how you could hook into Ocelot pipeline with your own middleware. At the moment you must use Response.OnCompleted callback and cannot change the response :( I will see if this can be changed one day!")]
|
||||
public void should_fix_issue_237()
|
||||
{
|
||||
@ -293,7 +293,7 @@
|
||||
var httpContext = (HttpContext)state;
|
||||
|
||||
if (httpContext.Response.StatusCode > 400)
|
||||
{
|
||||
{
|
||||
Debug.WriteLine("COUNT CALLED");
|
||||
Console.WriteLine("COUNT CALLED");
|
||||
}
|
||||
@ -362,8 +362,8 @@
|
||||
public class FakeMiddleware
|
||||
{
|
||||
private readonly RequestDelegate _next;
|
||||
private readonly Func<object, Task> _callback;
|
||||
|
||||
private readonly Func<object, Task> _callback;
|
||||
|
||||
public FakeMiddleware(RequestDelegate next, Func<object, Task> callback)
|
||||
{
|
||||
_next = next;
|
||||
@ -372,10 +372,10 @@
|
||||
|
||||
public async Task Invoke(HttpContext context)
|
||||
{
|
||||
await _next(context);
|
||||
|
||||
await _next(context);
|
||||
|
||||
context.Response.OnCompleted(_callback, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using Configuration.File;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Newtonsoft.Json;
|
||||
using Steeltoe.Common.Discovery;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using Shouldly;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -48,8 +48,8 @@ namespace Ocelot.AcceptanceTests
|
||||
}
|
||||
};
|
||||
|
||||
var input = "people";
|
||||
|
||||
var input = "people";
|
||||
|
||||
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:51879", "/", 200, "Hello from Laura", "\"people\""))
|
||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||
.And(x => _steps.GivenOcelotIsRunning())
|
||||
@ -99,4 +99,4 @@ namespace Ocelot.AcceptanceTests
|
||||
_steps.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,12 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -215,10 +214,10 @@ namespace Ocelot.AcceptanceTests
|
||||
}
|
||||
}
|
||||
},
|
||||
GlobalConfiguration = new FileGlobalConfiguration
|
||||
{
|
||||
BaseUrl = "http://anotherapp.azurewebsites.net"
|
||||
}
|
||||
GlobalConfiguration = new FileGlobalConfiguration
|
||||
{
|
||||
BaseUrl = "http://anotherapp.azurewebsites.net"
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:6773", "/", 302, "Location", "http://localhost:6773/pay/Receive"))
|
||||
|
@ -1,14 +1,14 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using Configuration;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using Requester;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -122,7 +122,7 @@ namespace Ocelot.AcceptanceTests
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
private void GivenThereIsAServiceRunningOn(string baseUrl, int statusCode, string responseBody)
|
||||
private void GivenThereIsAServiceRunningOn(string baseUrl, int statusCode, string responseBody)
|
||||
{
|
||||
_serviceHandler.GivenThereIsAServiceRunningOn(baseUrl, async context =>
|
||||
{
|
||||
|
@ -1,14 +1,14 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using Shouldly;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -147,7 +147,7 @@
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
||||
.And(x => _steps.ThenTheResponseBodyShouldBe("Hello from Laura"))
|
||||
.BDDfy();
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -203,7 +203,7 @@
|
||||
}
|
||||
|
||||
public class FakeDependency
|
||||
{
|
||||
{
|
||||
public bool Called;
|
||||
}
|
||||
|
||||
@ -226,7 +226,7 @@
|
||||
|
||||
// ReSharper disable once ClassNeverInstantiated.Local
|
||||
private class FakeHandler : DelegatingHandler
|
||||
{
|
||||
{
|
||||
public static DateTime TimeCalled { get; private set; }
|
||||
|
||||
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
|
||||
@ -238,7 +238,7 @@
|
||||
|
||||
// ReSharper disable once ClassNeverInstantiated.Local
|
||||
private class FakeHandlerTwo : DelegatingHandler
|
||||
{
|
||||
{
|
||||
public static DateTime TimeCalled { get; private set; }
|
||||
|
||||
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
|
||||
|
@ -1,11 +1,11 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.LoadBalancer.LoadBalancers;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -58,9 +58,9 @@ namespace Ocelot.AcceptanceTests
|
||||
}
|
||||
}
|
||||
},
|
||||
GlobalConfiguration = new FileGlobalConfiguration()
|
||||
{
|
||||
}
|
||||
GlobalConfiguration = new FileGlobalConfiguration()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenProductServiceOneIsRunning(downstreamServiceOneUrl, 200))
|
||||
@ -107,9 +107,9 @@ namespace Ocelot.AcceptanceTests
|
||||
}
|
||||
}
|
||||
},
|
||||
GlobalConfiguration = new FileGlobalConfiguration()
|
||||
{
|
||||
}
|
||||
GlobalConfiguration = new FileGlobalConfiguration()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
this.Given(x => x.GivenProductServiceOneIsRunning(downstreamServiceOneUrl, 200))
|
||||
|
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>0.0.0-dev</VersionPrefix>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<AssemblyName>Ocelot.AcceptanceTests</AssemblyName>
|
||||
<OutputType>Exe</OutputType>
|
||||
<PackageId>Ocelot.AcceptanceTests</PackageId>
|
||||
@ -37,32 +37,35 @@
|
||||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2">
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.0" />
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="2.1.2" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.2.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.DotNet.InternalAbstractions" Version="1.0.500-preview2-1-003177" />
|
||||
<PackageReference Include="Shouldly" Version="3.0.0" />
|
||||
<PackageReference Include="Shouldly" Version="3.0.2" />
|
||||
<PackageReference Include="TestStack.BDDfy" Version="4.3.2" />
|
||||
<PackageReference Include="xunit" Version="2.3.1" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="Butterfly.Client.AspNetCore" Version="0.0.8" />
|
||||
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="2.6.0" />
|
||||
<PackageReference Include="IdentityServer4" Version="2.2.0" />
|
||||
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="2.7.0" />
|
||||
<PackageReference Include="IdentityServer4" Version="2.4.0" />
|
||||
<PackageReference Include="Consul" Version="0.7.2.6" />
|
||||
<PackageReference Include="Rafty" Version="0.4.4" />
|
||||
<PackageReference Include="CacheManager.Microsoft.Extensions.Logging" Version="1.1.2" />
|
||||
<PackageReference Include="CacheManager.Serialization.Json" Version="1.1.2" />
|
||||
<PackageReference Include="Pivotal.Discovery.ClientCore" Version="2.0.1" />
|
||||
<PackageReference Include="CacheManager.Microsoft.Extensions.Logging" Version="1.2.0" />
|
||||
<PackageReference Include="CacheManager.Serialization.Json" Version="1.2.0" />
|
||||
<PackageReference Include="Pivotal.Discovery.ClientCore" Version="2.2.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
@ -1,12 +1,12 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using Configuration.File;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Configuration.File;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -218,7 +218,7 @@
|
||||
.And(x => _steps.ThenTheResponseBodyShouldBe("Hello from Laura"))
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
||||
private void GivenIWaitMilliseconds(int ms)
|
||||
{
|
||||
Thread.Sleep(ms);
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
@ -16,4 +15,4 @@ using System.Runtime.InteropServices;
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("f8c224fe-36be-45f5-9b0e-666d8f4a9b52")]
|
||||
[assembly: Guid("f8c224fe-36be-45f5-9b0e-666d8f4a9b52")]
|
||||
|
@ -1,12 +1,10 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
using Ocelot.Configuration.File;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using Ocelot.Configuration.File;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Ocelot.Configuration.File;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -180,4 +180,4 @@
|
||||
_steps.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using Ocelot.Configuration.File;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using Ocelot.Configuration.File;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
|
@ -1,10 +1,9 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using Ocelot.Configuration.File;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -63,4 +62,4 @@
|
||||
_steps.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using Configuration.File;
|
||||
using Consul;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Newtonsoft.Json;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
|
@ -1,15 +1,14 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.WebSockets;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class ServiceHandler : IDisposable
|
||||
{
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -118,4 +118,4 @@ namespace Ocelot.AcceptanceTests
|
||||
_steps.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using Configuration.Repository;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using Responses;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using Configuration.Repository;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using Responses;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -84,7 +84,7 @@
|
||||
_steps.Dispose();
|
||||
}
|
||||
|
||||
class FakeFileConfigurationRepository : IFileConfigurationRepository
|
||||
private class FakeFileConfigurationRepository : IFileConfigurationRepository
|
||||
{
|
||||
public Task<Response<FileConfiguration>> Get()
|
||||
{
|
||||
|
@ -1,14 +1,8 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Caching;
|
||||
using Configuration.Repository;
|
||||
using global::CacheManager.Core;
|
||||
using IdentityServer4.AccessTokenValidation;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
@ -17,29 +11,34 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Ocelot.Cache.CacheManager;
|
||||
using Ocelot.Configuration.Creator;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.DependencyInjection;
|
||||
using Ocelot.Infrastructure;
|
||||
using Ocelot.Middleware;
|
||||
using Shouldly;
|
||||
using ConfigurationBuilder = Microsoft.Extensions.Configuration.ConfigurationBuilder;
|
||||
using System.IO.Compression;
|
||||
using System.Text;
|
||||
using Caching;
|
||||
using static Ocelot.AcceptanceTests.HttpDelegatingHandlersTests;
|
||||
using Ocelot.Middleware.Multiplexer;
|
||||
using static Ocelot.Infrastructure.Wait;
|
||||
using Configuration.Repository;
|
||||
using Ocelot.Configuration.Creator;
|
||||
using Requester;
|
||||
using CookieHeaderValue = System.Net.Http.Headers.CookieHeaderValue;
|
||||
using MediaTypeHeaderValue = System.Net.Http.Headers.MediaTypeHeaderValue;
|
||||
using global::CacheManager.Core;
|
||||
using Ocelot.Cache.CacheManager;
|
||||
using Ocelot.Provider.Consul;
|
||||
using Ocelot.Provider.Eureka;
|
||||
using Ocelot.Infrastructure;
|
||||
using Ocelot.Provider.Polly;
|
||||
using Ocelot.Tracing.Butterfly;
|
||||
using Requester;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using static Ocelot.AcceptanceTests.HttpDelegatingHandlersTests;
|
||||
using ConfigurationBuilder = Microsoft.Extensions.Configuration.ConfigurationBuilder;
|
||||
using CookieHeaderValue = System.Net.Http.Headers.CookieHeaderValue;
|
||||
using MediaTypeHeaderValue = System.Net.Http.Headers.MediaTypeHeaderValue;
|
||||
|
||||
public class Steps : IDisposable
|
||||
{
|
||||
@ -141,7 +140,6 @@
|
||||
await _ocelotHost.StartAsync();
|
||||
}
|
||||
|
||||
|
||||
public void GivenThereIsAConfiguration(FileConfiguration fileConfiguration)
|
||||
{
|
||||
var configurationPath = TestConfiguration.ConfigurationPath;
|
||||
@ -150,7 +148,14 @@
|
||||
|
||||
if (File.Exists(configurationPath))
|
||||
{
|
||||
File.Delete(configurationPath);
|
||||
try
|
||||
{
|
||||
File.Delete(configurationPath);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
}
|
||||
}
|
||||
|
||||
File.WriteAllText(configurationPath, jsonConfiguration);
|
||||
@ -162,7 +167,14 @@
|
||||
|
||||
if (File.Exists(configurationPath))
|
||||
{
|
||||
File.Delete(configurationPath);
|
||||
try
|
||||
{
|
||||
File.Delete(configurationPath);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
}
|
||||
}
|
||||
|
||||
File.WriteAllText(configurationPath, jsonConfiguration);
|
||||
@ -190,7 +202,7 @@
|
||||
})
|
||||
.ConfigureServices(s =>
|
||||
{
|
||||
s.AddOcelot();
|
||||
s.AddOcelot();
|
||||
})
|
||||
.Configure(app =>
|
||||
{
|
||||
@ -261,7 +273,6 @@
|
||||
_ocelotClient = _ocelotServer.CreateClient();
|
||||
}
|
||||
|
||||
|
||||
public void ThenTheTraceHeaderIsSet(string key)
|
||||
{
|
||||
var header = _response.Headers.GetValues(key);
|
||||
@ -306,7 +317,6 @@
|
||||
_ocelotClient = _ocelotServer.CreateClient();
|
||||
}
|
||||
|
||||
|
||||
public void GivenOcelotIsRunningUsingConsulToStoreConfigAndJsonSerializedCache()
|
||||
{
|
||||
_webHostBuilder = new WebHostBuilder();
|
||||
@ -339,7 +349,7 @@
|
||||
.Configure(app =>
|
||||
{
|
||||
app.UseOcelot().Wait();
|
||||
});
|
||||
});
|
||||
|
||||
_ocelotServer = new TestServer(_webHostBuilder);
|
||||
|
||||
@ -376,7 +386,8 @@
|
||||
|
||||
public void WhenIGetUrlOnTheApiGatewayWaitingForTheResponseToBeOk(string url)
|
||||
{
|
||||
var result = Wait.WaitFor(2000).Until(() => {
|
||||
var result = Wait.WaitFor(2000).Until(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
_response = _ocelotClient.GetAsync(url).Result;
|
||||
@ -392,7 +403,6 @@
|
||||
result.ShouldBeTrue();
|
||||
}
|
||||
|
||||
|
||||
public void GivenOcelotIsRunningUsingJsonSerializedCache()
|
||||
{
|
||||
_webHostBuilder = new WebHostBuilder();
|
||||
@ -423,7 +433,7 @@
|
||||
.Configure(app =>
|
||||
{
|
||||
app.UseOcelot().Wait();
|
||||
});
|
||||
});
|
||||
|
||||
_ocelotServer = new TestServer(_webHostBuilder);
|
||||
|
||||
@ -559,7 +569,7 @@
|
||||
_ocelotClient = _ocelotServer.CreateClient();
|
||||
}
|
||||
|
||||
public void GivenOcelotIsRunningWithGlobalHandlersRegisteredInDi<TOne, TWo>()
|
||||
public void GivenOcelotIsRunningWithGlobalHandlersRegisteredInDi<TOne, TWo>()
|
||||
where TOne : DelegatingHandler
|
||||
where TWo : DelegatingHandler
|
||||
{
|
||||
@ -592,7 +602,7 @@
|
||||
_ocelotClient = _ocelotServer.CreateClient();
|
||||
}
|
||||
|
||||
public void GivenOcelotIsRunningWithGlobalHandlerRegisteredInDi<TOne>()
|
||||
public void GivenOcelotIsRunningWithGlobalHandlerRegisteredInDi<TOne>()
|
||||
where TOne : DelegatingHandler
|
||||
{
|
||||
_webHostBuilder = new WebHostBuilder();
|
||||
@ -623,7 +633,7 @@
|
||||
_ocelotClient = _ocelotServer.CreateClient();
|
||||
}
|
||||
|
||||
public void GivenOcelotIsRunningWithGlobalHandlersRegisteredInDi<TOne>(FakeDependency dependency)
|
||||
public void GivenOcelotIsRunningWithGlobalHandlersRegisteredInDi<TOne>(FakeDependency dependency)
|
||||
where TOne : DelegatingHandler
|
||||
{
|
||||
_webHostBuilder = new WebHostBuilder();
|
||||
@ -884,8 +894,6 @@
|
||||
_ocelotClient = _ocelotServer.CreateClient();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void WhenIGetUrlOnTheApiGateway(string url)
|
||||
{
|
||||
_response = _ocelotClient.GetAsync(url).Result;
|
||||
@ -1004,7 +1012,7 @@
|
||||
{
|
||||
_response.Content.ReadAsStringAsync().Result.ShouldBe(expectedBody);
|
||||
}
|
||||
|
||||
|
||||
public void ThenTheContentLengthIs(int expected)
|
||||
{
|
||||
_response.Content.Headers.ContentLength.ShouldBe(expected);
|
||||
@ -1111,7 +1119,6 @@
|
||||
_ocelotServer = new TestServer(_webHostBuilder);
|
||||
|
||||
_ocelotClient = _ocelotServer.CreateClient();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
|
@ -7,4 +7,4 @@ namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
public static string ConfigurationPath => Path.Combine(AppContext.BaseDirectory, "ocelot.json");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using Configuration.File;
|
||||
using Consul;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration.File;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
using Ocelot.Configuration.File;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.WebSockets;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Ocelot.Configuration.File;
|
||||
using Shouldly;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -99,7 +99,7 @@ namespace Ocelot.AcceptanceTests
|
||||
this.Given(_ => _steps.GivenThereIsAConfiguration(config))
|
||||
.And(_ => _steps.StartFakeOcelotWithWebSockets())
|
||||
.And(_ => StartFakeDownstreamService($"http://{downstreamHost}:{downstreamPort}", "/ws"))
|
||||
.And(_ => StartSecondFakeDownstreamService($"http://{secondDownstreamHost}:{secondDownstreamPort}","/ws"))
|
||||
.And(_ => StartSecondFakeDownstreamService($"http://{secondDownstreamHost}:{secondDownstreamPort}", "/ws"))
|
||||
.When(_ => WhenIStartTheClients())
|
||||
.Then(_ => ThenBothDownstreamServicesAreCalled())
|
||||
.BDDfy();
|
||||
@ -132,7 +132,7 @@ namespace Ocelot.AcceptanceTests
|
||||
private async Task StartClient(string url)
|
||||
{
|
||||
var client = new ClientWebSocket();
|
||||
|
||||
|
||||
await client.ConnectAsync(new Uri(url), CancellationToken.None);
|
||||
|
||||
var sending = Task.Run(async () =>
|
||||
@ -221,7 +221,7 @@ namespace Ocelot.AcceptanceTests
|
||||
|
||||
private async Task StartFakeDownstreamService(string url, string path)
|
||||
{
|
||||
await _serviceHandler.StartFakeDownstreamService(url, path, async(context, next) =>
|
||||
await _serviceHandler.StartFakeDownstreamService(url, path, async (context, next) =>
|
||||
{
|
||||
if (context.Request.Path == path)
|
||||
{
|
||||
|
@ -18,7 +18,7 @@
|
||||
"shouldRegisterWithEureka": true,
|
||||
"shouldFetchRegistry": true,
|
||||
"port": 5000,
|
||||
"hostName": "localhost"
|
||||
"hostName": "localhost"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using BenchmarkDotNet.Columns;
|
||||
using BenchmarkDotNet.Configs;
|
||||
using BenchmarkDotNet.Diagnosers;
|
||||
using BenchmarkDotNet.Validators;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@ -11,14 +10,13 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.DownstreamRouteFinder.UrlMatcher;
|
||||
using Ocelot.Middleware;
|
||||
using Ocelot.DependencyInjection;
|
||||
using Ocelot.Middleware;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using BenchmarkDotNet.Attributes.Jobs;
|
||||
using BenchmarkDotNet.Diagnosers;
|
||||
using BenchmarkDotNet.Validators;
|
||||
|
||||
namespace Ocelot.Benchmarks
|
||||
{
|
||||
@ -76,16 +74,16 @@ namespace Ocelot.Benchmarks
|
||||
response.EnsureSuccessStatusCode();
|
||||
}
|
||||
|
||||
/* * Summary*
|
||||
BenchmarkDotNet = v0.10.13, OS = macOS 10.12.6 (16G1212) [Darwin 16.7.0]
|
||||
Intel Core i5-4278U CPU 2.60GHz(Haswell), 1 CPU, 4 logical cores and 2 physical cores
|
||||
.NET Core SDK = 2.1.4
|
||||
/* * Summary*
|
||||
BenchmarkDotNet = v0.10.13, OS = macOS 10.12.6 (16G1212) [Darwin 16.7.0]
|
||||
Intel Core i5-4278U CPU 2.60GHz(Haswell), 1 CPU, 4 logical cores and 2 physical cores
|
||||
.NET Core SDK = 2.1.4
|
||||
|
||||
[Host] : .NET Core 2.0.6 (CoreCLR 4.6.0.0, CoreFX 4.6.26212.01), 64bit RyuJIT
|
||||
DefaultJob : .NET Core 2.0.6 (CoreCLR 4.6.0.0, CoreFX 4.6.26212.01), 64bit RyuJIT
|
||||
Method | Mean | Error | StdDev | StdErr | Min | Q1 | Median | Q3 | Max | Op/s | Scaled | Gen 0 | Gen 1 | Allocated |
|
||||
--------- |---------:|----------:|----------:|----------:|---------:|---------:|---------:|---------:|---------:|------:|-------:|--------:|-------:|----------:|
|
||||
Baseline | 2.102 ms | 0.0292 ms | 0.0273 ms | 0.0070 ms | 2.063 ms | 2.080 ms | 2.093 ms | 2.122 ms | 2.152 ms | 475.8 | 1.00 | 31.2500 | 3.9063 | 1.63 KB |*/
|
||||
[Host] : .NET Core 2.0.6 (CoreCLR 4.6.0.0, CoreFX 4.6.26212.01), 64bit RyuJIT
|
||||
DefaultJob : .NET Core 2.0.6 (CoreCLR 4.6.0.0, CoreFX 4.6.26212.01), 64bit RyuJIT
|
||||
Method | Mean | Error | StdDev | StdErr | Min | Q1 | Median | Q3 | Max | Op/s | Scaled | Gen 0 | Gen 1 | Allocated |
|
||||
--------- |---------:|----------:|----------:|----------:|---------:|---------:|---------:|---------:|---------:|------:|-------:|--------:|-------:|----------:|
|
||||
Baseline | 2.102 ms | 0.0292 ms | 0.0273 ms | 0.0070 ms | 2.063 ms | 2.080 ms | 2.093 ms | 2.122 ms | 2.152 ms | 475.8 | 1.00 | 31.2500 | 3.9063 | 1.63 KB |*/
|
||||
|
||||
private void GivenOcelotIsRunning(string url)
|
||||
{
|
||||
@ -102,7 +100,8 @@ namespace Ocelot.Benchmarks
|
||||
.AddJsonFile("ocelot.json", false, false)
|
||||
.AddEnvironmentVariables();
|
||||
})
|
||||
.ConfigureServices(s => {
|
||||
.ConfigureServices(s =>
|
||||
{
|
||||
s.AddOcelot();
|
||||
})
|
||||
.ConfigureLogging((hostingContext, logging) =>
|
||||
@ -132,7 +131,7 @@ namespace Ocelot.Benchmarks
|
||||
|
||||
File.WriteAllText(configurationPath, jsonConfiguration);
|
||||
}
|
||||
|
||||
|
||||
private void GivenThereIsAServiceRunningOn(string baseUrl, string basePath, int statusCode, string responseBody)
|
||||
{
|
||||
_service = new WebHostBuilder()
|
||||
@ -144,7 +143,7 @@ namespace Ocelot.Benchmarks
|
||||
{
|
||||
app.UsePathBase(basePath);
|
||||
app.Run(async context =>
|
||||
{
|
||||
{
|
||||
context.Response.StatusCode = statusCode;
|
||||
await context.Response.WriteAsync(responseBody);
|
||||
});
|
||||
|
@ -1,16 +1,16 @@
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using BenchmarkDotNet.Columns;
|
||||
using BenchmarkDotNet.Configs;
|
||||
using System.Net.Http;
|
||||
using BenchmarkDotNet.Diagnosers;
|
||||
using BenchmarkDotNet.Validators;
|
||||
using System.Net.Http;
|
||||
|
||||
namespace Ocelot.Benchmarks
|
||||
{
|
||||
using System.Collections.Concurrent;
|
||||
using Configuration;
|
||||
using Configuration.Builder;
|
||||
using Requester;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
[Config(typeof(DictionaryBenchmarks))]
|
||||
public class DictionaryBenchmarks : ManualConfig
|
||||
|
@ -1,33 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using BenchmarkDotNet.Columns;
|
||||
using BenchmarkDotNet.Configs;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.DownstreamRouteFinder.UrlMatcher;
|
||||
using Ocelot.Middleware;
|
||||
using Ocelot.DependencyInjection;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using BenchmarkDotNet.Attributes.Jobs;
|
||||
using Ocelot.Configuration.Repository;
|
||||
using Ocelot.Infrastructure.RequestData;
|
||||
using Ocelot.Logging;
|
||||
using Ocelot.Errors.Middleware;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using BenchmarkDotNet.Diagnosers;
|
||||
using BenchmarkDotNet.Validators;
|
||||
using Ocelot.DownstreamRouteFinder.Middleware;
|
||||
using Ocelot.DownstreamRouteFinder.Finder;
|
||||
using Ocelot.Middleware.Multiplexer;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.DependencyInjection;
|
||||
using Ocelot.DownstreamRouteFinder.Finder;
|
||||
using Ocelot.DownstreamRouteFinder.Middleware;
|
||||
using Ocelot.Logging;
|
||||
using Ocelot.Middleware;
|
||||
using Ocelot.Middleware.Multiplexer;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ocelot.Benchmarks
|
||||
{
|
||||
@ -57,17 +45,18 @@ namespace Ocelot.Benchmarks
|
||||
var drpf = services.GetService<IDownstreamRouteProviderFactory>();
|
||||
var multiplexer = services.GetService<IMultiplexer>();
|
||||
|
||||
_next = async context => {
|
||||
_next = async context =>
|
||||
{
|
||||
await Task.CompletedTask;
|
||||
throw new Exception("BOOM");
|
||||
};
|
||||
|
||||
|
||||
_middleware = new DownstreamRouteFinderMiddleware(_next, loggerFactory, drpf, multiplexer);
|
||||
var httpContext = new DefaultHttpContext();
|
||||
httpContext.Request.Path = new PathString("/test");
|
||||
httpContext.Request.QueryString = new QueryString("?a=b");
|
||||
httpContext.Request.Headers.Add("Host", "most");
|
||||
|
||||
|
||||
_downstreamContext = new DownstreamContext(httpContext)
|
||||
{
|
||||
Configuration = new InternalConfiguration(new List<ReRoute>(), null, null, null, null, null, null, null)
|
||||
|
@ -1,29 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using BenchmarkDotNet.Columns;
|
||||
using BenchmarkDotNet.Configs;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.DownstreamRouteFinder.UrlMatcher;
|
||||
using Ocelot.Middleware;
|
||||
using Ocelot.DependencyInjection;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using BenchmarkDotNet.Attributes.Jobs;
|
||||
using Ocelot.Configuration.Repository;
|
||||
using Ocelot.Infrastructure.RequestData;
|
||||
using Ocelot.Logging;
|
||||
using Ocelot.Errors.Middleware;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using BenchmarkDotNet.Diagnosers;
|
||||
using BenchmarkDotNet.Validators;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Ocelot.Configuration.Repository;
|
||||
using Ocelot.DependencyInjection;
|
||||
using Ocelot.Errors.Middleware;
|
||||
using Ocelot.Infrastructure.RequestData;
|
||||
using Ocelot.Logging;
|
||||
using Ocelot.Middleware;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ocelot.Benchmarks
|
||||
{
|
||||
@ -52,7 +43,8 @@ namespace Ocelot.Benchmarks
|
||||
var loggerFactory = services.GetService<IOcelotLoggerFactory>();
|
||||
var configRepo = services.GetService<IInternalConfigurationRepository>();
|
||||
var repo = services.GetService<IRequestScopedDataRepository>();
|
||||
_next = async context => {
|
||||
_next = async context =>
|
||||
{
|
||||
await Task.CompletedTask;
|
||||
throw new Exception("BOOM");
|
||||
};
|
||||
@ -66,4 +58,4 @@ namespace Ocelot.Benchmarks
|
||||
await _middleware.Invoke(_downstreamContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>0.0.0-dev</VersionPrefix>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<AssemblyName>Ocelot.Benchmarks</AssemblyName>
|
||||
<OutputType>Exe</OutputType>
|
||||
<PackageId>Ocelot.Benchmarks</PackageId>
|
||||
@ -18,10 +18,9 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BenchmarkDotNet" Version="0.10.14" />
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2">
|
||||
<PackageReference Include="BenchmarkDotNet" Version="0.11.5" />
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
</Project>
|
@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
@ -16,4 +15,4 @@ using System.Runtime.InteropServices;
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("106b49e6-95f6-4a7b-b81c-96bfa74af035")]
|
||||
[assembly: Guid("106b49e6-95f6-4a7b-b81c-96bfa74af035")]
|
||||
|
@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using BenchmarkDotNet.Columns;
|
||||
using BenchmarkDotNet.Configs;
|
||||
|
@ -1,10 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Security.Claims;
|
||||
using IdentityServer4.AccessTokenValidation;
|
||||
using IdentityServer4.Models;
|
||||
using IdentityServer4.Test;
|
||||
@ -13,17 +6,21 @@ using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Ocelot.Administration;
|
||||
using Ocelot.Cache;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.DependencyInjection;
|
||||
using Ocelot.Middleware;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
using Ocelot.Administration;
|
||||
using Ocelot.IntegrationTests;
|
||||
|
||||
namespace Ocelot.IntegrationTests
|
||||
{
|
||||
@ -62,19 +59,19 @@ namespace Ocelot.IntegrationTests
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void should_return_response_200_with_call_re_routes_controller()
|
||||
{
|
||||
[Fact]
|
||||
public void should_return_response_200_with_call_re_routes_controller()
|
||||
{
|
||||
var configuration = new FileConfiguration();
|
||||
|
||||
this.Given(x => GivenThereIsAConfiguration(configuration))
|
||||
.And(x => GivenOcelotIsRunning())
|
||||
.And(x => GivenIHaveAnOcelotToken("/administration"))
|
||||
.And(x => GivenIHaveAddedATokenToMyRequest())
|
||||
.When(x => WhenIGetUrlOnTheApiGateway("/administration/configuration"))
|
||||
.Then(x => ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
||||
.BDDfy();
|
||||
}
|
||||
this.Given(x => GivenThereIsAConfiguration(configuration))
|
||||
.And(x => GivenOcelotIsRunning())
|
||||
.And(x => GivenIHaveAnOcelotToken("/administration"))
|
||||
.And(x => GivenIHaveAddedATokenToMyRequest())
|
||||
.When(x => WhenIGetUrlOnTheApiGateway("/administration/configuration"))
|
||||
.Then(x => ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void should_return_response_200_with_call_re_routes_controller_using_base_url_added_in_file_config()
|
||||
@ -226,7 +223,7 @@ namespace Ocelot.IntegrationTests
|
||||
}
|
||||
};
|
||||
|
||||
var updatedConfiguration = new FileConfiguration
|
||||
var updatedConfiguration = new FileConfiguration
|
||||
{
|
||||
GlobalConfiguration = new FileGlobalConfiguration
|
||||
{
|
||||
@ -321,7 +318,7 @@ namespace Ocelot.IntegrationTests
|
||||
}
|
||||
};
|
||||
|
||||
var updatedConfiguration = new FileConfiguration
|
||||
var updatedConfiguration = new FileConfiguration
|
||||
{
|
||||
GlobalConfiguration = new FileGlobalConfiguration
|
||||
{
|
||||
@ -429,14 +426,15 @@ namespace Ocelot.IntegrationTests
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void should_return_response_200_with_call_re_routes_controller_when_using_own_identity_server_to_secure_admin_area()
|
||||
{
|
||||
[Fact]
|
||||
public void should_return_response_200_with_call_re_routes_controller_when_using_own_identity_server_to_secure_admin_area()
|
||||
{
|
||||
var configuration = new FileConfiguration();
|
||||
|
||||
var identityServerRootUrl = "http://localhost:5123";
|
||||
|
||||
Action<IdentityServerAuthenticationOptions> options = o => {
|
||||
Action<IdentityServerAuthenticationOptions> options = o =>
|
||||
{
|
||||
o.Authority = identityServerRootUrl;
|
||||
o.ApiName = "api";
|
||||
o.RequireHttpsMetadata = false;
|
||||
@ -444,15 +442,15 @@ namespace Ocelot.IntegrationTests
|
||||
o.ApiSecret = "secret";
|
||||
};
|
||||
|
||||
this.Given(x => GivenThereIsAConfiguration(configuration))
|
||||
.And(x => GivenThereIsAnIdentityServerOn(identityServerRootUrl, "api"))
|
||||
.And(x => GivenOcelotIsRunningWithIdentityServerSettings(options))
|
||||
.And(x => GivenIHaveAToken(identityServerRootUrl))
|
||||
.And(x => GivenIHaveAddedATokenToMyRequest())
|
||||
.When(x => WhenIGetUrlOnTheApiGateway("/administration/configuration"))
|
||||
.Then(x => ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
||||
.BDDfy();
|
||||
}
|
||||
this.Given(x => GivenThereIsAConfiguration(configuration))
|
||||
.And(x => GivenThereIsAnIdentityServerOn(identityServerRootUrl, "api"))
|
||||
.And(x => GivenOcelotIsRunningWithIdentityServerSettings(options))
|
||||
.And(x => GivenIHaveAToken(identityServerRootUrl))
|
||||
.And(x => GivenIHaveAddedATokenToMyRequest())
|
||||
.When(x => WhenIGetUrlOnTheApiGateway("/administration/configuration"))
|
||||
.Then(x => ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
private void GivenIHaveAToken(string url)
|
||||
{
|
||||
@ -476,7 +474,7 @@ namespace Ocelot.IntegrationTests
|
||||
}
|
||||
}
|
||||
|
||||
private void GivenThereIsAnIdentityServerOn(string url, string apiName)
|
||||
private void GivenThereIsAnIdentityServerOn(string url, string apiName)
|
||||
{
|
||||
_identityServerBuilder = new WebHostBuilder()
|
||||
.UseUrls(url)
|
||||
@ -529,14 +527,14 @@ namespace Ocelot.IntegrationTests
|
||||
})
|
||||
.Build();
|
||||
|
||||
_identityServerBuilder.Start();
|
||||
_identityServerBuilder.Start();
|
||||
|
||||
using (var httpClient = new HttpClient())
|
||||
{
|
||||
var response = httpClient.GetAsync($"{url}/.well-known/openid-configuration").Result;
|
||||
response.EnsureSuccessStatusCode();
|
||||
}
|
||||
using (var httpClient = new HttpClient())
|
||||
{
|
||||
var response = httpClient.GetAsync($"{url}/.well-known/openid-configuration").Result;
|
||||
response.EnsureSuccessStatusCode();
|
||||
}
|
||||
}
|
||||
|
||||
private void GivenAnotherOcelotIsRunning(string baseUrl)
|
||||
{
|
||||
@ -669,16 +667,18 @@ namespace Ocelot.IntegrationTests
|
||||
config.AddJsonFile("ocelot.json", false, false);
|
||||
config.AddEnvironmentVariables();
|
||||
})
|
||||
.ConfigureServices(x => {
|
||||
.ConfigureServices(x =>
|
||||
{
|
||||
x.AddSingleton(_webHostBuilder);
|
||||
x.AddOcelot()
|
||||
.AddAdministration("/administration", configOptions);
|
||||
})
|
||||
.Configure(app => {
|
||||
})
|
||||
.Configure(app =>
|
||||
{
|
||||
app.UseOcelot().Wait();
|
||||
});
|
||||
|
||||
_builder = _webHostBuilder.Build();
|
||||
_builder = _webHostBuilder.Build();
|
||||
|
||||
_builder.Start();
|
||||
}
|
||||
@ -728,12 +728,14 @@ namespace Ocelot.IntegrationTests
|
||||
config.AddJsonFile("ocelot.json", false, false);
|
||||
config.AddEnvironmentVariables();
|
||||
})
|
||||
.ConfigureServices(x => {
|
||||
.ConfigureServices(x =>
|
||||
{
|
||||
x.AddSingleton(_webHostBuilder);
|
||||
x.AddOcelot()
|
||||
.AddAdministration("/administration", "secret");
|
||||
})
|
||||
.Configure(app => {
|
||||
.Configure(app =>
|
||||
{
|
||||
app.UseOcelot().Wait();
|
||||
});
|
||||
|
||||
@ -804,7 +806,7 @@ namespace Ocelot.IntegrationTests
|
||||
{
|
||||
app.UsePathBase("/foo");
|
||||
app.Run(async context =>
|
||||
{
|
||||
{
|
||||
context.Response.StatusCode = 200;
|
||||
await context.Response.WriteAsync("foo");
|
||||
});
|
||||
@ -825,7 +827,7 @@ namespace Ocelot.IntegrationTests
|
||||
{
|
||||
app.UsePathBase("/bar");
|
||||
app.Run(async context =>
|
||||
{
|
||||
{
|
||||
context.Response.StatusCode = 200;
|
||||
await context.Response.WriteAsync("bar");
|
||||
});
|
||||
|
@ -2,7 +2,7 @@ using Newtonsoft.Json;
|
||||
|
||||
namespace Ocelot.IntegrationTests
|
||||
{
|
||||
class BearerToken
|
||||
internal class BearerToken
|
||||
{
|
||||
[JsonProperty("access_token")]
|
||||
public string AccessToken { get; set; }
|
||||
|
@ -1,13 +1,5 @@
|
||||
using Xunit;
|
||||
|
||||
namespace Ocelot.IntegrationTests
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using Configuration.File;
|
||||
using DependencyInjection;
|
||||
using global::CacheManager.Core;
|
||||
@ -15,13 +7,18 @@ namespace Ocelot.IntegrationTests
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Ocelot.Administration;
|
||||
using Ocelot.Cache.CacheManager;
|
||||
using Ocelot.Middleware;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
using Ocelot.Administration;
|
||||
using Ocelot.IntegrationTests;
|
||||
using Ocelot.Cache.CacheManager;
|
||||
|
||||
public class CacheManagerTests : IDisposable
|
||||
{
|
||||
@ -107,7 +104,7 @@ namespace Ocelot.IntegrationTests
|
||||
.Then(x => ThenTheStatusCodeShouldBe(HttpStatusCode.NoContent))
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
|
||||
private void GivenIHaveAddedATokenToMyRequest()
|
||||
{
|
||||
_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", _token.AccessToken);
|
||||
@ -219,6 +216,5 @@ namespace Ocelot.IntegrationTests
|
||||
_httpClient?.Dispose();
|
||||
_identityServerBuilder?.Dispose();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -4,23 +4,23 @@ using Xunit;
|
||||
|
||||
namespace Ocelot.IntegrationTests
|
||||
{
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.DependencyInjection;
|
||||
using Ocelot.Middleware;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Newtonsoft.Json;
|
||||
using Ocelot.Configuration.File;
|
||||
using Shouldly;
|
||||
using TestStack.BDDfy;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Ocelot.DependencyInjection;
|
||||
using Ocelot.Middleware;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using TestStack.BDDfy;
|
||||
|
||||
public class HeaderTests : IDisposable
|
||||
{
|
||||
@ -180,8 +180,8 @@ namespace Ocelot.IntegrationTests
|
||||
var header = _response.Content.ReadAsStringAsync().Result;
|
||||
|
||||
bool passed = false;
|
||||
|
||||
if(header == windowsOrMac || header == linux)
|
||||
|
||||
if (header == windowsOrMac || header == linux)
|
||||
{
|
||||
passed = true;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>0.0.0-dev</VersionPrefix>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<AssemblyName>Ocelot.IntegrationTests</AssemblyName>
|
||||
<OutputType>Exe</OutputType>
|
||||
<PackageId>Ocelot.IntegrationTests</PackageId>
|
||||
@ -30,26 +30,29 @@
|
||||
<ProjectReference Include="..\..\src\Ocelot.Provider.Rafty\Ocelot.Provider.Rafty.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.4" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />
|
||||
<PackageReference Include="Microsoft.Data.SQLite" Version="2.2.0" />
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2">
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.0" />
|
||||
<PackageReference Include="Microsoft.Data.SQLite" Version="2.2.4" />
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.1.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.2.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.DotNet.InternalAbstractions" Version="1.0.500-preview2-1-003177" />
|
||||
<PackageReference Include="xunit" Version="2.3.1" />
|
||||
<PackageReference Include="Shouldly" Version="3.0.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="Shouldly" Version="3.0.2" />
|
||||
<PackageReference Include="TestStack.BDDfy" Version="4.3.2" />
|
||||
<PackageReference Include="Microsoft.Data.SQLite" Version="2.2.0" />
|
||||
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="2.6.0" />
|
||||
<PackageReference Include="IdentityServer4" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Data.SQLite" Version="2.2.4" />
|
||||
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="2.7.0" />
|
||||
<PackageReference Include="IdentityServer4" Version="2.4.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
@ -16,4 +15,4 @@ using System.Runtime.InteropServices;
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("d4575572-99ca-4530-8737-c296eda326f8")]
|
||||
[assembly: Guid("d4575572-99ca-4530-8737-c296eda326f8")]
|
||||
|
@ -1,13 +1,5 @@
|
||||
namespace Ocelot.IntegrationTests
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Administration;
|
||||
using Configuration.File;
|
||||
using DependencyInjection;
|
||||
@ -17,14 +9,19 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Middleware;
|
||||
using Newtonsoft.Json;
|
||||
using Ocelot.Provider.Rafty;
|
||||
using Rafty.Infrastructure;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
using Ocelot.Administration;
|
||||
using Ocelot.IntegrationTests;
|
||||
using Ocelot.Provider.Rafty;
|
||||
using Ocelot.Infrastructure;
|
||||
using Rafty.Infrastructure;
|
||||
using Wait = Rafty.Infrastructure.Wait;
|
||||
|
||||
public class RaftTests : IDisposable
|
||||
|
@ -1,21 +1,20 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.DependencyInjection;
|
||||
using Ocelot.Middleware;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Newtonsoft.Json;
|
||||
using Ocelot.Configuration.File;
|
||||
using Shouldly;
|
||||
using System.Threading.Tasks;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Concurrent;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Ocelot.DependencyInjection;
|
||||
using Ocelot.Middleware;
|
||||
|
||||
namespace Ocelot.IntegrationTests
|
||||
{
|
||||
@ -177,7 +176,7 @@ namespace Ocelot.IntegrationTests
|
||||
|
||||
private void ThenTheSameHeaderValuesAreReturnedByTheDownstreamService()
|
||||
{
|
||||
foreach(var result in _results)
|
||||
foreach (var result in _results)
|
||||
{
|
||||
result.Result.ShouldBe(result.Random);
|
||||
}
|
||||
@ -190,7 +189,7 @@ namespace Ocelot.IntegrationTests
|
||||
_downstreamBuilder?.Dispose();
|
||||
}
|
||||
|
||||
class ThreadSafeHeadersTestResult
|
||||
private class ThreadSafeHeadersTestResult
|
||||
{
|
||||
public ThreadSafeHeadersTestResult(int result, int random)
|
||||
{
|
||||
|
@ -7,4 +7,4 @@
|
||||
"Microsoft": "Error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1 +1,57 @@
|
||||
{"ReRoutes":[{"DownstreamPathTemplate":"/","UpstreamPathTemplate":"/","UpstreamHttpMethod":"Get","AuthenticationOptions":{"Provider":null,"ProviderRootUrl":null,"ApiName":null,"RequireHttps":false,"AllowedScopes":[],"ApiSecret":null},"AddHeadersToRequest":{},"AddClaimsToRequest":{},"RouteClaimsRequirement":{},"AddQueriesToRequest":{},"RequestIdKey":null,"FileCacheOptions":{"TtlSeconds":0},"ReRouteIsCaseSensitive":false,"ServiceName":null,"DownstreamScheme":"http","DownstreamHost":"localhost","DownstreamPort":51879,"QoSOptions":{"ExceptionsAllowedBeforeBreaking":0,"DurationOfBreak":0,"TimeoutValue":0},"LoadBalancer":null,"RateLimitOptions":{"ClientWhitelist":[],"EnableRateLimiting":false,"Period":null,"PeriodTimespan":0.0,"Limit":0}}],"GlobalConfiguration":{"RequestIdKey":null,"ServiceDiscoveryProvider":{"Provider":null,"Host":null,"Port":0},"AdministrationPath":null,"RateLimitOptions":{"ClientIdHeader":"ClientId","QuotaExceededMessage":null,"RateLimitCounterPrefix":"ocelot","DisableRateLimitHeaders":false,"HttpStatusCode":429}}}
|
||||
{
|
||||
"ReRoutes": [
|
||||
{
|
||||
"DownstreamPathTemplate": "/",
|
||||
"UpstreamPathTemplate": "/",
|
||||
"UpstreamHttpMethod": "Get",
|
||||
"AuthenticationOptions": {
|
||||
"Provider": null,
|
||||
"ProviderRootUrl": null,
|
||||
"ApiName": null,
|
||||
"RequireHttps": false,
|
||||
"AllowedScopes": [],
|
||||
"ApiSecret": null
|
||||
},
|
||||
"AddHeadersToRequest": {},
|
||||
"AddClaimsToRequest": {},
|
||||
"RouteClaimsRequirement": {},
|
||||
"AddQueriesToRequest": {},
|
||||
"RequestIdKey": null,
|
||||
"FileCacheOptions": { "TtlSeconds": 0 },
|
||||
"ReRouteIsCaseSensitive": false,
|
||||
"ServiceName": null,
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHost": "localhost",
|
||||
"DownstreamPort": 51879,
|
||||
"QoSOptions": {
|
||||
"ExceptionsAllowedBeforeBreaking": 0,
|
||||
"DurationOfBreak": 0,
|
||||
"TimeoutValue": 0
|
||||
},
|
||||
"LoadBalancer": null,
|
||||
"RateLimitOptions": {
|
||||
"ClientWhitelist": [],
|
||||
"EnableRateLimiting": false,
|
||||
"Period": null,
|
||||
"PeriodTimespan": 0.0,
|
||||
"Limit": 0
|
||||
}
|
||||
}
|
||||
],
|
||||
"GlobalConfiguration": {
|
||||
"RequestIdKey": null,
|
||||
"ServiceDiscoveryProvider": {
|
||||
"Provider": null,
|
||||
"Host": null,
|
||||
"Port": 0
|
||||
},
|
||||
"AdministrationPath": null,
|
||||
"RateLimitOptions": {
|
||||
"ClientIdHeader": "ClientId",
|
||||
"QuotaExceededMessage": null,
|
||||
"RateLimitCounterPrefix": "ocelot",
|
||||
"DisableRateLimitHeaders": false,
|
||||
"HttpStatusCode": 429
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,19 @@
|
||||
{
|
||||
"Peers": [{
|
||||
"HostAndPort": "http://localhost:5000"
|
||||
},
|
||||
{
|
||||
"HostAndPort": "http://localhost:5002"
|
||||
},
|
||||
{
|
||||
"HostAndPort": "http://localhost:5003"
|
||||
},
|
||||
{
|
||||
"HostAndPort": "http://localhost:5004"
|
||||
},
|
||||
{
|
||||
"HostAndPort": "http://localhost:5001"
|
||||
}
|
||||
]
|
||||
}
|
||||
"Peers": [
|
||||
{
|
||||
"HostAndPort": "http://localhost:5000"
|
||||
},
|
||||
{
|
||||
"HostAndPort": "http://localhost:5002"
|
||||
},
|
||||
{
|
||||
"HostAndPort": "http://localhost:5003"
|
||||
},
|
||||
{
|
||||
"HostAndPort": "http://localhost:5004"
|
||||
},
|
||||
{
|
||||
"HostAndPort": "http://localhost:5001"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>0.0.0-dev</VersionPrefix>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<PreserveCompilationContext>true</PreserveCompilationContext>
|
||||
<AssemblyName>Ocelot.ManualTest</AssemblyName>
|
||||
<OutputType>Exe</OutputType>
|
||||
@ -28,16 +28,16 @@
|
||||
<ProjectReference Include="..\..\src\Ocelot\Ocelot.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.1.1" />
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2">
|
||||
<PackageReference Include="Microsoft.AspNetCore.App" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.2.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.2.0" />
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
@ -1,197 +1,197 @@
|
||||
{
|
||||
"id": "4dbde9fe-89f5-be35-bb9f-d3b438e16375",
|
||||
"name": "Ocelot",
|
||||
"description": "",
|
||||
"order": [
|
||||
"a1c95935-ed18-d5dc-bcb8-a3db8ba1934f",
|
||||
"ea0ed57a-2cb9-8acc-47dd-006b8db2f1b2",
|
||||
"c4494401-3985-a5bf-71fb-6e4171384ac6",
|
||||
"09af8dda-a9cb-20d2-5ee3-0a3023773a1a",
|
||||
"e8825dc3-4137-99a7-0000-ef5786610dc3",
|
||||
"fddfc4fa-5114-69e3-4744-203ed71a526b",
|
||||
"c45d30d7-d9c4-fa05-8110-d6e769bb6ff9",
|
||||
"4684c2fa-f38c-c193-5f55-bf563a1978c6",
|
||||
"37bfa9f1-fe29-6a68-e558-66d125d2c96f",
|
||||
"5f308240-79e3-cf74-7a6b-fe462f0d54f1",
|
||||
"178f16da-c61b-c881-1c33-9d64a56851a4"
|
||||
],
|
||||
"folders": [],
|
||||
"folders_order": [],
|
||||
"timestamp": 0,
|
||||
"owner": "212120",
|
||||
"public": false,
|
||||
"requests": [
|
||||
{
|
||||
"folder": null,
|
||||
"id": "09af8dda-a9cb-20d2-5ee3-0a3023773a1a",
|
||||
"name": "GET http://localhost:5000/comments?postId=1",
|
||||
"dataMode": "params",
|
||||
"data": null,
|
||||
"rawModeData": null,
|
||||
"descriptionFormat": "html",
|
||||
"description": "",
|
||||
"headers": "",
|
||||
"method": "GET",
|
||||
"pathVariables": {},
|
||||
"url": "http://localhost:5000/comments?postId=1",
|
||||
"preRequestScript": null,
|
||||
"tests": null,
|
||||
"currentHelper": "normal",
|
||||
"helperAttributes": "{}",
|
||||
"queryParams": [],
|
||||
"headerData": [],
|
||||
"pathVariableData": [],
|
||||
"responses": [],
|
||||
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375"
|
||||
},
|
||||
{
|
||||
"id": "178f16da-c61b-c881-1c33-9d64a56851a4",
|
||||
"headers": "Authorization: Bearer {{AccessToken}}\n",
|
||||
"headerData": [
|
||||
{
|
||||
"key": "Authorization",
|
||||
"value": "Bearer {{AccessToken}}",
|
||||
"enabled": true,
|
||||
"description": ""
|
||||
}
|
||||
],
|
||||
"url": "http://localhost:5000/administration/configuration",
|
||||
"folder": null,
|
||||
"queryParams": [],
|
||||
"preRequestScript": null,
|
||||
"pathVariables": {},
|
||||
"pathVariableData": [],
|
||||
"method": "GET",
|
||||
"data": null,
|
||||
"dataMode": "params",
|
||||
"tests": null,
|
||||
"currentHelper": "normal",
|
||||
"helperAttributes": "{}",
|
||||
"time": 1508849878025,
|
||||
"name": "GET http://localhost:5000/admin/configuration",
|
||||
"description": "",
|
||||
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375",
|
||||
"responses": [],
|
||||
"isFromCollection": true,
|
||||
"collectionRequestId": "178f16da-c61b-c881-1c33-9d64a56851a4",
|
||||
"rawModeData": null,
|
||||
"descriptionFormat": null
|
||||
},
|
||||
{
|
||||
"id": "37bfa9f1-fe29-6a68-e558-66d125d2c96f",
|
||||
"headers": "",
|
||||
"headerData": [],
|
||||
"url": "http://localhost:5000/administration/connect/token",
|
||||
"folder": null,
|
||||
"queryParams": [],
|
||||
"preRequestScript": null,
|
||||
"pathVariables": {},
|
||||
"pathVariableData": [],
|
||||
"method": "POST",
|
||||
"data": [
|
||||
{
|
||||
"key": "client_id",
|
||||
"value": "admin",
|
||||
"type": "text",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"key": "client_secret",
|
||||
"value": "secret",
|
||||
"type": "text",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"key": "scope",
|
||||
"value": "admin",
|
||||
"type": "text",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"key": "username",
|
||||
"value": "admin",
|
||||
"type": "text",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"key": "password",
|
||||
"value": "secret",
|
||||
"type": "text",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"key": "grant_type",
|
||||
"value": "password",
|
||||
"type": "text",
|
||||
"enabled": true
|
||||
}
|
||||
],
|
||||
"dataMode": "params",
|
||||
"tests": "var jsonData = JSON.parse(responseBody);\npostman.setGlobalVariable(\"AccessToken\", jsonData.access_token);\npostman.setGlobalVariable(\"RefreshToken\", jsonData.refresh_token);",
|
||||
"currentHelper": "normal",
|
||||
"helperAttributes": "{}",
|
||||
"time": 1506359585080,
|
||||
"name": "POST http://localhost:5000/admin/connect/token copy",
|
||||
"description": "",
|
||||
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375",
|
||||
"responses": [],
|
||||
"isFromCollection": true,
|
||||
"collectionRequestId": "37bfa9f1-fe29-6a68-e558-66d125d2c96f",
|
||||
"rawModeData": null,
|
||||
"descriptionFormat": null
|
||||
},
|
||||
{
|
||||
"folder": null,
|
||||
"id": "4684c2fa-f38c-c193-5f55-bf563a1978c6",
|
||||
"name": "DELETE http://localhost:5000/posts/1",
|
||||
"dataMode": "params",
|
||||
"data": null,
|
||||
"rawModeData": null,
|
||||
"descriptionFormat": "html",
|
||||
"description": "",
|
||||
"headers": "",
|
||||
"method": "DELETE",
|
||||
"pathVariables": {},
|
||||
"url": "http://localhost:5000/posts/1",
|
||||
"preRequestScript": null,
|
||||
"tests": null,
|
||||
"currentHelper": "normal",
|
||||
"helperAttributes": "{}",
|
||||
"queryParams": [],
|
||||
"headerData": [],
|
||||
"pathVariableData": [],
|
||||
"responses": [],
|
||||
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375"
|
||||
},
|
||||
{
|
||||
"id": "5f308240-79e3-cf74-7a6b-fe462f0d54f1",
|
||||
"headers": "Authorization: Bearer {{AccessToken}}\n",
|
||||
"headerData": [
|
||||
{
|
||||
"key": "Authorization",
|
||||
"value": "Bearer {{AccessToken}}",
|
||||
"description": "",
|
||||
"enabled": true
|
||||
}
|
||||
],
|
||||
"url": "http://localhost:5000/administration/.well-known/openid-configuration",
|
||||
"folder": null,
|
||||
"queryParams": [],
|
||||
"preRequestScript": null,
|
||||
"pathVariables": {},
|
||||
"pathVariableData": [],
|
||||
"method": "GET",
|
||||
"data": null,
|
||||
"dataMode": "params",
|
||||
"tests": null,
|
||||
"currentHelper": "normal",
|
||||
"helperAttributes": {},
|
||||
"time": 1508849923518,
|
||||
"name": "GET http://localhost:5000/admin/.well-known/openid-configuration",
|
||||
"description": "",
|
||||
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375",
|
||||
"responses": []
|
||||
},
|
||||
"id": "4dbde9fe-89f5-be35-bb9f-d3b438e16375",
|
||||
"name": "Ocelot",
|
||||
"description": "",
|
||||
"order": [
|
||||
"a1c95935-ed18-d5dc-bcb8-a3db8ba1934f",
|
||||
"ea0ed57a-2cb9-8acc-47dd-006b8db2f1b2",
|
||||
"c4494401-3985-a5bf-71fb-6e4171384ac6",
|
||||
"09af8dda-a9cb-20d2-5ee3-0a3023773a1a",
|
||||
"e8825dc3-4137-99a7-0000-ef5786610dc3",
|
||||
"fddfc4fa-5114-69e3-4744-203ed71a526b",
|
||||
"c45d30d7-d9c4-fa05-8110-d6e769bb6ff9",
|
||||
"4684c2fa-f38c-c193-5f55-bf563a1978c6",
|
||||
"37bfa9f1-fe29-6a68-e558-66d125d2c96f",
|
||||
"5f308240-79e3-cf74-7a6b-fe462f0d54f1",
|
||||
"178f16da-c61b-c881-1c33-9d64a56851a4"
|
||||
],
|
||||
"folders": [],
|
||||
"folders_order": [],
|
||||
"timestamp": 0,
|
||||
"owner": "212120",
|
||||
"public": false,
|
||||
"requests": [
|
||||
{
|
||||
"folder": null,
|
||||
"id": "09af8dda-a9cb-20d2-5ee3-0a3023773a1a",
|
||||
"name": "GET http://localhost:5000/comments?postId=1",
|
||||
"dataMode": "params",
|
||||
"data": null,
|
||||
"rawModeData": null,
|
||||
"descriptionFormat": "html",
|
||||
"description": "",
|
||||
"headers": "",
|
||||
"method": "GET",
|
||||
"pathVariables": {},
|
||||
"url": "http://localhost:5000/comments?postId=1",
|
||||
"preRequestScript": null,
|
||||
"tests": null,
|
||||
"currentHelper": "normal",
|
||||
"helperAttributes": "{}",
|
||||
"queryParams": [],
|
||||
"headerData": [],
|
||||
"pathVariableData": [],
|
||||
"responses": [],
|
||||
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375"
|
||||
},
|
||||
{
|
||||
"id": "178f16da-c61b-c881-1c33-9d64a56851a4",
|
||||
"headers": "Authorization: Bearer {{AccessToken}}\n",
|
||||
"headerData": [
|
||||
{
|
||||
"key": "Authorization",
|
||||
"value": "Bearer {{AccessToken}}",
|
||||
"enabled": true,
|
||||
"description": ""
|
||||
}
|
||||
],
|
||||
"url": "http://localhost:5000/administration/configuration",
|
||||
"folder": null,
|
||||
"queryParams": [],
|
||||
"preRequestScript": null,
|
||||
"pathVariables": {},
|
||||
"pathVariableData": [],
|
||||
"method": "GET",
|
||||
"data": null,
|
||||
"dataMode": "params",
|
||||
"tests": null,
|
||||
"currentHelper": "normal",
|
||||
"helperAttributes": "{}",
|
||||
"time": 1508849878025,
|
||||
"name": "GET http://localhost:5000/admin/configuration",
|
||||
"description": "",
|
||||
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375",
|
||||
"responses": [],
|
||||
"isFromCollection": true,
|
||||
"collectionRequestId": "178f16da-c61b-c881-1c33-9d64a56851a4",
|
||||
"rawModeData": null,
|
||||
"descriptionFormat": null
|
||||
},
|
||||
{
|
||||
"id": "37bfa9f1-fe29-6a68-e558-66d125d2c96f",
|
||||
"headers": "",
|
||||
"headerData": [],
|
||||
"url": "http://localhost:5000/administration/connect/token",
|
||||
"folder": null,
|
||||
"queryParams": [],
|
||||
"preRequestScript": null,
|
||||
"pathVariables": {},
|
||||
"pathVariableData": [],
|
||||
"method": "POST",
|
||||
"data": [
|
||||
{
|
||||
"key": "client_id",
|
||||
"value": "admin",
|
||||
"type": "text",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"key": "client_secret",
|
||||
"value": "secret",
|
||||
"type": "text",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"key": "scope",
|
||||
"value": "admin",
|
||||
"type": "text",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"key": "username",
|
||||
"value": "admin",
|
||||
"type": "text",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"key": "password",
|
||||
"value": "secret",
|
||||
"type": "text",
|
||||
"enabled": true
|
||||
},
|
||||
{
|
||||
"key": "grant_type",
|
||||
"value": "password",
|
||||
"type": "text",
|
||||
"enabled": true
|
||||
}
|
||||
],
|
||||
"dataMode": "params",
|
||||
"tests": "var jsonData = JSON.parse(responseBody);\npostman.setGlobalVariable(\"AccessToken\", jsonData.access_token);\npostman.setGlobalVariable(\"RefreshToken\", jsonData.refresh_token);",
|
||||
"currentHelper": "normal",
|
||||
"helperAttributes": "{}",
|
||||
"time": 1506359585080,
|
||||
"name": "POST http://localhost:5000/admin/connect/token copy",
|
||||
"description": "",
|
||||
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375",
|
||||
"responses": [],
|
||||
"isFromCollection": true,
|
||||
"collectionRequestId": "37bfa9f1-fe29-6a68-e558-66d125d2c96f",
|
||||
"rawModeData": null,
|
||||
"descriptionFormat": null
|
||||
},
|
||||
{
|
||||
"folder": null,
|
||||
"id": "4684c2fa-f38c-c193-5f55-bf563a1978c6",
|
||||
"name": "DELETE http://localhost:5000/posts/1",
|
||||
"dataMode": "params",
|
||||
"data": null,
|
||||
"rawModeData": null,
|
||||
"descriptionFormat": "html",
|
||||
"description": "",
|
||||
"headers": "",
|
||||
"method": "DELETE",
|
||||
"pathVariables": {},
|
||||
"url": "http://localhost:5000/posts/1",
|
||||
"preRequestScript": null,
|
||||
"tests": null,
|
||||
"currentHelper": "normal",
|
||||
"helperAttributes": "{}",
|
||||
"queryParams": [],
|
||||
"headerData": [],
|
||||
"pathVariableData": [],
|
||||
"responses": [],
|
||||
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375"
|
||||
},
|
||||
{
|
||||
"id": "5f308240-79e3-cf74-7a6b-fe462f0d54f1",
|
||||
"headers": "Authorization: Bearer {{AccessToken}}\n",
|
||||
"headerData": [
|
||||
{
|
||||
"key": "Authorization",
|
||||
"value": "Bearer {{AccessToken}}",
|
||||
"description": "",
|
||||
"enabled": true
|
||||
}
|
||||
],
|
||||
"url": "http://localhost:5000/administration/.well-known/openid-configuration",
|
||||
"folder": null,
|
||||
"queryParams": [],
|
||||
"preRequestScript": null,
|
||||
"pathVariables": {},
|
||||
"pathVariableData": [],
|
||||
"method": "GET",
|
||||
"data": null,
|
||||
"dataMode": "params",
|
||||
"tests": null,
|
||||
"currentHelper": "normal",
|
||||
"helperAttributes": {},
|
||||
"time": 1508849923518,
|
||||
"name": "GET http://localhost:5000/admin/.well-known/openid-configuration",
|
||||
"description": "",
|
||||
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375",
|
||||
"responses": []
|
||||
},
|
||||
{
|
||||
"folder": null,
|
||||
"id": "a1c95935-ed18-d5dc-bcb8-a3db8ba1934f",
|
||||
@ -252,120 +252,120 @@
|
||||
"responses": [],
|
||||
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375"
|
||||
},
|
||||
{
|
||||
"folder": null,
|
||||
"id": "c4494401-3985-a5bf-71fb-6e4171384ac6",
|
||||
"name": "GET http://localhost:5000/posts/1/comments",
|
||||
"dataMode": "params",
|
||||
"data": null,
|
||||
"rawModeData": null,
|
||||
"descriptionFormat": "html",
|
||||
"description": "",
|
||||
"headers": "",
|
||||
"method": "GET",
|
||||
"pathVariables": {},
|
||||
"url": "http://localhost:5000/posts/1/comments",
|
||||
"preRequestScript": null,
|
||||
"tests": null,
|
||||
"currentHelper": "normal",
|
||||
"helperAttributes": "{}",
|
||||
"queryParams": [],
|
||||
"headerData": [],
|
||||
"pathVariableData": [],
|
||||
"responses": [],
|
||||
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375"
|
||||
},
|
||||
{
|
||||
"folder": null,
|
||||
"id": "c45d30d7-d9c4-fa05-8110-d6e769bb6ff9",
|
||||
"name": "PATCH http://localhost:5000/posts/1",
|
||||
"dataMode": "raw",
|
||||
"data": [],
|
||||
"rawModeData": "{\n \"title\": \"gfdgsgsdgsdfgsdfgdfg\",\n}",
|
||||
"descriptionFormat": "html",
|
||||
"description": "",
|
||||
"headers": "",
|
||||
"method": "PATCH",
|
||||
"pathVariables": {},
|
||||
"url": "http://localhost:5000/posts/1",
|
||||
"preRequestScript": null,
|
||||
"tests": null,
|
||||
"currentHelper": "normal",
|
||||
"helperAttributes": "{}",
|
||||
"queryParams": [],
|
||||
"headerData": [],
|
||||
"pathVariableData": [],
|
||||
"responses": [],
|
||||
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375"
|
||||
},
|
||||
{
|
||||
"folder": null,
|
||||
"id": "e8825dc3-4137-99a7-0000-ef5786610dc3",
|
||||
"name": "POST http://localhost:5000/posts/1",
|
||||
"dataMode": "raw",
|
||||
"data": [],
|
||||
"rawModeData": "{\n \"userId\": 1,\n \"title\": \"test\",\n \"body\": \"test\"\n}",
|
||||
"descriptionFormat": "html",
|
||||
"description": "",
|
||||
"headers": "",
|
||||
"method": "POST",
|
||||
"pathVariables": {},
|
||||
"url": "http://localhost:5000/posts",
|
||||
"preRequestScript": null,
|
||||
"tests": null,
|
||||
"currentHelper": "normal",
|
||||
"helperAttributes": "{}",
|
||||
"queryParams": [],
|
||||
"headerData": [],
|
||||
"pathVariableData": [],
|
||||
"responses": [],
|
||||
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375"
|
||||
},
|
||||
{
|
||||
"folder": null,
|
||||
"id": "ea0ed57a-2cb9-8acc-47dd-006b8db2f1b2",
|
||||
"name": "GET http://localhost:5000/posts/1",
|
||||
"dataMode": "params",
|
||||
"data": null,
|
||||
"rawModeData": null,
|
||||
"descriptionFormat": "html",
|
||||
"description": "",
|
||||
"headers": "",
|
||||
"method": "GET",
|
||||
"pathVariables": {},
|
||||
"url": "http://localhost:5000/posts/1",
|
||||
"preRequestScript": null,
|
||||
"tests": null,
|
||||
"currentHelper": "normal",
|
||||
"helperAttributes": "{}",
|
||||
"queryParams": [],
|
||||
"headerData": [],
|
||||
"pathVariableData": [],
|
||||
"responses": [],
|
||||
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375"
|
||||
},
|
||||
{
|
||||
"folder": null,
|
||||
"id": "fddfc4fa-5114-69e3-4744-203ed71a526b",
|
||||
"name": "PUT http://localhost:5000/posts/1",
|
||||
"dataMode": "raw",
|
||||
"data": [],
|
||||
"rawModeData": "{\n \"userId\": 1,\n \"title\": \"test\",\n \"body\": \"test\"\n}",
|
||||
"descriptionFormat": "html",
|
||||
"description": "",
|
||||
"headers": "",
|
||||
"method": "PUT",
|
||||
"pathVariables": {},
|
||||
"url": "http://localhost:5000/posts/1",
|
||||
"preRequestScript": null,
|
||||
"tests": null,
|
||||
"currentHelper": "normal",
|
||||
"helperAttributes": "{}",
|
||||
"queryParams": [],
|
||||
"headerData": [],
|
||||
"pathVariableData": [],
|
||||
"responses": [],
|
||||
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375"
|
||||
}
|
||||
]
|
||||
}
|
||||
{
|
||||
"folder": null,
|
||||
"id": "c4494401-3985-a5bf-71fb-6e4171384ac6",
|
||||
"name": "GET http://localhost:5000/posts/1/comments",
|
||||
"dataMode": "params",
|
||||
"data": null,
|
||||
"rawModeData": null,
|
||||
"descriptionFormat": "html",
|
||||
"description": "",
|
||||
"headers": "",
|
||||
"method": "GET",
|
||||
"pathVariables": {},
|
||||
"url": "http://localhost:5000/posts/1/comments",
|
||||
"preRequestScript": null,
|
||||
"tests": null,
|
||||
"currentHelper": "normal",
|
||||
"helperAttributes": "{}",
|
||||
"queryParams": [],
|
||||
"headerData": [],
|
||||
"pathVariableData": [],
|
||||
"responses": [],
|
||||
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375"
|
||||
},
|
||||
{
|
||||
"folder": null,
|
||||
"id": "c45d30d7-d9c4-fa05-8110-d6e769bb6ff9",
|
||||
"name": "PATCH http://localhost:5000/posts/1",
|
||||
"dataMode": "raw",
|
||||
"data": [],
|
||||
"rawModeData": "{\n \"title\": \"gfdgsgsdgsdfgsdfgdfg\",\n}",
|
||||
"descriptionFormat": "html",
|
||||
"description": "",
|
||||
"headers": "",
|
||||
"method": "PATCH",
|
||||
"pathVariables": {},
|
||||
"url": "http://localhost:5000/posts/1",
|
||||
"preRequestScript": null,
|
||||
"tests": null,
|
||||
"currentHelper": "normal",
|
||||
"helperAttributes": "{}",
|
||||
"queryParams": [],
|
||||
"headerData": [],
|
||||
"pathVariableData": [],
|
||||
"responses": [],
|
||||
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375"
|
||||
},
|
||||
{
|
||||
"folder": null,
|
||||
"id": "e8825dc3-4137-99a7-0000-ef5786610dc3",
|
||||
"name": "POST http://localhost:5000/posts/1",
|
||||
"dataMode": "raw",
|
||||
"data": [],
|
||||
"rawModeData": "{\n \"userId\": 1,\n \"title\": \"test\",\n \"body\": \"test\"\n}",
|
||||
"descriptionFormat": "html",
|
||||
"description": "",
|
||||
"headers": "",
|
||||
"method": "POST",
|
||||
"pathVariables": {},
|
||||
"url": "http://localhost:5000/posts",
|
||||
"preRequestScript": null,
|
||||
"tests": null,
|
||||
"currentHelper": "normal",
|
||||
"helperAttributes": "{}",
|
||||
"queryParams": [],
|
||||
"headerData": [],
|
||||
"pathVariableData": [],
|
||||
"responses": [],
|
||||
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375"
|
||||
},
|
||||
{
|
||||
"folder": null,
|
||||
"id": "ea0ed57a-2cb9-8acc-47dd-006b8db2f1b2",
|
||||
"name": "GET http://localhost:5000/posts/1",
|
||||
"dataMode": "params",
|
||||
"data": null,
|
||||
"rawModeData": null,
|
||||
"descriptionFormat": "html",
|
||||
"description": "",
|
||||
"headers": "",
|
||||
"method": "GET",
|
||||
"pathVariables": {},
|
||||
"url": "http://localhost:5000/posts/1",
|
||||
"preRequestScript": null,
|
||||
"tests": null,
|
||||
"currentHelper": "normal",
|
||||
"helperAttributes": "{}",
|
||||
"queryParams": [],
|
||||
"headerData": [],
|
||||
"pathVariableData": [],
|
||||
"responses": [],
|
||||
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375"
|
||||
},
|
||||
{
|
||||
"folder": null,
|
||||
"id": "fddfc4fa-5114-69e3-4744-203ed71a526b",
|
||||
"name": "PUT http://localhost:5000/posts/1",
|
||||
"dataMode": "raw",
|
||||
"data": [],
|
||||
"rawModeData": "{\n \"userId\": 1,\n \"title\": \"test\",\n \"body\": \"test\"\n}",
|
||||
"descriptionFormat": "html",
|
||||
"description": "",
|
||||
"headers": "",
|
||||
"method": "PUT",
|
||||
"pathVariables": {},
|
||||
"url": "http://localhost:5000/posts/1",
|
||||
"preRequestScript": null,
|
||||
"tests": null,
|
||||
"currentHelper": "normal",
|
||||
"helperAttributes": "{}",
|
||||
"queryParams": [],
|
||||
"headerData": [],
|
||||
"pathVariableData": [],
|
||||
"responses": [],
|
||||
"collectionId": "4dbde9fe-89f5-be35-bb9f-d3b438e16375"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1,19 +1,18 @@
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
using Ocelot.Requester;
|
||||
using Ocelot.Requester;
|
||||
|
||||
namespace Ocelot.ManualTest
|
||||
{
|
||||
using System.IO;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Ocelot.DependencyInjection;
|
||||
using Ocelot.Middleware;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class Program
|
||||
{
|
||||
@ -31,27 +30,28 @@ namespace Ocelot.ManualTest
|
||||
.AddJsonFile("ocelot.json", false, false)
|
||||
.AddEnvironmentVariables();
|
||||
})
|
||||
.ConfigureServices(s => {
|
||||
s.AddAuthentication()
|
||||
.AddJwtBearer("TestKey", x =>
|
||||
{
|
||||
x.Authority = "test";
|
||||
x.Audience = "test";
|
||||
});
|
||||
.ConfigureServices(s =>
|
||||
{
|
||||
s.AddAuthentication()
|
||||
.AddJwtBearer("TestKey", x =>
|
||||
{
|
||||
x.Authority = "test";
|
||||
x.Audience = "test";
|
||||
});
|
||||
|
||||
s.AddSingleton<QosDelegatingHandlerDelegate>((x, t) => new FakeHandler());
|
||||
s.AddOcelot()
|
||||
.AddDelegatingHandler<FakeHandler>(true);
|
||||
// .AddCacheManager(x =>
|
||||
// {
|
||||
// x.WithDictionaryHandle();
|
||||
// })
|
||||
// .AddOpenTracing(option =>
|
||||
// {
|
||||
// option.CollectorUrl = "http://localhost:9618";
|
||||
// option.Service = "Ocelot.ManualTest";
|
||||
// })
|
||||
// .AddAdministration("/administration", "secret");
|
||||
s.AddSingleton<QosDelegatingHandlerDelegate>((x, t) => new FakeHandler());
|
||||
s.AddOcelot()
|
||||
.AddDelegatingHandler<FakeHandler>(true);
|
||||
// .AddCacheManager(x =>
|
||||
// {
|
||||
// x.WithDictionaryHandle();
|
||||
// })
|
||||
// .AddOpenTracing(option =>
|
||||
// {
|
||||
// option.CollectorUrl = "http://localhost:9618";
|
||||
// option.Service = "Ocelot.ManualTest";
|
||||
// })
|
||||
// .AddAdministration("/administration", "secret");
|
||||
})
|
||||
.ConfigureLogging((hostingContext, logging) =>
|
||||
{
|
||||
@ -64,7 +64,7 @@ namespace Ocelot.ManualTest
|
||||
app.UseOcelot().Wait();
|
||||
})
|
||||
.Build()
|
||||
.Run();
|
||||
.Run();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,4 +13,4 @@
|
||||
"shouldRegisterWithEureka": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,345 +1,345 @@
|
||||
{
|
||||
"ReRoutes": [
|
||||
{
|
||||
"DownstreamPathTemplate": "/profile",
|
||||
"DownstreamScheme": "http",
|
||||
"UpstreamPathTemplate": "/profile",
|
||||
"UpstreamHttpMethod": [ "Get" ],
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "localhost",
|
||||
"Port": 5001
|
||||
}
|
||||
],
|
||||
"QoSOptions": {
|
||||
"TimeoutValue": 360000
|
||||
"ReRoutes": [
|
||||
{
|
||||
"DownstreamPathTemplate": "/profile",
|
||||
"DownstreamScheme": "http",
|
||||
"UpstreamPathTemplate": "/profile",
|
||||
"UpstreamHttpMethod": [ "Get" ],
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "localhost",
|
||||
"Port": 5001
|
||||
}
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/v1/todo/",
|
||||
"DownstreamScheme": "http",
|
||||
"UpstreamPathTemplate": "/api/v1/todo/",
|
||||
"UpstreamHttpMethod": [ "Get", "Post" ],
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "lxtodo.azurewebsites.net",
|
||||
"Port": 80
|
||||
}
|
||||
|
||||
],
|
||||
"DownstreamHeaderTransform": {
|
||||
"Location": "{DownstreamBaseUrl}, {BaseUrl}"
|
||||
],
|
||||
"QoSOptions": {
|
||||
"TimeoutValue": 360000
|
||||
}
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/v1/todo/",
|
||||
"DownstreamScheme": "http",
|
||||
"UpstreamPathTemplate": "/api/v1/todo/",
|
||||
"UpstreamHttpMethod": [ "Get", "Post" ],
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "lxtodo.azurewebsites.net",
|
||||
"Port": 80
|
||||
}
|
||||
|
||||
],
|
||||
"DownstreamHeaderTransform": {
|
||||
"Location": "{DownstreamBaseUrl}, {BaseUrl}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/values",
|
||||
"DownstreamScheme": "https",
|
||||
"UpstreamPathTemplate": "/api/values",
|
||||
"UpstreamHttpMethod": [ "Get" ],
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "testapivalues.azurewebsites.net",
|
||||
"Port": 443
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "localhost",
|
||||
"Port": 52876
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/identityserverexample",
|
||||
"UpstreamHttpMethod": [ "Get" ],
|
||||
"QoSOptions": {
|
||||
"ExceptionsAllowedBeforeBreaking": 3,
|
||||
"DurationOfBreak": 10,
|
||||
"TimeoutValue": 5000
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/values",
|
||||
"DownstreamScheme": "https",
|
||||
"UpstreamPathTemplate": "/api/values",
|
||||
"UpstreamHttpMethod": [ "Get" ],
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "testapivalues.azurewebsites.net",
|
||||
"Port": 443
|
||||
}
|
||||
"AuthenticationOptions": {
|
||||
"AuthenticationProviderKey": "TestKey",
|
||||
"AllowedScopes": [
|
||||
"openid",
|
||||
"offline_access"
|
||||
]
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "localhost",
|
||||
"Port": 52876
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/identityserverexample",
|
||||
"UpstreamHttpMethod": [ "Get" ],
|
||||
"QoSOptions": {
|
||||
"ExceptionsAllowedBeforeBreaking": 3,
|
||||
"DurationOfBreak": 10,
|
||||
"TimeoutValue": 5000
|
||||
},
|
||||
"AuthenticationOptions": {
|
||||
"AuthenticationProviderKey": "TestKey",
|
||||
"AllowedScopes": [
|
||||
"openid",
|
||||
"offline_access"
|
||||
]
|
||||
},
|
||||
"AddHeadersToRequest": {
|
||||
"CustomerId": "Claims[CustomerId] > value",
|
||||
"LocationId": "Claims[LocationId] > value",
|
||||
"UserType": "Claims[sub] > value[0] > |",
|
||||
"UserId": "Claims[sub] > value[1] > |"
|
||||
},
|
||||
"AddClaimsToRequest": {
|
||||
"CustomerId": "Claims[CustomerId] > value",
|
||||
"LocationId": "Claims[LocationId] > value",
|
||||
"UserType": "Claims[sub] > value[0] > |",
|
||||
"UserId": "Claims[sub] > value[1] > |"
|
||||
},
|
||||
"AddQueriesToRequest": {
|
||||
"CustomerId": "Claims[CustomerId] > value",
|
||||
"LocationId": "Claims[LocationId] > value",
|
||||
"UserType": "Claims[sub] > value[0] > |",
|
||||
"UserId": "Claims[sub] > value[1] > |"
|
||||
},
|
||||
"RouteClaimsRequirement": {
|
||||
"UserType": "registered"
|
||||
},
|
||||
"RequestIdKey": "OcRequestId"
|
||||
"AddHeadersToRequest": {
|
||||
"CustomerId": "Claims[CustomerId] > value",
|
||||
"LocationId": "Claims[LocationId] > value",
|
||||
"UserType": "Claims[sub] > value[0] > |",
|
||||
"UserId": "Claims[sub] > value[1] > |"
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/posts",
|
||||
"DownstreamScheme": "https",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "jsonplaceholder.typicode.com",
|
||||
"Port": 443
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/posts",
|
||||
"UpstreamHttpMethod": [ "Get" ],
|
||||
"HttpHandlerOptions": {
|
||||
"AllowAutoRedirect": true,
|
||||
"UseCookieContainer": true
|
||||
},
|
||||
"QoSOptions": {
|
||||
"ExceptionsAllowedBeforeBreaking": 3,
|
||||
"DurationOfBreak": 10,
|
||||
"TimeoutValue": 5000
|
||||
"AddClaimsToRequest": {
|
||||
"CustomerId": "Claims[CustomerId] > value",
|
||||
"LocationId": "Claims[LocationId] > value",
|
||||
"UserType": "Claims[sub] > value[0] > |",
|
||||
"UserId": "Claims[sub] > value[1] > |"
|
||||
},
|
||||
"AddQueriesToRequest": {
|
||||
"CustomerId": "Claims[CustomerId] > value",
|
||||
"LocationId": "Claims[LocationId] > value",
|
||||
"UserType": "Claims[sub] > value[0] > |",
|
||||
"UserId": "Claims[sub] > value[1] > |"
|
||||
},
|
||||
"RouteClaimsRequirement": {
|
||||
"UserType": "registered"
|
||||
},
|
||||
"RequestIdKey": "OcRequestId"
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/posts",
|
||||
"DownstreamScheme": "https",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "jsonplaceholder.typicode.com",
|
||||
"Port": 443
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/posts",
|
||||
"UpstreamHttpMethod": [ "Get" ],
|
||||
"HttpHandlerOptions": {
|
||||
"AllowAutoRedirect": true,
|
||||
"UseCookieContainer": true
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/posts/{postId}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "jsonplaceholder.typicode.com",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/posts/{postId}",
|
||||
"UpstreamHttpMethod": [ "Get" ],
|
||||
"RequestIdKey": "ReRouteRequestId",
|
||||
"HttpHandlerOptions": {
|
||||
"AllowAutoRedirect": true,
|
||||
"UseCookieContainer": true,
|
||||
"UseTracing": true,
|
||||
"UseProxy": true
|
||||
},
|
||||
"QoSOptions": {
|
||||
"ExceptionsAllowedBeforeBreaking": 3,
|
||||
"DurationOfBreak": 10,
|
||||
"TimeoutValue": 5000
|
||||
}
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/posts/{postId}/comments",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "jsonplaceholder.typicode.com",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/posts/{postId}/comments",
|
||||
"UpstreamHttpMethod": [ "Get" ],
|
||||
"HttpHandlerOptions": {
|
||||
"AllowAutoRedirect": true,
|
||||
"UseCookieContainer": true,
|
||||
"UseTracing": false
|
||||
},
|
||||
"QoSOptions": {
|
||||
"ExceptionsAllowedBeforeBreaking": 3,
|
||||
"DurationOfBreak": 10,
|
||||
"TimeoutValue": 5000
|
||||
}
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/comments",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "jsonplaceholder.typicode.com",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/comments",
|
||||
"UpstreamHttpMethod": [ "Get" ],
|
||||
"QoSOptions": {
|
||||
"ExceptionsAllowedBeforeBreaking": 3,
|
||||
"DurationOfBreak": 10,
|
||||
"TimeoutValue": 5000
|
||||
}
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/posts",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "jsonplaceholder.typicode.com",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/posts",
|
||||
"UpstreamHttpMethod": [ "Post" ],
|
||||
"QoSOptions": {
|
||||
"ExceptionsAllowedBeforeBreaking": 3,
|
||||
"DurationOfBreak": 10,
|
||||
"TimeoutValue": 5000
|
||||
}
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/posts/{postId}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "jsonplaceholder.typicode.com",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/posts/{postId}",
|
||||
"UpstreamHttpMethod": [ "Put" ],
|
||||
"QoSOptions": {
|
||||
"ExceptionsAllowedBeforeBreaking": 3,
|
||||
"DurationOfBreak": 10,
|
||||
"TimeoutValue": 5000
|
||||
}
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/posts/{postId}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "jsonplaceholder.typicode.com",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/posts/{postId}",
|
||||
"UpstreamHttpMethod": [ "Patch" ],
|
||||
"QoSOptions": {
|
||||
"ExceptionsAllowedBeforeBreaking": 3,
|
||||
"DurationOfBreak": 10,
|
||||
"TimeoutValue": 5000
|
||||
}
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/posts/{postId}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "jsonplaceholder.typicode.com",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/posts/{postId}",
|
||||
"UpstreamHttpMethod": [ "Delete" ],
|
||||
"QoSOptions": {
|
||||
"ExceptionsAllowedBeforeBreaking": 3,
|
||||
"DurationOfBreak": 10,
|
||||
"TimeoutValue": 5000
|
||||
}
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/products",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "jsonplaceholder.typicode.com",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/products",
|
||||
"UpstreamHttpMethod": [ "Get" ],
|
||||
"QoSOptions": {
|
||||
"ExceptionsAllowedBeforeBreaking": 3,
|
||||
"DurationOfBreak": 10,
|
||||
"TimeoutValue": 5000
|
||||
},
|
||||
"FileCacheOptions": { "TtlSeconds": 15 }
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/products/{productId}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "jsonplaceholder.typicode.com",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/products/{productId}",
|
||||
"UpstreamHttpMethod": [ "Get" ],
|
||||
"FileCacheOptions": { "TtlSeconds": 15 }
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/products",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "jsonplaceholder.typicode.com",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/products",
|
||||
"UpstreamHttpMethod": [ "Post" ],
|
||||
"QoSOptions": {
|
||||
"ExceptionsAllowedBeforeBreaking": 3,
|
||||
"DurationOfBreak": 10,
|
||||
"TimeoutValue": 5000
|
||||
}
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/products/{productId}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "jsonplaceholder.typicode.com",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/products/{productId}",
|
||||
"UpstreamHttpMethod": [ "Put" ],
|
||||
"QoSOptions": {
|
||||
"ExceptionsAllowedBeforeBreaking": 3,
|
||||
"DurationOfBreak": 10,
|
||||
"TimeoutValue": 5000
|
||||
},
|
||||
"FileCacheOptions": { "TtlSeconds": 15 }
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/posts",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "jsonplaceholder.typicode.com",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/posts/",
|
||||
"UpstreamHttpMethod": [ "Get" ],
|
||||
"QoSOptions": {
|
||||
"ExceptionsAllowedBeforeBreaking": 3,
|
||||
"DurationOfBreak": 10,
|
||||
"TimeoutValue": 5000
|
||||
},
|
||||
"FileCacheOptions": { "TtlSeconds": 15 }
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "www.bbc.co.uk",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/bbc/",
|
||||
"UpstreamHttpMethod": [ "Get" ]
|
||||
"QoSOptions": {
|
||||
"ExceptionsAllowedBeforeBreaking": 3,
|
||||
"DurationOfBreak": 10,
|
||||
"TimeoutValue": 5000
|
||||
}
|
||||
],
|
||||
|
||||
"GlobalConfiguration": {
|
||||
"RequestIdKey": "ot-traceid"
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/posts/{postId}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "jsonplaceholder.typicode.com",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/posts/{postId}",
|
||||
"UpstreamHttpMethod": [ "Get" ],
|
||||
"RequestIdKey": "ReRouteRequestId",
|
||||
"HttpHandlerOptions": {
|
||||
"AllowAutoRedirect": true,
|
||||
"UseCookieContainer": true,
|
||||
"UseTracing": true,
|
||||
"UseProxy": true
|
||||
},
|
||||
"QoSOptions": {
|
||||
"ExceptionsAllowedBeforeBreaking": 3,
|
||||
"DurationOfBreak": 10,
|
||||
"TimeoutValue": 5000
|
||||
}
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/posts/{postId}/comments",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "jsonplaceholder.typicode.com",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/posts/{postId}/comments",
|
||||
"UpstreamHttpMethod": [ "Get" ],
|
||||
"HttpHandlerOptions": {
|
||||
"AllowAutoRedirect": true,
|
||||
"UseCookieContainer": true,
|
||||
"UseTracing": false
|
||||
},
|
||||
"QoSOptions": {
|
||||
"ExceptionsAllowedBeforeBreaking": 3,
|
||||
"DurationOfBreak": 10,
|
||||
"TimeoutValue": 5000
|
||||
}
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/comments",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "jsonplaceholder.typicode.com",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/comments",
|
||||
"UpstreamHttpMethod": [ "Get" ],
|
||||
"QoSOptions": {
|
||||
"ExceptionsAllowedBeforeBreaking": 3,
|
||||
"DurationOfBreak": 10,
|
||||
"TimeoutValue": 5000
|
||||
}
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/posts",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "jsonplaceholder.typicode.com",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/posts",
|
||||
"UpstreamHttpMethod": [ "Post" ],
|
||||
"QoSOptions": {
|
||||
"ExceptionsAllowedBeforeBreaking": 3,
|
||||
"DurationOfBreak": 10,
|
||||
"TimeoutValue": 5000
|
||||
}
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/posts/{postId}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "jsonplaceholder.typicode.com",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/posts/{postId}",
|
||||
"UpstreamHttpMethod": [ "Put" ],
|
||||
"QoSOptions": {
|
||||
"ExceptionsAllowedBeforeBreaking": 3,
|
||||
"DurationOfBreak": 10,
|
||||
"TimeoutValue": 5000
|
||||
}
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/posts/{postId}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "jsonplaceholder.typicode.com",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/posts/{postId}",
|
||||
"UpstreamHttpMethod": [ "Patch" ],
|
||||
"QoSOptions": {
|
||||
"ExceptionsAllowedBeforeBreaking": 3,
|
||||
"DurationOfBreak": 10,
|
||||
"TimeoutValue": 5000
|
||||
}
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/posts/{postId}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "jsonplaceholder.typicode.com",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/posts/{postId}",
|
||||
"UpstreamHttpMethod": [ "Delete" ],
|
||||
"QoSOptions": {
|
||||
"ExceptionsAllowedBeforeBreaking": 3,
|
||||
"DurationOfBreak": 10,
|
||||
"TimeoutValue": 5000
|
||||
}
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/products",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "jsonplaceholder.typicode.com",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/products",
|
||||
"UpstreamHttpMethod": [ "Get" ],
|
||||
"QoSOptions": {
|
||||
"ExceptionsAllowedBeforeBreaking": 3,
|
||||
"DurationOfBreak": 10,
|
||||
"TimeoutValue": 5000
|
||||
},
|
||||
"FileCacheOptions": { "TtlSeconds": 15 }
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/products/{productId}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "jsonplaceholder.typicode.com",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/products/{productId}",
|
||||
"UpstreamHttpMethod": [ "Get" ],
|
||||
"FileCacheOptions": { "TtlSeconds": 15 }
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/products",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "jsonplaceholder.typicode.com",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/products",
|
||||
"UpstreamHttpMethod": [ "Post" ],
|
||||
"QoSOptions": {
|
||||
"ExceptionsAllowedBeforeBreaking": 3,
|
||||
"DurationOfBreak": 10,
|
||||
"TimeoutValue": 5000
|
||||
}
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/api/products/{productId}",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "jsonplaceholder.typicode.com",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/products/{productId}",
|
||||
"UpstreamHttpMethod": [ "Put" ],
|
||||
"QoSOptions": {
|
||||
"ExceptionsAllowedBeforeBreaking": 3,
|
||||
"DurationOfBreak": 10,
|
||||
"TimeoutValue": 5000
|
||||
},
|
||||
"FileCacheOptions": { "TtlSeconds": 15 }
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/posts",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "jsonplaceholder.typicode.com",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/posts/",
|
||||
"UpstreamHttpMethod": [ "Get" ],
|
||||
"QoSOptions": {
|
||||
"ExceptionsAllowedBeforeBreaking": 3,
|
||||
"DurationOfBreak": 10,
|
||||
"TimeoutValue": 5000
|
||||
},
|
||||
"FileCacheOptions": { "TtlSeconds": 15 }
|
||||
},
|
||||
{
|
||||
"DownstreamPathTemplate": "/",
|
||||
"DownstreamScheme": "http",
|
||||
"DownstreamHostAndPorts": [
|
||||
{
|
||||
"Host": "www.bbc.co.uk",
|
||||
"Port": 80
|
||||
}
|
||||
],
|
||||
"UpstreamPathTemplate": "/bbc/",
|
||||
"UpstreamHttpMethod": [ "Get" ]
|
||||
}
|
||||
],
|
||||
|
||||
"GlobalConfiguration": {
|
||||
"RequestIdKey": "ot-traceid"
|
||||
}
|
||||
}
|
||||
|
@ -7,8 +7,8 @@
|
||||
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
|
||||
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
</configuration>
|
||||
|
@ -1,7 +1,5 @@
|
||||
namespace Ocelot.UnitTests.Administration
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using IdentityServer4.AccessTokenValidation;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Hosting.Internal;
|
||||
@ -10,6 +8,8 @@ namespace Ocelot.UnitTests.Administration
|
||||
using Ocelot.Administration;
|
||||
using Ocelot.DependencyInjection;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -33,7 +33,7 @@ namespace Ocelot.UnitTests.Administration
|
||||
[Fact]
|
||||
public void should_set_up_administration_with_identity_server_options()
|
||||
{
|
||||
Action<IdentityServerAuthenticationOptions> options = o => {};
|
||||
Action<IdentityServerAuthenticationOptions> options = o => { };
|
||||
|
||||
this.Given(x => WhenISetUpOcelotServices())
|
||||
.When(x => WhenISetUpAdministration(options))
|
||||
@ -88,4 +88,3 @@ namespace Ocelot.UnitTests.Administration
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,20 +4,20 @@
|
||||
|
||||
namespace Ocelot.UnitTests.Authentication
|
||||
{
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using Ocelot.Authentication.Middleware;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Configuration.Builder;
|
||||
using Ocelot.Logging;
|
||||
using Ocelot.Middleware;
|
||||
using Shouldly;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using Ocelot.Authentication.Middleware;
|
||||
using Ocelot.Configuration.Builder;
|
||||
using Ocelot.Logging;
|
||||
using Shouldly;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Middleware;
|
||||
|
||||
public class AuthenticationMiddlewareTests
|
||||
{
|
||||
@ -62,7 +62,8 @@ namespace Ocelot.UnitTests.Authentication
|
||||
|
||||
private void WhenICallTheMiddleware()
|
||||
{
|
||||
_next = (context) => {
|
||||
_next = (context) =>
|
||||
{
|
||||
byte[] byteArray = Encoding.ASCII.GetBytes("The user is authenticated");
|
||||
var stream = new MemoryStream(byteArray);
|
||||
context.HttpContext.Response.Body = stream;
|
||||
@ -74,7 +75,8 @@ namespace Ocelot.UnitTests.Authentication
|
||||
|
||||
private void GivenTheTestServerPipelineIsConfigured()
|
||||
{
|
||||
_next = (context) => {
|
||||
_next = (context) =>
|
||||
{
|
||||
byte[] byteArray = Encoding.ASCII.GetBytes("The user is authenticated");
|
||||
var stream = new MemoryStream(byteArray);
|
||||
context.HttpContext.Response.Body = stream;
|
||||
|
@ -2,21 +2,20 @@
|
||||
|
||||
namespace Ocelot.UnitTests.Authorization
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using Ocelot.Authorisation;
|
||||
using Ocelot.Authorisation.Middleware;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Configuration.Builder;
|
||||
using Ocelot.DownstreamRouteFinder.UrlMatcher;
|
||||
using Ocelot.Logging;
|
||||
using Ocelot.Responses;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Configuration;
|
||||
using Values;
|
||||
|
||||
public class AuthorisationMiddlewareTests
|
||||
{
|
||||
@ -43,7 +42,7 @@ namespace Ocelot.UnitTests.Authorization
|
||||
[Fact]
|
||||
public void should_call_authorisation_service()
|
||||
{
|
||||
this.Given(x => x.GivenTheDownStreamRouteIs(new List<PlaceholderNameAndValue>(),
|
||||
this.Given(x => x.GivenTheDownStreamRouteIs(new List<PlaceholderNameAndValue>(),
|
||||
new DownstreamReRouteBuilder()
|
||||
.WithUpstreamPathTemplate(new UpstreamPathTemplateBuilder().Build())
|
||||
.WithIsAuthorised(true)
|
||||
@ -86,4 +85,4 @@ namespace Ocelot.UnitTests.Authorization
|
||||
, Times.Once);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Claims;
|
||||
using Ocelot.Authorisation;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Authorisation;
|
||||
using Ocelot.DownstreamRouteFinder.UrlMatcher;
|
||||
using Ocelot.Responses;
|
||||
using Ocelot.Values;
|
||||
|
||||
using Shouldly;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Claims;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -143,4 +140,4 @@ namespace Ocelot.UnitTests.Authorization
|
||||
_result.Data.ShouldBe(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,31 +1,37 @@
|
||||
using System.Net.Http;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Cache;
|
||||
using Ocelot.Middleware;
|
||||
using Shouldly;
|
||||
using System.Net.Http;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
namespace Ocelot.UnitTests.Cache {
|
||||
public class CacheKeyGeneratorTests {
|
||||
namespace Ocelot.UnitTests.Cache
|
||||
{
|
||||
public class CacheKeyGeneratorTests
|
||||
{
|
||||
private readonly ICacheKeyGenerator _cacheKeyGenerator;
|
||||
private readonly DownstreamContext _downstreamContext;
|
||||
|
||||
public CacheKeyGeneratorTests() {
|
||||
public CacheKeyGeneratorTests()
|
||||
{
|
||||
_cacheKeyGenerator = new CacheKeyGenerator();
|
||||
_cacheKeyGenerator = new CacheKeyGenerator();
|
||||
_downstreamContext = new DownstreamContext(new DefaultHttpContext()) {
|
||||
_downstreamContext = new DownstreamContext(new DefaultHttpContext())
|
||||
{
|
||||
DownstreamRequest = new Ocelot.Request.Middleware.DownstreamRequest(new HttpRequestMessage(HttpMethod.Get, "https://some.url/blah?abcd=123"))
|
||||
};
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void should_generate_cache_key_from_context() {
|
||||
public void should_generate_cache_key_from_context()
|
||||
{
|
||||
this.Given(x => x.GivenCacheKeyFromContext(_downstreamContext))
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
private void GivenCacheKeyFromContext(DownstreamContext context) {
|
||||
private void GivenCacheKeyFromContext(DownstreamContext context)
|
||||
{
|
||||
string generatedCacheKey = _cacheKeyGenerator.GenerateRequestCacheKey(context);
|
||||
string cachekey = MD5Helper.GenerateMd5("GET-https://some.url/blah?abcd=123");
|
||||
generatedCacheKey.ShouldBe(cachekey);
|
||||
|
@ -1,9 +1,9 @@
|
||||
namespace Ocelot.UnitTests.Cache
|
||||
{
|
||||
using System;
|
||||
using System.Threading;
|
||||
using Ocelot.Cache;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using Xunit;
|
||||
|
||||
public class InMemoryCacheTests
|
||||
@ -68,7 +68,7 @@
|
||||
result.ShouldBeNull();
|
||||
}
|
||||
|
||||
class Fake
|
||||
private class Fake
|
||||
{
|
||||
public Fake(int value)
|
||||
{
|
||||
|
@ -1,9 +1,5 @@
|
||||
namespace Ocelot.UnitTests.Cache
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using Ocelot.Cache;
|
||||
@ -13,15 +9,18 @@
|
||||
using Ocelot.DownstreamRouteFinder;
|
||||
using Ocelot.DownstreamRouteFinder.UrlMatcher;
|
||||
using Ocelot.Logging;
|
||||
using Ocelot.Middleware;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
using System.Net;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Ocelot.Middleware;
|
||||
|
||||
public class OutputCacheMiddlewareTests
|
||||
{
|
||||
private readonly Mock<IOcelotCache<CachedResponse>> _cache;
|
||||
private readonly Mock<IOcelotCache<CachedResponse>> _cache;
|
||||
private readonly Mock<IOcelotLoggerFactory> _loggerFactory;
|
||||
private Mock<IOcelotLogger> _logger;
|
||||
private OutputCacheMiddleware _middleware;
|
||||
@ -119,7 +118,7 @@
|
||||
.Build())
|
||||
.WithUpstreamHttpMethod(new List<string> { "Get" })
|
||||
.Build();
|
||||
|
||||
|
||||
var downstreamRoute = new DownstreamRoute(new List<PlaceholderNameAndValue>(), reRoute);
|
||||
|
||||
_downstreamContext.TemplatePlaceholderNameAndValues = downstreamRoute.TemplatePlaceholderNameAndValues;
|
||||
|
@ -1,9 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Ocelot.Cache;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Configuration.Builder;
|
||||
using Ocelot.Configuration.File;
|
||||
using Shouldly;
|
||||
using System.Collections.Generic;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -44,15 +42,15 @@ namespace Ocelot.UnitTests.Cache
|
||||
.When(_ => WhenICreateTheRegion())
|
||||
.Then(_ => ThenTheRegionIs("region"))
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void GivenTheReRoute(FileReRoute reRoute)
|
||||
{
|
||||
_reRoute = reRoute;
|
||||
}
|
||||
|
||||
private void WhenICreateTheRegion()
|
||||
{
|
||||
{
|
||||
RegionCreator regionCreator = new RegionCreator();
|
||||
_result = regionCreator.Create(_reRoute);
|
||||
}
|
||||
@ -62,4 +60,4 @@ namespace Ocelot.UnitTests.Cache
|
||||
_result.ShouldBe(expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,5 @@
|
||||
namespace Ocelot.UnitTests.CacheManager
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using global::CacheManager.Core;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Hosting.Internal;
|
||||
@ -14,6 +11,9 @@
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.DependencyInjection;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -79,7 +79,8 @@
|
||||
{
|
||||
try
|
||||
{
|
||||
_ocelotBuilder.AddCacheManager(x => {
|
||||
_ocelotBuilder.AddCacheManager(x =>
|
||||
{
|
||||
x.WithMaxRetries(_maxRetries);
|
||||
x.WithDictionaryHandle();
|
||||
});
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace Ocelot.UnitTests.CacheManager
|
||||
{
|
||||
using System;
|
||||
using global::CacheManager.Core;
|
||||
using Moq;
|
||||
using Ocelot.Cache.CacheManager;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
|
@ -1,11 +1,5 @@
|
||||
namespace Ocelot.UnitTests.CacheManager
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
using global::CacheManager.Core;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
@ -17,6 +11,12 @@
|
||||
using Ocelot.Logging;
|
||||
using Ocelot.Middleware;
|
||||
using Shouldly;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -52,7 +52,7 @@
|
||||
{
|
||||
var content = new StringContent("{\"Test\": 1}")
|
||||
{
|
||||
Headers = { ContentType = new MediaTypeHeaderValue("application/json")}
|
||||
Headers = { ContentType = new MediaTypeHeaderValue("application/json") }
|
||||
};
|
||||
|
||||
var response = new DownstreamResponse(content, HttpStatusCode.OK, new List<KeyValuePair<string, IEnumerable<string>>>(), "fooreason");
|
||||
|
@ -1,6 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using Ocelot.Claims;
|
||||
using Ocelot.Configuration;
|
||||
@ -8,6 +6,8 @@ using Ocelot.Errors;
|
||||
using Ocelot.Infrastructure.Claims.Parser;
|
||||
using Ocelot.Responses;
|
||||
using Shouldly;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Claims;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -131,7 +131,7 @@ namespace Ocelot.UnitTests.Claims
|
||||
_result.IsError.ShouldBe(true);
|
||||
}
|
||||
|
||||
class AnyError : Error
|
||||
private class AnyError : Error
|
||||
{
|
||||
public AnyError()
|
||||
: base("blahh", OcelotErrorCode.UnknownError)
|
||||
@ -139,4 +139,4 @@ namespace Ocelot.UnitTests.Claims
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,6 @@
|
||||
|
||||
namespace Ocelot.UnitTests.Claims
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Moq;
|
||||
using Ocelot.Claims;
|
||||
@ -14,6 +12,8 @@ namespace Ocelot.UnitTests.Claims
|
||||
using Ocelot.DownstreamRouteFinder.UrlMatcher;
|
||||
using Ocelot.Logging;
|
||||
using Ocelot.Responses;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using Moq;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Configuration.Builder;
|
||||
using Ocelot.Configuration.Creator;
|
||||
using Ocelot.Configuration.File;
|
||||
using Values;
|
||||
using Shouldly;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using TestStack.BDDfy;
|
||||
using Values;
|
||||
using Xunit;
|
||||
|
||||
public class AggregatesCreatorTests
|
||||
@ -112,13 +112,13 @@ namespace Ocelot.UnitTests.Configuration
|
||||
_result[1].UpstreamTemplatePattern.ShouldBe(_aggregate2Utp);
|
||||
_result[1].Aggregator.ShouldBe(_fileConfiguration.Aggregates[1].Aggregator);
|
||||
_result[1].DownstreamReRoute.ShouldContain(x => x == _reRoutes[2].DownstreamReRoute[0]);
|
||||
_result[1].DownstreamReRoute.ShouldContain(x => x == _reRoutes[3].DownstreamReRoute[0]);
|
||||
_result[1].DownstreamReRoute.ShouldContain(x => x == _reRoutes[3].DownstreamReRoute[0]);
|
||||
}
|
||||
|
||||
private void ThenTheUtpCreatorIsCalledCorrectly()
|
||||
{
|
||||
_utpCreator.Verify(x => x.Create(_fileConfiguration.Aggregates[0]), Times.Once);
|
||||
_utpCreator.Verify(x => x.Create(_fileConfiguration.Aggregates[1]), Times.Once);
|
||||
_utpCreator.Verify(x => x.Create(_fileConfiguration.Aggregates[1]), Times.Once);
|
||||
}
|
||||
|
||||
private void GivenTheUtpCreatorReturns()
|
||||
|
@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Configuration.Builder;
|
||||
using Ocelot.Configuration.Creator;
|
||||
using Ocelot.Configuration.File;
|
||||
using Shouldly;
|
||||
using System.Collections.Generic;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -54,9 +54,9 @@ namespace Ocelot.UnitTests.Configuration
|
||||
}
|
||||
|
||||
private void ThenTheFollowingConfigIsReturned(AuthenticationOptions expected)
|
||||
{
|
||||
_result.AllowedScopes.ShouldBe(expected.AllowedScopes);
|
||||
{
|
||||
_result.AllowedScopes.ShouldBe(expected.AllowedScopes);
|
||||
_result.AuthenticationProviderKey.ShouldBe(expected.AuthenticationProviderKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Configuration.Parser;
|
||||
using Ocelot.Errors;
|
||||
using Ocelot.Responses;
|
||||
using Shouldly;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -114,4 +114,4 @@ namespace Ocelot.UnitTests.Configuration
|
||||
_dictionary = dictionary;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Moq;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Configuration.Creator;
|
||||
@ -8,6 +6,8 @@ using Ocelot.Errors;
|
||||
using Ocelot.Logging;
|
||||
using Ocelot.Responses;
|
||||
using Shouldly;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -16,7 +16,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
public class ClaimsToThingCreatorTests
|
||||
{
|
||||
private readonly Mock<IClaimToThingConfigurationParser> _configParser;
|
||||
private Dictionary<string,string> _claimsToThings;
|
||||
private Dictionary<string, string> _claimsToThings;
|
||||
private ClaimsToThingCreator _claimsToThingsCreator;
|
||||
private Mock<IOcelotLoggerFactory> _loggerFactory;
|
||||
private List<ClaimToThing> _result;
|
||||
@ -36,13 +36,13 @@ namespace Ocelot.UnitTests.Configuration
|
||||
[Fact]
|
||||
public void should_return_claims_to_things()
|
||||
{
|
||||
var userInput = new Dictionary<string,string>()
|
||||
var userInput = new Dictionary<string, string>()
|
||||
{
|
||||
{"CustomerId", "Claims[CustomerId] > value"}
|
||||
};
|
||||
|
||||
var claimsToThing = new OkResponse<ClaimToThing>(new ClaimToThing("CustomerId", "CustomerId", "", 0));
|
||||
|
||||
var claimsToThing = new OkResponse<ClaimToThing>(new ClaimToThing("CustomerId", "CustomerId", "", 0));
|
||||
|
||||
this.Given(x => x.GivenTheFollowingDictionary(userInput))
|
||||
.And(x => x.GivenTheConfigHeaderExtractorReturns(claimsToThing))
|
||||
.When(x => x.WhenIGetTheThings())
|
||||
@ -53,14 +53,14 @@ namespace Ocelot.UnitTests.Configuration
|
||||
|
||||
[Fact]
|
||||
public void should_log_error_if_cannot_parse_claim_to_thing()
|
||||
{
|
||||
var userInput = new Dictionary<string,string>()
|
||||
{
|
||||
var userInput = new Dictionary<string, string>()
|
||||
{
|
||||
{"CustomerId", "Claims[CustomerId] > value"}
|
||||
};
|
||||
|
||||
var claimsToThing = new ErrorResponse<ClaimToThing>(It.IsAny<Error>());
|
||||
|
||||
var claimsToThing = new ErrorResponse<ClaimToThing>(It.IsAny<Error>());
|
||||
|
||||
this.Given(x => x.GivenTheFollowingDictionary(userInput))
|
||||
.And(x => x.GivenTheConfigHeaderExtractorReturns(claimsToThing))
|
||||
.When(x => x.WhenIGetTheThings())
|
||||
@ -80,7 +80,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
_result.Count.ShouldBeGreaterThan(0);
|
||||
}
|
||||
|
||||
private void GivenTheFollowingDictionary(Dictionary<string,string> claimsToThings)
|
||||
private void GivenTheFollowingDictionary(Dictionary<string, string> claimsToThings)
|
||||
{
|
||||
_claimsToThings = claimsToThings;
|
||||
}
|
||||
@ -108,4 +108,4 @@ namespace Ocelot.UnitTests.Configuration
|
||||
.Verify(x => x.Extract(_claimsToThings.First().Key, _claimsToThings.First().Value), Times.Once);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Moq;
|
||||
using Ocelot.Configuration;
|
||||
@ -8,6 +7,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.DependencyInjection;
|
||||
using Shouldly;
|
||||
using System.Collections.Generic;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
|
@ -1,17 +1,17 @@
|
||||
namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Moq;
|
||||
using Newtonsoft.Json;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.Configuration.Repository;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Moq;
|
||||
using Ocelot.Configuration.File;
|
||||
using Shouldly;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
using Newtonsoft.Json;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Ocelot.Configuration.Repository;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
public class DiskFileConfigurationRepositoryTests : IDisposable
|
||||
{
|
||||
@ -26,6 +26,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
// cant pick it up if they run in parralel..and the semaphore stops them running at the same time...sigh
|
||||
// these are not really unit tests but whatever...
|
||||
private string _environmentName = "DEV.DEV";
|
||||
|
||||
private static SemaphoreSlim _semaphore;
|
||||
|
||||
public DiskFileConfigurationRepositoryTests()
|
||||
@ -102,7 +103,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
|
||||
private void GivenTheUserAddedOcelotJson()
|
||||
{
|
||||
_ocelotJsonPath = $"{AppContext.BaseDirectory}/ocelot.json";
|
||||
_ocelotJsonPath = $"{AppContext.BaseDirectory}/ocelot.json";
|
||||
|
||||
if (File.Exists(_ocelotJsonPath))
|
||||
{
|
||||
@ -136,7 +137,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
_result.GlobalConfiguration.ServiceDiscoveryProvider.Host.ShouldBe(expecteds.GlobalConfiguration.ServiceDiscoveryProvider.Host);
|
||||
_result.GlobalConfiguration.ServiceDiscoveryProvider.Port.ShouldBe(expecteds.GlobalConfiguration.ServiceDiscoveryProvider.Port);
|
||||
|
||||
for(var i = 0; i < _result.ReRoutes.Count; i++)
|
||||
for (var i = 0; i < _result.ReRoutes.Count; i++)
|
||||
{
|
||||
for (int j = 0; j < _result.ReRoutes[i].DownstreamHostAndPorts.Count; j++)
|
||||
{
|
||||
@ -176,7 +177,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
private void ThenTheConfigurationJsonIsIndented(FileConfiguration expecteds)
|
||||
{
|
||||
var path = !string.IsNullOrEmpty(_environmentSpecificPath) ? _environmentSpecificPath : _environmentSpecificPath = $"{AppContext.BaseDirectory}/ocelot{(string.IsNullOrEmpty(_environmentName) ? string.Empty : ".")}{_environmentName}.json";
|
||||
|
||||
|
||||
var resultText = File.ReadAllText(path);
|
||||
var expectedText = JsonConvert.SerializeObject(expecteds, Formatting.Indented);
|
||||
resultText.ShouldBe(expectedText);
|
||||
@ -193,7 +194,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
_result.GlobalConfiguration.ServiceDiscoveryProvider.Host.ShouldBe(expecteds.GlobalConfiguration.ServiceDiscoveryProvider.Host);
|
||||
_result.GlobalConfiguration.ServiceDiscoveryProvider.Port.ShouldBe(expecteds.GlobalConfiguration.ServiceDiscoveryProvider.Port);
|
||||
|
||||
for(var i = 0; i < _result.ReRoutes.Count; i++)
|
||||
for (var i = 0; i < _result.ReRoutes.Count; i++)
|
||||
{
|
||||
for (int j = 0; j < _result.ReRoutes[i].DownstreamHostAndPorts.Count; j++)
|
||||
{
|
||||
|
@ -1,9 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Configuration.Builder;
|
||||
using Ocelot.Configuration.Creator;
|
||||
using Ocelot.Configuration.File;
|
||||
using Shouldly;
|
||||
using System.Collections.Generic;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -47,7 +46,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
new FileHostAndPort
|
||||
{
|
||||
Host = "test",
|
||||
Port = 80
|
||||
Port = 80
|
||||
}
|
||||
},
|
||||
};
|
||||
@ -87,8 +86,8 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
new DownstreamHostAndPort("test", 80),
|
||||
new DownstreamHostAndPort("west", 443)
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
this.Given(x => GivenTheFollowingReRoute(reRoute))
|
||||
.When(x => WhenICreate())
|
||||
.Then(x => TheThenFollowingIsReturned(expected))
|
||||
@ -119,4 +118,4 @@ namespace Ocelot.UnitTests.Configuration
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using Moq;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Configuration.Builder;
|
||||
using Ocelot.Configuration.Creator;
|
||||
using Ocelot.Configuration.File;
|
||||
using Shouldly;
|
||||
using System.Collections.Generic;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
|
@ -1,19 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using Moq;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Configuration.Creator;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.Configuration.Repository;
|
||||
using Ocelot.Configuration.Setter;
|
||||
using Ocelot.Logging;
|
||||
using Ocelot.Responses;
|
||||
using Ocelot.UnitTests.Responder;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
using Shouldly;
|
||||
using static Ocelot.Infrastructure.Wait;
|
||||
using Ocelot.Configuration.Creator;
|
||||
using Ocelot.Configuration;
|
||||
|
||||
namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
@ -44,20 +43,21 @@ namespace Ocelot.UnitTests.Configuration
|
||||
_poller = new FileConfigurationPoller(_factory.Object, _repo.Object, _config.Object, _internalConfigRepo.Object, _internalConfigCreator.Object);
|
||||
_poller.StartAsync(new CancellationToken());
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void should_start()
|
||||
{
|
||||
this.Given(x => ThenTheSetterIsCalled(_fileConfig, 1))
|
||||
.BDDfy();
|
||||
this.Given(x => ThenTheSetterIsCalled(_fileConfig, 1))
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void should_call_setter_when_gets_new_config()
|
||||
{
|
||||
var newConfig = new FileConfiguration {
|
||||
var newConfig = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
{
|
||||
{
|
||||
new FileReRoute
|
||||
{
|
||||
DownstreamHostAndPorts = new List<FileHostAndPort>
|
||||
@ -143,14 +143,15 @@ namespace Ocelot.UnitTests.Configuration
|
||||
|
||||
private void ThenTheSetterIsCalled(FileConfiguration fileConfig, int times)
|
||||
{
|
||||
var result = WaitFor(4000).Until(() => {
|
||||
var result = WaitFor(4000).Until(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
_internalConfigRepo.Verify(x => x.AddOrReplace(_internalConfig), Times.Exactly(times));
|
||||
_internalConfigCreator.Verify(x => x.Create(fileConfig), Times.Exactly(times));
|
||||
return true;
|
||||
}
|
||||
catch(Exception)
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -160,14 +161,15 @@ namespace Ocelot.UnitTests.Configuration
|
||||
|
||||
private void ThenTheSetterIsCalledAtLeast(FileConfiguration fileConfig, int times)
|
||||
{
|
||||
var result = WaitFor(4000).Until(() => {
|
||||
var result = WaitFor(4000).Until(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
_internalConfigRepo.Verify(x => x.AddOrReplace(_internalConfig), Times.AtLeast(times));
|
||||
_internalConfigCreator.Verify(x => x.Create(fileConfig), Times.AtLeast(times));
|
||||
return true;
|
||||
}
|
||||
catch(Exception)
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Moq;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Configuration.Builder;
|
||||
@ -10,6 +8,7 @@ using Ocelot.Configuration.Setter;
|
||||
using Ocelot.Errors;
|
||||
using Ocelot.Responses;
|
||||
using Shouldly;
|
||||
using System.Collections.Generic;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -22,7 +21,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
private Mock<IInternalConfigurationRepository> _configRepo;
|
||||
private Mock<IInternalConfigurationCreator> _configCreator;
|
||||
private Response<IInternalConfiguration> _configuration;
|
||||
private object _result;
|
||||
private object _result;
|
||||
private Mock<IFileConfigurationRepository> _repo;
|
||||
|
||||
public FileConfigurationSetterTests()
|
||||
@ -109,4 +108,4 @@ namespace Ocelot.UnitTests.Configuration
|
||||
.Verify(x => x.AddOrReplace(_configuration.Data), Times.Once);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,20 @@
|
||||
namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using Moq;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Configuration.Builder;
|
||||
using Ocelot.Configuration.Creator;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.Configuration.Validator;
|
||||
using Ocelot.Errors;
|
||||
using Ocelot.Responses;
|
||||
using Ocelot.UnitTests.Responder;
|
||||
using Shouldly;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
using Ocelot.Errors;
|
||||
using System.Threading.Tasks;
|
||||
using Ocelot.UnitTests.Responder;
|
||||
using System.Linq;
|
||||
|
||||
public class FileInternalConfigurationCreatorTests
|
||||
{
|
||||
|
@ -1,7 +1,6 @@
|
||||
using Microsoft.AspNetCore.Cryptography.KeyDerivation;
|
||||
using System;
|
||||
using System.Security.Cryptography;
|
||||
using Microsoft.AspNetCore.Cryptography.KeyDerivation;
|
||||
using Shouldly;
|
||||
using Xunit;
|
||||
|
||||
namespace Ocelot.UnitTests.Configuration
|
||||
@ -20,8 +19,8 @@ namespace Ocelot.UnitTests.Configuration
|
||||
rng.GetBytes(salt);
|
||||
}
|
||||
|
||||
var storedSalt = Convert.ToBase64String(salt);
|
||||
|
||||
var storedSalt = Convert.ToBase64String(salt);
|
||||
|
||||
var storedHash = Convert.ToBase64String(KeyDerivation.Pbkdf2(
|
||||
password: password,
|
||||
salt: salt,
|
||||
@ -30,4 +29,4 @@ namespace Ocelot.UnitTests.Configuration
|
||||
numBytesRequested: 256 / 8));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Moq;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Configuration.Builder;
|
||||
using Ocelot.Configuration.Creator;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.Infrastructure;
|
||||
using Ocelot.Logging;
|
||||
using Ocelot.Middleware;
|
||||
using Ocelot.Responses;
|
||||
using Ocelot.UnitTests.Responder;
|
||||
using Shouldly;
|
||||
using System.Collections.Generic;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -43,8 +40,8 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
{"Test", "Test, Chicken"},
|
||||
{"Moop", "o, a"}
|
||||
},
|
||||
DownstreamHeaderTransform = new Dictionary<string, string>
|
||||
},
|
||||
DownstreamHeaderTransform = new Dictionary<string, string>
|
||||
{
|
||||
{"Pop", "West, East"},
|
||||
{"Bop", "e, r"}
|
||||
@ -96,8 +93,8 @@ namespace Ocelot.UnitTests.Configuration
|
||||
public void should_use_base_url_placeholder()
|
||||
{
|
||||
var reRoute = new FileReRoute
|
||||
{
|
||||
DownstreamHeaderTransform = new Dictionary<string, string>
|
||||
{
|
||||
DownstreamHeaderTransform = new Dictionary<string, string>
|
||||
{
|
||||
{"Location", "http://www.bbc.co.uk/, {BaseUrl}"},
|
||||
}
|
||||
@ -153,8 +150,8 @@ namespace Ocelot.UnitTests.Configuration
|
||||
public void should_use_base_url_partial_placeholder()
|
||||
{
|
||||
var reRoute = new FileReRoute
|
||||
{
|
||||
DownstreamHeaderTransform = new Dictionary<string, string>
|
||||
{
|
||||
DownstreamHeaderTransform = new Dictionary<string, string>
|
||||
{
|
||||
{"Location", "http://www.bbc.co.uk/pay, {BaseUrl}pay"},
|
||||
}
|
||||
@ -176,8 +173,8 @@ namespace Ocelot.UnitTests.Configuration
|
||||
public void should_add_trace_id_header()
|
||||
{
|
||||
var reRoute = new FileReRoute
|
||||
{
|
||||
DownstreamHeaderTransform = new Dictionary<string, string>
|
||||
{
|
||||
DownstreamHeaderTransform = new Dictionary<string, string>
|
||||
{
|
||||
{"Trace-Id", "{TraceId}"},
|
||||
}
|
||||
@ -244,8 +241,8 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
_result.AddHeadersToDownstream[0].Key.ShouldBe(addHeader.Key);
|
||||
_result.AddHeadersToDownstream[0].Value.ShouldBe(addHeader.Value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ThenTheFollowingAddHeaderToUpstreamIsReturned(AddHeader addHeader)
|
||||
{
|
||||
_result.AddHeadersToUpstream[0].Key.ShouldBe(addHeader.Key);
|
||||
@ -254,8 +251,8 @@ namespace Ocelot.UnitTests.Configuration
|
||||
|
||||
private void ThenTheFollowingDownstreamIsReturned(List<HeaderFindAndReplace> downstream)
|
||||
{
|
||||
_result.Downstream.Count.ShouldBe(downstream.Count);
|
||||
|
||||
_result.Downstream.Count.ShouldBe(downstream.Count);
|
||||
|
||||
for (int i = 0; i < _result.Downstream.Count; i++)
|
||||
{
|
||||
var result = _result.Downstream[i];
|
||||
@ -264,7 +261,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
result.Index.ShouldBe(expected.Index);
|
||||
result.Key.ShouldBe(expected.Key);
|
||||
result.Replace.ShouldBe(expected.Replace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void GivenTheReRoute(FileReRoute reRoute)
|
||||
@ -279,8 +276,8 @@ namespace Ocelot.UnitTests.Configuration
|
||||
|
||||
private void ThenTheFollowingUpstreamIsReturned(List<HeaderFindAndReplace> expecteds)
|
||||
{
|
||||
_result.Upstream.Count.ShouldBe(expecteds.Count);
|
||||
|
||||
_result.Upstream.Count.ShouldBe(expecteds.Count);
|
||||
|
||||
for (int i = 0; i < _result.Upstream.Count; i++)
|
||||
{
|
||||
var result = _result.Upstream[i];
|
||||
@ -292,4 +289,4 @@ namespace Ocelot.UnitTests.Configuration
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,19 @@
|
||||
using System;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Configuration.Creator;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.Requester;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Logging;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Ocelot.Logging;
|
||||
|
||||
public class HttpHandlerOptionsCreatorTests
|
||||
{
|
||||
@ -34,7 +33,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
[Fact]
|
||||
public void should_not_use_tracing_if_fake_tracer_registered()
|
||||
{
|
||||
var fileReRoute = new FileReRoute
|
||||
var fileReRoute = new FileReRoute
|
||||
{
|
||||
HttpHandlerOptions = new FileHttpHandlerOptions
|
||||
{
|
||||
@ -53,7 +52,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
[Fact]
|
||||
public void should_use_tracing_if_real_tracer_registered()
|
||||
{
|
||||
var fileReRoute = new FileReRoute
|
||||
var fileReRoute = new FileReRoute
|
||||
{
|
||||
HttpHandlerOptions = new FileHttpHandlerOptions
|
||||
{
|
||||
@ -165,7 +164,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
_httpHandlerOptionsCreator = new HttpHandlerOptionsCreator(_serviceProvider);
|
||||
}
|
||||
|
||||
class FakeTracer : ITracer
|
||||
private class FakeTracer : ITracer
|
||||
{
|
||||
public void Event(HttpContext httpContext, string @event)
|
||||
{
|
||||
|
@ -1,10 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Configuration.Builder;
|
||||
using Ocelot.Configuration.Repository;
|
||||
using Ocelot.Responses;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -71,7 +71,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
_result.IsError.ShouldBeFalse();
|
||||
}
|
||||
|
||||
class FakeConfig : IInternalConfiguration
|
||||
private class FakeConfig : IInternalConfiguration
|
||||
{
|
||||
private readonly string _downstreamTemplatePath;
|
||||
|
||||
@ -100,15 +100,15 @@ namespace Ocelot.UnitTests.Configuration
|
||||
}
|
||||
}
|
||||
|
||||
public string AdministrationPath {get;}
|
||||
public string AdministrationPath { get; }
|
||||
|
||||
public ServiceProviderConfiguration ServiceProviderConfiguration => throw new NotImplementedException();
|
||||
|
||||
public string RequestId {get;}
|
||||
public string RequestId { get; }
|
||||
public LoadBalancerOptions LoadBalancerOptions { get; }
|
||||
public string DownstreamScheme { get; }
|
||||
public QoSOptions QoSOptions { get; }
|
||||
public HttpHandlerOptions HttpHandlerOptions { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,8 +17,8 @@ namespace Ocelot.UnitTests.Configuration
|
||||
public QoSOptionsCreatorTests()
|
||||
{
|
||||
_creator = new QoSOptionsCreator();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void should_create_qos_options()
|
||||
{
|
||||
@ -26,7 +26,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
QoSOptions = new FileQoSOptions
|
||||
{
|
||||
ExceptionsAllowedBeforeBreaking = 1,
|
||||
ExceptionsAllowedBeforeBreaking = 1,
|
||||
DurationOfBreak = 1,
|
||||
TimeoutValue = 1
|
||||
}
|
||||
|
@ -1,12 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Configuration.Builder;
|
||||
using Ocelot.Configuration.Creator;
|
||||
using Ocelot.Configuration.File;
|
||||
using Shouldly;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Ocelot.Configuration.Creator;
|
||||
using Ocelot.Configuration.File;
|
||||
using Ocelot.LoadBalancer.LoadBalancers;
|
||||
using Shouldly;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
@ -44,7 +44,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
var reRoute = new FileReRoute
|
||||
{
|
||||
UpstreamPathTemplate = "/api/product",
|
||||
UpstreamHttpMethod = new List<string> {"GET", "POST", "PUT"},
|
||||
UpstreamHttpMethod = new List<string> { "GET", "POST", "PUT" },
|
||||
DownstreamHostAndPorts = new List<FileHostAndPort>
|
||||
{
|
||||
new FileHostAndPort
|
||||
@ -80,6 +80,5 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
_result.ShouldBe(expected);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user