From 9cb4451e2deb8a9c9582d1bdfd64dface0dd2b46 Mon Sep 17 00:00:00 2001 From: Jesper Justesen Date: Mon, 2 Sep 2024 15:36:23 +0200 Subject: [PATCH] Implmented logging --- .../Experimental/DatabricksContextBase.cs | 6 ++++-- .../DatabricksSqlQueryExecutor.cs | 8 +++---- .../Experimental/DatabricksSqlRowHydrator.cs | 10 +++++++-- .../SettlementReportDatabricksContext.cs | 6 ++++-- ...eportFileRequestHandlerIntegrationTests.cs | 21 +++++++++++++------ ...CalculationResults.IntegrationTests.csproj | 1 + ...tReportChargeLinkPeriodsRepositoryTests.cs | 9 +++++++- ...lementReportChargePricesRepositoryTests.cs | 9 +++++++- ...lementReportEnergyResultRepositoryTests.cs | 9 +++++++- ...tMeteringPointMasterDataRepositoryTests.cs | 9 +++++++- ...ingPointTimeSeriesResultRepositoryTests.cs | 9 +++++++- ...ementReportMonthlyAmountRepositoryTests.cs | 8 ++++++- ...ReportMonthlyAmountTotalRepositoryTests.cs | 9 +++++++- ...ettlementReportWholesaleRepositoryTests.cs | 8 ++++++- 14 files changed, 97 insertions(+), 25 deletions(-) diff --git a/source/settlement-report/CalculationResults/CalculationResults.Infrastructure/Experimental/DatabricksContextBase.cs b/source/settlement-report/CalculationResults/CalculationResults.Infrastructure/Experimental/DatabricksContextBase.cs index ce47221..c28ae96 100644 --- a/source/settlement-report/CalculationResults/CalculationResults.Infrastructure/Experimental/DatabricksContextBase.cs +++ b/source/settlement-report/CalculationResults/CalculationResults.Infrastructure/Experimental/DatabricksContextBase.cs @@ -20,6 +20,7 @@ using Microsoft.EntityFrameworkCore.Query; using Microsoft.EntityFrameworkCore.Query.SqlExpressions; using Microsoft.EntityFrameworkCore.Storage; +using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; namespace Energinet.DataHub.SettlementReport.CalculationResults.Infrastructure.Experimental; @@ -31,10 +32,11 @@ public abstract class DatabricksContextBase : IDisposable protected DatabricksContextBase( DatabricksSqlWarehouseQueryExecutor databricksSqlWarehouseQueryExecutor, - IOptions options) + IOptions options, + ILoggerFactory loggerFactory) { _dbContext = new DbContextCore(OnModelCreating); - _executor = new DatabricksSqlQueryExecutor(_dbContext, databricksSqlWarehouseQueryExecutor, options); + _executor = new DatabricksSqlQueryExecutor(_dbContext, databricksSqlWarehouseQueryExecutor, options, loggerFactory); } public void Dispose() diff --git a/source/settlement-report/CalculationResults/CalculationResults.Infrastructure/Experimental/DatabricksSqlQueryExecutor.cs b/source/settlement-report/CalculationResults/CalculationResults.Infrastructure/Experimental/DatabricksSqlQueryExecutor.cs index 4c7432c..e6f54e5 100644 --- a/source/settlement-report/CalculationResults/CalculationResults.Infrastructure/Experimental/DatabricksSqlQueryExecutor.cs +++ b/source/settlement-report/CalculationResults/CalculationResults.Infrastructure/Experimental/DatabricksSqlQueryExecutor.cs @@ -25,7 +25,6 @@ namespace Energinet.DataHub.SettlementReport.CalculationResults.Infrastructure.E public sealed class DatabricksSqlQueryExecutor { private readonly DatabricksSqlWarehouseQueryExecutor _databricksSqlWarehouseQueryExecutor; - private readonly ILogger _logger; private readonly DatabricksSqlQueryBuilder _sqlQueryBuilder; private readonly DatabricksSqlRowHydrator _sqlRowHydrator; @@ -33,12 +32,11 @@ public DatabricksSqlQueryExecutor( DbContext dbContext, DatabricksSqlWarehouseQueryExecutor databricksSqlWarehouseQueryExecutor, IOptions options, - ILogger logger) + ILoggerFactory loggerFactory) { _sqlQueryBuilder = new DatabricksSqlQueryBuilder(dbContext, options); - _sqlRowHydrator = new DatabricksSqlRowHydrator(); + _sqlRowHydrator = new DatabricksSqlRowHydrator(loggerFactory); _databricksSqlWarehouseQueryExecutor = databricksSqlWarehouseQueryExecutor; - _logger = logger; } public async Task CountAsync(DatabricksSqlQueryable query, CancellationToken cancellationToken = default) @@ -66,7 +64,7 @@ internal string BuildDebugString(DatabricksSqlQueryable query) private IAsyncEnumerable ExecuteCoreAsync(DatabricksStatement databricksStatement, CancellationToken cancellationToken = default) { var rows = _databricksSqlWarehouseQueryExecutor.ExecuteStatementParallelAsync(databricksStatement, Format.ApacheArrow, cancellationToken); - return _sqlRowHydrator.HydrateAsync(rows, _logger, cancellationToken); + return _sqlRowHydrator.HydrateAsync(rows, cancellationToken); } private sealed class CountResult diff --git a/source/settlement-report/CalculationResults/CalculationResults.Infrastructure/Experimental/DatabricksSqlRowHydrator.cs b/source/settlement-report/CalculationResults/CalculationResults.Infrastructure/Experimental/DatabricksSqlRowHydrator.cs index 4d31158..954ca38 100644 --- a/source/settlement-report/CalculationResults/CalculationResults.Infrastructure/Experimental/DatabricksSqlRowHydrator.cs +++ b/source/settlement-report/CalculationResults/CalculationResults.Infrastructure/Experimental/DatabricksSqlRowHydrator.cs @@ -40,9 +40,15 @@ public sealed class DatabricksSqlRowHydrator UnmappedMemberHandling = JsonUnmappedMemberHandling.Disallow, }.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb); + private readonly ILogger _logger; + + public DatabricksSqlRowHydrator(ILoggerFactory loggerFactory) + { + _logger = loggerFactory.CreateLogger(); + } + public async IAsyncEnumerable HydrateAsync( IAsyncEnumerable rows, - ILogger logger, [EnumeratorCancellation] CancellationToken cancellationToken = default) { var propertyMap = _typeInfoCache.GetOrAdd(typeof(TElement), CreateTypeInfoCache); @@ -54,7 +60,7 @@ public async IAsyncEnumerable HydrateAsync( rowCounter++; } - logger.LogInformation("Hydration for {RowCounter} rows took: {ElapsedMilliseconds}ms", rowCounter, sw.ElapsedMilliseconds); + _logger.LogInformation("Hydration for {RowCounter} rows took: {ElapsedMilliseconds}ms", rowCounter, sw.ElapsedMilliseconds); } private TElement Hydrate(ExpandoObject expandoObject, IReadOnlyDictionary propertyMap, Stopwatch sw) diff --git a/source/settlement-report/CalculationResults/CalculationResults.Infrastructure/Persistence/Databricks/SettlementReportDatabricksContext.cs b/source/settlement-report/CalculationResults/CalculationResults.Infrastructure/Persistence/Databricks/SettlementReportDatabricksContext.cs index 52519b5..ad77fb6 100644 --- a/source/settlement-report/CalculationResults/CalculationResults.Infrastructure/Persistence/Databricks/SettlementReportDatabricksContext.cs +++ b/source/settlement-report/CalculationResults/CalculationResults.Infrastructure/Persistence/Databricks/SettlementReportDatabricksContext.cs @@ -16,6 +16,7 @@ using Energinet.DataHub.SettlementReport.CalculationResults.Infrastructure.Experimental; using Energinet.DataHub.SettlementReport.Common.Infrastructure.Options; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; namespace Energinet.DataHub.SettlementReport.CalculationResults.Infrastructure.Persistence.Databricks; @@ -26,8 +27,9 @@ public sealed class SettlementReportDatabricksContext : DatabricksContextBase, I public SettlementReportDatabricksContext( IOptions deltaTableOptions, - DatabricksSqlWarehouseQueryExecutor sqlWarehouseQueryExecutor) - : base(sqlWarehouseQueryExecutor, deltaTableOptions) + DatabricksSqlWarehouseQueryExecutor sqlWarehouseQueryExecutor, + ILoggerFactory loggerFactory) + : base(sqlWarehouseQueryExecutor, deltaTableOptions, loggerFactory) { _deltaTableOptions = deltaTableOptions; } diff --git a/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Application/SettlementReports/SettlementReportFileRequestHandlerIntegrationTests.cs b/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Application/SettlementReports/SettlementReportFileRequestHandlerIntegrationTests.cs index dd77014..66e5129 100644 --- a/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Application/SettlementReports/SettlementReportFileRequestHandlerIntegrationTests.cs +++ b/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Application/SettlementReports/SettlementReportFileRequestHandlerIntegrationTests.cs @@ -22,6 +22,7 @@ using Energinet.DataHub.SettlementReport.Common.Infrastructure.Options; using Energinet.DataHub.SettlementReport.Common.Interfaces.Models; using Energinet.DataHub.Wholesale.CalculationResults.IntegrationTests.Fixtures; +using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Moq; using NodaTime; @@ -57,8 +58,11 @@ public SettlementReportFileRequestHandlerIntegrationTests( Fixture.Inject(mockedOptions); + var mockedLogging = new Mock(); + var mockedLoggerFactory = new Mock(); + mockedLoggerFactory.Setup(x => x.CreateLogger(It.IsAny())).Returns(mockedLogging.Object); var sqlWarehouseQueryExecutor = _databricksSqlStatementApiFixture.GetDatabricksExecutor(); - var databricksContext = new SettlementReportDatabricksContext(mockedOptions.Object, sqlWarehouseQueryExecutor); + var databricksContext = new SettlementReportDatabricksContext(mockedOptions.Object, sqlWarehouseQueryExecutor, mockedLoggerFactory.Object); var settlementReportDataRepository = new SettlementReportEnergyResultRepository(databricksContext); var settlementReportWholesaleRepository = new SettlementReportWholesaleRepository(databricksContext); @@ -66,23 +70,28 @@ public SettlementReportFileRequestHandlerIntegrationTests( var settlementReportMeteringPointMasterDataRepository = new SettlementReportMeteringPointMasterDataRepository(new SettlementReportDatabricksContext( mockedOptions.Object, - sqlWarehouseQueryExecutor)); + sqlWarehouseQueryExecutor, + mockedLoggerFactory.Object)); var settlementReportMeteringPointTimeSeriesResultRepository = new SettlementReportMeteringPointTimeSeriesResultRepository(new SettlementReportDatabricksContext( mockedOptions.Object, - sqlWarehouseQueryExecutor)); + sqlWarehouseQueryExecutor, + mockedLoggerFactory.Object)); var settlementReportMonthlyAmountRepository = new SettlementReportMonthlyAmountRepository(new SettlementReportDatabricksContext( mockedOptions.Object, - sqlWarehouseQueryExecutor)); + sqlWarehouseQueryExecutor, + mockedLoggerFactory.Object)); var settlementReportChargePriceRepository = new SettlementReportChargePriceRepository(new SettlementReportDatabricksContext( mockedOptions.Object, - sqlWarehouseQueryExecutor)); + sqlWarehouseQueryExecutor, + mockedLoggerFactory.Object)); var settlementReportMonthlyAmountTotalRepository = new SettlementReportMonthlyAmountTotalRepository(new SettlementReportDatabricksContext( mockedOptions.Object, - sqlWarehouseQueryExecutor)); + sqlWarehouseQueryExecutor, + mockedLoggerFactory.Object)); Fixture.Inject(new SettlementReportFileGeneratorFactory( settlementReportDataRepository, diff --git a/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/CalculationResults.IntegrationTests.csproj b/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/CalculationResults.IntegrationTests.csproj index 863946f..af0e6fa 100644 --- a/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/CalculationResults.IntegrationTests.csproj +++ b/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/CalculationResults.IntegrationTests.csproj @@ -12,6 +12,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportChargeLinkPeriodsRepositoryTests.cs b/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportChargeLinkPeriodsRepositoryTests.cs index 198ddeb..adc171f 100644 --- a/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportChargeLinkPeriodsRepositoryTests.cs +++ b/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportChargeLinkPeriodsRepositoryTests.cs @@ -21,6 +21,8 @@ using Energinet.DataHub.SettlementReport.Common.Interfaces.Models; using Energinet.DataHub.Wholesale.CalculationResults.IntegrationTests.Fixtures; using FluentAssertions; +using Microsoft.Extensions.Logging; +using Moq; using Xunit; namespace Energinet.DataHub.Wholesale.CalculationResults.IntegrationTests.Infrastructure.SettlementReports_v2; @@ -32,6 +34,10 @@ public class SettlementReportChargeLinkPeriodsRepositoryTests : TestBase(); + + var mockedLoggerFactory = new Mock(); + mockedLoggerFactory.Setup(x => x.CreateLogger(It.IsAny())).Returns(mockedLogging.Object); _databricksSqlStatementApiFixture = databricksSqlStatementApiFixture; _databricksSqlStatementApiFixture.DatabricksSchemaManager.DeltaTableOptions.Value.SettlementReportSchemaName = @@ -39,7 +45,8 @@ public SettlementReportChargeLinkPeriodsRepositoryTests(MigrationsFreeDatabricks Fixture.Inject(new SettlementReportDatabricksContext( _databricksSqlStatementApiFixture.DatabricksSchemaManager.DeltaTableOptions, - _databricksSqlStatementApiFixture.GetDatabricksExecutor())); + _databricksSqlStatementApiFixture.GetDatabricksExecutor(), + mockedLoggerFactory.Object)); } [Fact(Skip = "Performance testing")] diff --git a/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportChargePricesRepositoryTests.cs b/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportChargePricesRepositoryTests.cs index 33fb73c..7115d4d 100644 --- a/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportChargePricesRepositoryTests.cs +++ b/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportChargePricesRepositoryTests.cs @@ -20,6 +20,8 @@ using Energinet.DataHub.SettlementReport.CalculationResults.Interfaces.SettlementReports_v2.Models; using Energinet.DataHub.SettlementReport.Common.Interfaces.Models; using Energinet.DataHub.Wholesale.CalculationResults.IntegrationTests.Fixtures; +using Microsoft.Extensions.Logging; +using Moq; using Xunit; namespace Energinet.DataHub.Wholesale.CalculationResults.IntegrationTests.Infrastructure.SettlementReports_v2; @@ -40,6 +42,10 @@ public class SettlementReportChargePricesRepositoryTests : TestBase(); + + var mockedLoggerFactory = new Mock(); + mockedLoggerFactory.Setup(x => x.CreateLogger(It.IsAny())).Returns(mockedLogging.Object); _databricksSqlStatementApiFixture = databricksSqlStatementApiFixture; _databricksSqlStatementApiFixture.DatabricksSchemaManager.DeltaTableOptions.Value.SettlementReportSchemaName = @@ -50,7 +56,8 @@ public SettlementReportChargePricesRepositoryTests(MigrationsFreeDatabricksSqlSt Fixture.Inject(new SettlementReportDatabricksContext( _databricksSqlStatementApiFixture.DatabricksSchemaManager.DeltaTableOptions, - _databricksSqlStatementApiFixture.GetDatabricksExecutor())); + _databricksSqlStatementApiFixture.GetDatabricksExecutor(), + mockedLoggerFactory.Object)); } [Fact(Skip = "Performance testing")] diff --git a/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportEnergyResultRepositoryTests.cs b/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportEnergyResultRepositoryTests.cs index 2e109c4..7126aaf 100644 --- a/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportEnergyResultRepositoryTests.cs +++ b/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportEnergyResultRepositoryTests.cs @@ -20,6 +20,8 @@ using Energinet.DataHub.SettlementReport.CalculationResults.Interfaces.SettlementReports_v2.Models; using Energinet.DataHub.SettlementReport.Common.Interfaces.Models; using Energinet.DataHub.Wholesale.CalculationResults.IntegrationTests.Fixtures; +using Microsoft.Extensions.Logging; +using Moq; using Xunit; namespace Energinet.DataHub.Wholesale.CalculationResults.IntegrationTests.Infrastructure.SettlementReports_v2; @@ -31,6 +33,10 @@ public class SettlementReportEnergyResultRepositoryTests : TestBase(); + + var mockedLoggerFactory = new Mock(); + mockedLoggerFactory.Setup(x => x.CreateLogger(It.IsAny())).Returns(mockedLogging.Object); _databricksSqlStatementApiFixture = databricksSqlStatementApiFixture; _databricksSqlStatementApiFixture.DatabricksSchemaManager.DeltaTableOptions.Value.SettlementReportSchemaName = @@ -38,7 +44,8 @@ public SettlementReportEnergyResultRepositoryTests(MigrationsFreeDatabricksSqlSt Fixture.Inject(new SettlementReportDatabricksContext( _databricksSqlStatementApiFixture.DatabricksSchemaManager.DeltaTableOptions, - _databricksSqlStatementApiFixture.GetDatabricksExecutor())); + _databricksSqlStatementApiFixture.GetDatabricksExecutor(), + mockedLoggerFactory.Object)); } [Fact(Skip = "Performance testing")] diff --git a/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportMeteringPointMasterDataRepositoryTests.cs b/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportMeteringPointMasterDataRepositoryTests.cs index cacb1bd..0b9525b 100644 --- a/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportMeteringPointMasterDataRepositoryTests.cs +++ b/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportMeteringPointMasterDataRepositoryTests.cs @@ -21,6 +21,8 @@ using Energinet.DataHub.SettlementReport.Common.Interfaces.Models; using Energinet.DataHub.Wholesale.CalculationResults.IntegrationTests.Fixtures; using FluentAssertions; +using Microsoft.Extensions.Logging; +using Moq; using Xunit; namespace Energinet.DataHub.Wholesale.CalculationResults.IntegrationTests.Infrastructure.SettlementReports_v2; @@ -32,6 +34,10 @@ public class SettlementReportMeteringPointMasterDataRepositoryTests : TestBase(); + + var mockedLoggerFactory = new Mock(); + mockedLoggerFactory.Setup(x => x.CreateLogger(It.IsAny())).Returns(mockedLogging.Object); _databricksSqlStatementApiFixture = databricksSqlStatementApiFixture; _databricksSqlStatementApiFixture.DatabricksSchemaManager.DeltaTableOptions.Value.SettlementReportSchemaName = @@ -39,7 +45,8 @@ public SettlementReportMeteringPointMasterDataRepositoryTests(MigrationsFreeData Fixture.Inject(new SettlementReportDatabricksContext( _databricksSqlStatementApiFixture.DatabricksSchemaManager.DeltaTableOptions, - _databricksSqlStatementApiFixture.GetDatabricksExecutor())); + _databricksSqlStatementApiFixture.GetDatabricksExecutor(), + mockedLoggerFactory.Object)); } [Fact(Skip = "Performance testing")] diff --git a/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportMeteringPointTimeSeriesResultRepositoryTests.cs b/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportMeteringPointTimeSeriesResultRepositoryTests.cs index d237dae..aa375de 100644 --- a/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportMeteringPointTimeSeriesResultRepositoryTests.cs +++ b/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportMeteringPointTimeSeriesResultRepositoryTests.cs @@ -21,6 +21,8 @@ using Energinet.DataHub.SettlementReport.CalculationResults.Interfaces.SettlementReports_v2.Models; using Energinet.DataHub.SettlementReport.Common.Interfaces.Models; using Energinet.DataHub.Wholesale.CalculationResults.IntegrationTests.Fixtures; +using Microsoft.Extensions.Logging; +using Moq; using Xunit; namespace Energinet.DataHub.Wholesale.CalculationResults.IntegrationTests.Infrastructure.SettlementReports_v2; @@ -32,6 +34,10 @@ public class SettlementReportMeteringPointTimeSeriesResultRepositoryTests : Test public SettlementReportMeteringPointTimeSeriesResultRepositoryTests(MigrationsFreeDatabricksSqlStatementApiFixture databricksSqlStatementApiFixture) { + var mockedLogging = new Mock(); + + var mockedLoggerFactory = new Mock(); + mockedLoggerFactory.Setup(x => x.CreateLogger(It.IsAny())).Returns(mockedLogging.Object); _databricksSqlStatementApiFixture = databricksSqlStatementApiFixture; _databricksSqlStatementApiFixture.DatabricksSchemaManager.DeltaTableOptions.Value.SettlementReportSchemaName = @@ -39,7 +45,8 @@ public SettlementReportMeteringPointTimeSeriesResultRepositoryTests(MigrationsFr Fixture.Inject(new SettlementReportDatabricksContext( _databricksSqlStatementApiFixture.DatabricksSchemaManager.DeltaTableOptions, - _databricksSqlStatementApiFixture.GetDatabricksExecutor())); + _databricksSqlStatementApiFixture.GetDatabricksExecutor(), + mockedLoggerFactory.Object)); } [Fact] diff --git a/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportMonthlyAmountRepositoryTests.cs b/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportMonthlyAmountRepositoryTests.cs index 799f074..d84f337 100644 --- a/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportMonthlyAmountRepositoryTests.cs +++ b/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportMonthlyAmountRepositoryTests.cs @@ -20,6 +20,8 @@ using Energinet.DataHub.SettlementReport.CalculationResults.Interfaces.SettlementReports_v2.Models; using Energinet.DataHub.SettlementReport.Common.Interfaces.Models; using Energinet.DataHub.Wholesale.CalculationResults.IntegrationTests.Fixtures; +using Microsoft.Extensions.Logging; +using Moq; using Xunit; namespace Energinet.DataHub.Wholesale.CalculationResults.IntegrationTests.Infrastructure.SettlementReports_v2; @@ -31,6 +33,9 @@ public class SettlementReportMonthlyAmountRepositoryTests : TestBase(); + var mockedLoggerFactory = new Mock(); + mockedLoggerFactory.Setup(x => x.CreateLogger(It.IsAny())).Returns(mockedLogging.Object); _databricksSqlStatementApiFixture = databricksSqlStatementApiFixture; _databricksSqlStatementApiFixture.DatabricksSchemaManager.DeltaTableOptions.Value.SettlementReportSchemaName = @@ -38,7 +43,8 @@ public SettlementReportMonthlyAmountRepositoryTests(MigrationsFreeDatabricksSqlS Fixture.Inject(new SettlementReportDatabricksContext( _databricksSqlStatementApiFixture.DatabricksSchemaManager.DeltaTableOptions, - _databricksSqlStatementApiFixture.GetDatabricksExecutor())); + _databricksSqlStatementApiFixture.GetDatabricksExecutor(), + mockedLoggerFactory.Object)); } [Fact(Skip = "Performance testing")] diff --git a/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportMonthlyAmountTotalRepositoryTests.cs b/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportMonthlyAmountTotalRepositoryTests.cs index 7263758..252c1c9 100644 --- a/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportMonthlyAmountTotalRepositoryTests.cs +++ b/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportMonthlyAmountTotalRepositoryTests.cs @@ -20,6 +20,8 @@ using Energinet.DataHub.SettlementReport.CalculationResults.Interfaces.SettlementReports_v2.Models; using Energinet.DataHub.SettlementReport.Common.Interfaces.Models; using Energinet.DataHub.Wholesale.CalculationResults.IntegrationTests.Fixtures; +using Microsoft.Extensions.Logging; +using Moq; using Xunit; namespace Energinet.DataHub.Wholesale.CalculationResults.IntegrationTests.Infrastructure.SettlementReports_v2; @@ -31,6 +33,10 @@ public class SettlementReportMonthlyAmountTotalRepositoryTests : TestBase(); + var mockedLoggerFactory = new Mock(); + mockedLoggerFactory.Setup(x => x.CreateLogger(It.IsAny())).Returns(mockedLogging.Object); + _databricksSqlStatementApiFixture = databricksSqlStatementApiFixture; _databricksSqlStatementApiFixture.DatabricksSchemaManager.DeltaTableOptions.Value.SettlementReportSchemaName = @@ -38,7 +44,8 @@ public SettlementReportMonthlyAmountTotalRepositoryTests(MigrationsFreeDatabrick Fixture.Inject(new SettlementReportDatabricksContext( _databricksSqlStatementApiFixture.DatabricksSchemaManager.DeltaTableOptions, - _databricksSqlStatementApiFixture.GetDatabricksExecutor())); + _databricksSqlStatementApiFixture.GetDatabricksExecutor(), + mockedLoggerFactory.Object)); } [Fact(Skip = "Performance testing")] diff --git a/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportWholesaleRepositoryTests.cs b/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportWholesaleRepositoryTests.cs index 9b01bdc..84a80ea 100644 --- a/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportWholesaleRepositoryTests.cs +++ b/source/settlement-report/CalculationResults/CalculationResults.IntegrationTests/Infrastructure/SettlementReports_v2/SettlementReportWholesaleRepositoryTests.cs @@ -20,6 +20,8 @@ using Energinet.DataHub.SettlementReport.CalculationResults.Interfaces.SettlementReports_v2.Models; using Energinet.DataHub.SettlementReport.Common.Interfaces.Models; using Energinet.DataHub.Wholesale.CalculationResults.IntegrationTests.Fixtures; +using Microsoft.Extensions.Logging; +using Moq; using Xunit; namespace Energinet.DataHub.Wholesale.CalculationResults.IntegrationTests.Infrastructure.SettlementReports_v2; @@ -31,6 +33,9 @@ public class SettlementReportWholesaleRepositoryTests : TestBase(); + var mockedLoggerFactory = new Mock(); + mockedLoggerFactory.Setup(x => x.CreateLogger(It.IsAny())).Returns(mockedLogging.Object); _databricksSqlStatementApiFixture = databricksSqlStatementApiFixture; _databricksSqlStatementApiFixture.DatabricksSchemaManager.DeltaTableOptions.Value.SettlementReportSchemaName = @@ -38,7 +43,8 @@ public SettlementReportWholesaleRepositoryTests(MigrationsFreeDatabricksSqlState Fixture.Inject(new SettlementReportDatabricksContext( _databricksSqlStatementApiFixture.DatabricksSchemaManager.DeltaTableOptions, - _databricksSqlStatementApiFixture.GetDatabricksExecutor())); + _databricksSqlStatementApiFixture.GetDatabricksExecutor(), + mockedLoggerFactory.Object)); } [Fact(Skip = "Performance testing")]