diff --git a/src/KpiGenerator.Tests/ProjectReportingTests.cs b/src/KpiGenerator.Tests/ProjectReportingTests.cs index 5cd8eb95c982434bb0d5ad81c627b0fc0461d222..861c6fc046885a1b48d1d0ce3c2c307b8365b53c 100644 --- a/src/KpiGenerator.Tests/ProjectReportingTests.cs +++ b/src/KpiGenerator.Tests/ProjectReportingTests.cs @@ -26,7 +26,6 @@ public class ProjectReportingTests private IOptionsMonitor<ReportingConfiguration> _reportingConfiguration = null!; private IAdminApi _adminApi = null!; - private IProjectQuotaApi _projectQuotaApi = null!; private ProjectReporting _projectReporting = null!; // System Under Test @@ -69,9 +68,8 @@ public class ProjectReportingTests }; _reportingConfiguration = Substitute.For<IOptionsMonitor<ReportingConfiguration>>(); _reportingConfiguration.CurrentValue.Returns(reportingConfig); - + _adminApi = Substitute.For<IAdminApi>(); - _projectQuotaApi = Substitute.For<ProjectQuotaApi>(); } #region GenerateReportingAsync Tests @@ -96,7 +94,7 @@ public class ProjectReportingTests var pagination = new Pagination(currentPage: 1, pageSize: 2, totalCount: 2, totalPages: 1); return Task.FromResult(new ProjectAdminDtoPagedResponse(data: projects, pagination: pagination, statusCode: 200, traceId: "dummy-trace-id")); }); - _projectReporting = new ProjectReporting(_mapper, _logger, _gitlabStorageService, _localStorageService, _kpiConfiguration, _reportingConfiguration, _adminApi, _projectQuotaApi); + _projectReporting = new ProjectReporting(_mapper, _logger, _gitlabStorageService, _localStorageService, _kpiConfiguration, _reportingConfiguration, _adminApi); // Act var result = await _projectReporting.GenerateReportingAsync(); @@ -128,7 +126,7 @@ public class ProjectReportingTests var pagination = new Pagination(currentPage: 1, pageSize: 0, totalCount: 0, totalPages: 1); return Task.FromResult(new ProjectAdminDtoPagedResponse(data: [], pagination: pagination, statusCode: 200, traceId: "dummy-trace-id")); }); - _projectReporting = new ProjectReporting(_mapper, _logger, _gitlabStorageService, _localStorageService, _kpiConfiguration, _reportingConfiguration, _adminApi, _projectQuotaApi); + _projectReporting = new ProjectReporting(_mapper, _logger, _gitlabStorageService, _localStorageService, _kpiConfiguration, _reportingConfiguration, _adminApi); // Act var result = await _projectReporting.GenerateReportingAsync(); @@ -155,7 +153,7 @@ public class ProjectReportingTests }; // We want to ensure that GenerateReportingAsync returns some test objects - _projectReporting = Substitute.ForPartsOf<ProjectReporting>(_mapper, _logger, _gitlabStorageService, _localStorageService, _kpiConfiguration, _reportingConfiguration, _adminApi, _projectQuotaApi); + _projectReporting = Substitute.ForPartsOf<ProjectReporting>(_mapper, _logger, _gitlabStorageService, _localStorageService, _kpiConfiguration, _reportingConfiguration, _adminApi); _projectReporting .Configure() .GenerateReportingAsync() @@ -195,7 +193,7 @@ public class ProjectReportingTests }; // Partial mock to override GenerateReportingAsync - _projectReporting = Substitute.ForPartsOf<ProjectReporting>(_mapper, _logger, _gitlabStorageService, _localStorageService, _kpiConfiguration, _reportingConfiguration, _adminApi, _projectQuotaApi); + _projectReporting = Substitute.ForPartsOf<ProjectReporting>(_mapper, _logger, _gitlabStorageService, _localStorageService, _kpiConfiguration, _reportingConfiguration, _adminApi); _projectReporting .Configure() .GenerateReportingAsync() @@ -235,7 +233,7 @@ public class ProjectReportingTests }; // Partial mock to override GenerateReportingAsync - _projectReporting = Substitute.ForPartsOf<ProjectReporting>(_mapper, _logger, _gitlabStorageService, _localStorageService, _kpiConfiguration, _reportingConfiguration, _adminApi, _projectQuotaApi); + _projectReporting = Substitute.ForPartsOf<ProjectReporting>(_mapper, _logger, _gitlabStorageService, _localStorageService, _kpiConfiguration, _reportingConfiguration, _adminApi); _projectReporting .Configure() .GenerateReportingAsync() @@ -272,7 +270,7 @@ public class ProjectReportingTests }; // Partial mock - _projectReporting = Substitute.ForPartsOf<ProjectReporting>(_mapper, _logger, _gitlabStorageService, _localStorageService, _kpiConfiguration, _reportingConfiguration, _adminApi, _projectQuotaApi); + _projectReporting = Substitute.ForPartsOf<ProjectReporting>(_mapper, _logger, _gitlabStorageService, _localStorageService, _kpiConfiguration, _reportingConfiguration, _adminApi); _projectReporting .Configure() .GenerateReportingAsync() diff --git a/src/KpiGenerator/KpiGenerator.csproj b/src/KpiGenerator/KpiGenerator.csproj index c5b88a732d567150aabd8ad0c4977f0cac51be79..acecf526b075dd8276b1dac1656d61f70aa05598 100644 --- a/src/KpiGenerator/KpiGenerator.csproj +++ b/src/KpiGenerator/KpiGenerator.csproj @@ -21,7 +21,7 @@ <PackageReference Include="AutoMapper" Version="12.0.1" /> <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" /> <PackageReference Include="CommandLineParser" Version="2.9.1" /> - <PackageReference Include="Coscine.ApiClient" Version="1.9.4" /> + <PackageReference Include="Coscine.ApiClient" Version="1.9.7" /> <PackageReference Include="dotNetRdf.Core" Version="3.1.1" /> <PackageReference Include="GitLabApiClient" Version="1.8.1-beta.5" /> <PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" /> diff --git a/src/KpiGenerator/Program.cs b/src/KpiGenerator/Program.cs index c33fd06b0b850383196ee54bd199f360180a0845..55e66793b76afaaeea3961f678a21b01d3e89561 100644 --- a/src/KpiGenerator/Program.cs +++ b/src/KpiGenerator/Program.cs @@ -176,7 +176,7 @@ public class Program BasePath = $"{reportingConfiguration.Endpoint.TrimEnd('/')}/coscine", ApiKeyPrefix = { { "Authorization", "Bearer" } }, ApiKey = { { "Authorization", reportingConfiguration.ApiKey } }, - Timeout = 300000 // 5 minutes + Timeout = TimeSpan.FromSeconds(300) // 5 minutes }; services.AddSingleton<IAdminApi>(new AdminApi(apiConfiguration)); services.AddSingleton<IApplicationProfileApi>(new ApplicationProfileApi(apiConfiguration)); diff --git a/src/KpiGenerator/Reportings/Project/ProjectReporting.cs b/src/KpiGenerator/Reportings/Project/ProjectReporting.cs index ba8d846a7cc1c037b190fc2a8c87bcc9d70777cf..e8bee5ee1d5235deb95e48cac58a5b1ed03fe0da 100644 --- a/src/KpiGenerator/Reportings/Project/ProjectReporting.cs +++ b/src/KpiGenerator/Reportings/Project/ProjectReporting.cs @@ -22,7 +22,6 @@ public class ProjectReporting private readonly KpiConfiguration _kpiConfiguration; private readonly ReportingConfiguration _reportingConfiguration; private readonly IAdminApi _adminApi; - private readonly IProjectQuotaApi _projectQuotaApi; public ProjectReportingOptions Options { get; private set; } = null!; public string ReportingFileName { get; } @@ -34,8 +33,7 @@ public class ProjectReporting [FromKeyedServices("local")] IStorageService localStorageService, IOptionsMonitor<KpiConfiguration> kpiConfiguration, IOptionsMonitor<ReportingConfiguration> reportingConfiguration, - IAdminApi adminApi, - IProjectQuotaApi projectQuotaApi + IAdminApi adminApi ) { _mapper = mapper; @@ -47,7 +45,6 @@ public class ProjectReporting ReportingFileName = _kpiConfiguration.ProjectKpi.FileName; _adminApi = adminApi; - _projectQuotaApi = projectQuotaApi; } public async Task<bool> RunAsync(ProjectReportingOptions reportingOptions) diff --git a/src/KpiGenerator/Reportings/Resource/ResourceReporting.cs b/src/KpiGenerator/Reportings/Resource/ResourceReporting.cs index 3857acb9fce15b9c7ad2c20902bc629b330642d0..48fb60b78c12173a504a2c19233f4601be17f7be 100644 --- a/src/KpiGenerator/Reportings/Resource/ResourceReporting.cs +++ b/src/KpiGenerator/Reportings/Resource/ResourceReporting.cs @@ -50,7 +50,7 @@ public class ResourceReporting BasePath = $"{_reportingConfiguration.Endpoint.TrimEnd('/')}/coscine", ApiKeyPrefix = { { "Authorization", "Bearer" } }, ApiKey = { { "Authorization", _reportingConfiguration.ApiKey } }, - Timeout = 300000 // 5 minutes + Timeout = TimeSpan.FromSeconds(300) // 5 minutes }; _adminApi = adminApi;