Implement US-10 on-demand health insights
This commit is contained in:
1 parent
4cb6798ec9
commit
a5b269cfc3
25 files changed
+482
-4
No files matched your search
@@ -15,6 +15,7 @@ public sealed class ObservationApiFixture : IAsyncLifetime
|
||||
private readonly string databaseName = "us04_patient_" + Guid.NewGuid().ToString("N");
|
||||
private readonly string observationDatabaseName = "us04_observation_" + Guid.NewGuid().ToString("N");
|
||||
private WebApplicationFactory<ObservationService.Program>? observation;
|
||||
private WebApplicationFactory<InsightsService.Program>? insights;
|
||||
public string ObservationConnectionString { get; private set; } = "";
|
||||
private string adminConnectionString = "";
|
||||
private WebApplicationFactory<PatientProfileService.Program>? service;
|
||||
@@ -68,6 +69,7 @@ public sealed class ObservationApiFixture : IAsyncLifetime
|
||||
builder.ConfigureKestrel(options => options.Listen(IPAddress.Loopback, 0));
|
||||
builder.ConfigureAppConfiguration((_, configuration) => configuration.AddInMemoryCollection(
|
||||
new Dictionary<string, string?> { ["Services:PatientProfile:BaseUrl"] = serviceClient.BaseAddress!.ToString(),
|
||||
["Services:Insights:BaseUrl"] = "http://127.0.0.1:1/",
|
||||
["Services:Observation:BaseUrl"] = "http://127.0.0.1:1/" }));
|
||||
});
|
||||
gateway.UseKestrel(0);
|
||||
@@ -85,17 +87,33 @@ public sealed class ObservationApiFixture : IAsyncLifetime
|
||||
observation.UseKestrel(0);
|
||||
using var observationClient = observation.CreateClient();
|
||||
gateway.Services.GetRequiredService<IConfiguration>()["Services:Observation:BaseUrl"] = observationClient.BaseAddress!.ToString();
|
||||
insights = new WebApplicationFactory<InsightsService.Program>().WithWebHostBuilder(builder =>
|
||||
{
|
||||
builder.ConfigureKestrel(options => options.Listen(IPAddress.Loopback, 0));
|
||||
builder.ConfigureAppConfiguration((_, configuration) => configuration.AddInMemoryCollection(
|
||||
new Dictionary<string, string?> { ["Services:ApiGateway:BaseUrl"] = Client.BaseAddress!.ToString() }));
|
||||
});
|
||||
insights.UseKestrel(0);
|
||||
using var insightsClient = insights.CreateClient();
|
||||
gateway.Services.GetRequiredService<IConfiguration>()["Services:Insights:BaseUrl"] = insightsClient.BaseAddress!.ToString();
|
||||
}
|
||||
|
||||
public async Task RestartHostsAsync()
|
||||
{
|
||||
Client.Dispose();
|
||||
await observation!.DisposeAsync();
|
||||
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 StopObservationServiceAsync()
|
||||
{
|
||||
if (observation is not null) await observation.DisposeAsync();
|
||||
observation = null;
|
||||
}
|
||||
|
||||
public async Task StopPatientServiceAsync()
|
||||
{
|
||||
await service!.DisposeAsync();
|
||||
@@ -105,6 +123,7 @@ public sealed class ObservationApiFixture : IAsyncLifetime
|
||||
public async Task DisposeAsync()
|
||||
{
|
||||
Client?.Dispose();
|
||||
if (insights is not null) await insights.DisposeAsync();
|
||||
if (observation is not null) await observation.DisposeAsync();
|
||||
if (gateway is not null) await gateway.DisposeAsync();
|
||||
if (service is not null) await service.DisposeAsync();
|
||||
|
||||
Reference in new issue
Block a user