-
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.
* very basic http tests * Discovery service now abstract class which encapsulates the shared logic. ALl discovery services have the same patterns, the only difference is where and how they fetch and store the data. * Added correct package
- Loading branch information
Showing
11 changed files
with
150 additions
and
102 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,31 @@ | ||
@CodeHub.Api_HostAddress = http://localhost:5104 | ||
### Get list of all pipelines | ||
GET {{BaseAddress}}/resources/pipelines/ | ||
Accept: application/json | ||
|
||
> {% | ||
client.test('Can Get List Of Resource Pipelines', function () { | ||
client.assert(response.status == 200) | ||
}) | ||
%} | ||
|
||
### Get list of all pull requests | ||
GET {{BaseAddress}}/resources/pull-requests/ | ||
Accept: application/json | ||
|
||
> {% | ||
client.test('Can Get List Of Resource Pull Requests', function () { | ||
client.assert(response.status == 200) | ||
}) | ||
%} | ||
|
||
GET {{CodeHub.Api_HostAddress}}/weatherforecast/ | ||
### Get list of all repositories | ||
GET {{BaseAddress}}/resources/repositories/ | ||
Accept: application/json | ||
|
||
> {% | ||
client.test('Can Get List Of Resource Repositories', function () { | ||
client.assert(response.status == 200) | ||
}) | ||
%} | ||
|
||
### |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"dev": { | ||
"BaseAddress": "http://localhost:5104" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder"/> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions"/> | ||
</ItemGroup> | ||
</Project> |
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,40 @@ | ||
using System.Diagnostics; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace CodeHub.Shared.Services; | ||
|
||
public abstract class DiscoveryService : IDiscoveryService | ||
{ | ||
private readonly ILogger<DiscoveryService> _logger; | ||
|
||
protected DiscoveryService(ILogger<DiscoveryService> logger) | ||
{ | ||
_logger = logger; | ||
} | ||
|
||
public virtual string Platform => string.Empty; | ||
|
||
public async Task DiscoveryAsync(CancellationToken cancellationToken) | ||
{ | ||
try | ||
{ | ||
_logger.LogInformation("{Platform} Discovery Service started.", Platform); | ||
var stopWatch = new Stopwatch(); | ||
stopWatch.Start(); | ||
|
||
await StartAsync(cancellationToken); | ||
|
||
stopWatch.Stop(); | ||
var milliseconds = stopWatch.Elapsed.TotalMilliseconds; | ||
|
||
_logger.LogInformation("{Platform} Discovery Service took: {Milliseconds} ms", Platform, milliseconds); | ||
} | ||
catch (Exception exception) | ||
{ | ||
_logger.LogError(exception, $"Error occurred whilst trying to discover the latest {Platform} resources."); | ||
throw; | ||
} | ||
} | ||
|
||
protected abstract Task StartAsync(CancellationToken cancellationToken); | ||
} |
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