-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: added support for aliases with api routes
- Loading branch information
1 parent
99c8ccc
commit deca5b6
Showing
13 changed files
with
119 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
src/Zengenti.Contensis.RequestHandler.Domain/ValueTypes/BlockClusterConfig.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
namespace Zengenti.Contensis.RequestHandler.Domain.ValueTypes; | ||
|
||
public record BlockClusterConfig(string? BlockClusterIngressIp = null, string? BlockAddressSuffix = null); | ||
public record BlockClusterConfig( | ||
string? BlockClusterIngressIp = null, | ||
string? BlockAddressSuffix = null, | ||
string[]? AliasesWithApiRoutes = null); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...ler.LocalDevelopment.Unit.Specs/Services/RouteServiceSpecs/PathIsAliasWithApiRouteCall.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using Microsoft.Extensions.Logging; | ||
using NSubstitute; | ||
using TestStack.BDDfy; | ||
using Zengenti.Contensis.RequestHandler.Application.Services; | ||
using Zengenti.Contensis.RequestHandler.Domain.Interfaces; | ||
using Zengenti.Contensis.RequestHandler.Domain.ValueTypes; | ||
|
||
namespace Zengenti.Contensis.RequestHandler.LocalDevelopment.Unit.Specs.Services.RouteServiceSpecs; | ||
|
||
public class PathIsAliasWithApiRouteCall | ||
{ | ||
private const string Host = "http://www.mysite.com"; | ||
private const string Path = "/api/delivery/website/"; | ||
private readonly Uri _originUri = new(Host + Path); | ||
private readonly Headers _headers = new(); | ||
|
||
private RouteService _sut; | ||
private INodeService _nodeService; | ||
private RouteInfo _result; | ||
|
||
public void GivenARequestPathIsAnApiCall() | ||
{ | ||
_nodeService = Substitute.For<INodeService>(); | ||
|
||
var logger = Substitute.For<ILogger<RouteService>>(); | ||
var requestContext = SpecHelper.CreateRequestContext(); | ||
var cacheKeyService = Substitute.For<ICacheKeyService>(); | ||
var blockClusterConfig = new BlockClusterConfig( | ||
AliasesWithApiRoutes: new[] | ||
{ | ||
"test" | ||
}); | ||
var routeInfoFactory = new RouteInfoFactory( | ||
requestContext, | ||
blockClusterConfig); | ||
var publishingService = SpecHelper.CreatePublishingService(routeInfoFactory); | ||
|
||
_sut = new RouteService( | ||
blockClusterConfig, | ||
_nodeService, | ||
publishingService, | ||
routeInfoFactory, | ||
requestContext, | ||
cacheKeyService, | ||
logger); | ||
} | ||
|
||
public async Task WhenTheRouteIsRequested() | ||
{ | ||
_result = await _sut.GetRouteForRequest(_originUri, _headers); | ||
} | ||
|
||
public void ThenNodeLookupIsPerformed() | ||
{ | ||
_nodeService.ReceivedWithAnyArgs().GetByPath(Path); | ||
} | ||
|
||
[Test] | ||
public void Run() | ||
{ | ||
this.BDDfy(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters