Implement US-12 consolidated health overview service

This commit is contained in:
Steffen committed 2026-10-05 14:36:28 +02:00
1 parent cc76c9bde4
commit 076e675c81
26 files changed
+804 -16

No files matched your search

@@ -18,6 +18,8 @@ public sealed class ObservationApiFixture : IAsyncLifetime
private readonly string observationDatabaseName = "us04_observation_" + Guid.NewGuid().ToString("N");
private WebApplicationFactory<ObservationService.Program>? observation;
private WebApplicationFactory<InsightsService.Program>? insights;
private WebApplicationFactory<HealthOverviewService.Program>? overview;
public HttpClient CreateDirectOverviewClient() => overview!.CreateClient();
public string ObservationConnectionString { get; private set; } = "";
private string adminConnectionString = "";
private WebApplicationFactory<PatientProfileService.Program>? service;
@@ -113,19 +115,44 @@ public sealed class ObservationApiFixture : IAsyncLifetime
insights.UseKestrel(0);
using var insightsClient = insights.CreateClient();
gateway.Services.GetRequiredService<IConfiguration>()["Services:Insights:BaseUrl"] = insightsClient.BaseAddress!.ToString();
overview = new WebApplicationFactory<HealthOverviewService.Program>().WithWebHostBuilder(builder =>
{
builder.UseEnvironment("Development");
builder.ConfigureKestrel(options => options.Listen(IPAddress.Loopback, 0));
builder.ConfigureAppConfiguration((_, configuration) => configuration.AddInMemoryCollection(
new Dictionary<string, string?> { ["Services:ApiGateway:BaseUrl"] = Client.BaseAddress!.ToString(),
["InternalAccess:GatewayKey"] = Authentication.GatewayKey,
["Services:ApiGateway:Key"] = Authentication.OverviewServiceKey }));
});
overview.UseKestrel(0);
using var overviewClient = overview.CreateClient();
gateway.Services.GetRequiredService<IConfiguration>()["Services:HealthOverview:BaseUrl"] = overviewClient.BaseAddress!.ToString();
}
public async Task RestartHostsAsync()
{
Client.Dispose();
RawClient.Dispose();
await insights!.DisposeAsync();
if (overview is not null) await overview.DisposeAsync();
if (insights is not null) await insights.DisposeAsync();
if (observation is not null) await observation.DisposeAsync();
await gateway!.DisposeAsync();
if (service is not null) await service.DisposeAsync();
StartHosts();
}
public async Task StopOverviewServiceAsync()
{
if (overview is not null) await overview.DisposeAsync();
overview = null;
}
public async Task StopInsightsServiceAsync()
{
if (insights is not null) await insights.DisposeAsync();
insights = null;
}
public async Task StopObservationServiceAsync()
{
if (observation is not null) await observation.DisposeAsync();
@@ -142,6 +169,7 @@ public sealed class ObservationApiFixture : IAsyncLifetime
{
Client?.Dispose();
RawClient?.Dispose();
if (overview is not null) await overview.DisposeAsync();
if (insights is not null) await insights.DisposeAsync();
if (observation is not null) await observation.DisposeAsync();
if (gateway is not null) await gateway.DisposeAsync();