Skip to content

Commit

Permalink
test: or-2582 set up elastic client
Browse files Browse the repository at this point in the history
  • Loading branch information
koenmetsu authored and Jan Lesage committed Dec 9, 2024
1 parent 66dd846 commit a54665d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private static IServiceCollection AddMappingsForVerenigingZoek(this IServiceColl
private static GetMappingResponse GetMappingFor<T>(this IServiceProvider serviceProvider) where T : class
=> serviceProvider.GetRequiredService<ElasticClient>().Indices.GetMapping<T>();

private static ElasticClient CreateElasticClient(ElasticSearchOptionsSection elasticSearchOptions, ILogger logger)
public static ElasticClient CreateElasticClient(ElasticSearchOptionsSection elasticSearchOptions, ILogger logger)
{
var settings = new ConnectionSettings(new Uri(elasticSearchOptions.Uri!))
.BasicAuthentication(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace AssociationRegistry.Test.Projections.Framework;

using Admin.Api.Infrastructure.Extensions;
using Admin.ProjectionHost.Infrastructure.Program.WebApplicationBuilder;
using Admin.ProjectionHost.Projections.Locaties;
using Admin.ProjectionHost.Projections.Search;
Expand All @@ -11,6 +12,7 @@
using Nest;
using Npgsql;
using Public.ProjectionHost.Projections.Search;
using ElasticRepository = Admin.ProjectionHost.Projections.Search.ElasticRepository;

public class ProjectionContext : IProjectionContext, IAsyncLifetime
{
Expand All @@ -30,13 +32,15 @@ public async Task InitializeAsync()
DropDatabase(Configuration);
EnsureDbExists(Configuration);

ElasticClient = ElasticSearchExtensions.CreateElasticClient(Configuration.GetElasticSearchOptionsSection(), NullLogger.Instance);

var adminStore = DocumentStore.For(
opts =>
{
ConfigureMartenExtensions.ConfigureStoreOptions(opts,
NullLogger<LocatieLookupProjection>.Instance,
NullLogger<LocatieZonderAdresMatchProjection>.Instance,
null,
new ElasticRepository(ElasticClient),
true,
NullLogger<BeheerZoekenEventsConsumer>.Instance,
new PostgreSqlOptionsSection()
Expand Down

0 comments on commit a54665d

Please sign in to comment.