From 6a3d37acdf52724e77bdc3f8d754ae5af946ac07 Mon Sep 17 00:00:00 2001 From: antoineatrhea Date: Wed, 3 Jan 2024 09:57:51 +0100 Subject: [PATCH 1/3] Fix #494: Moved from WASM to ServerSide --- .../TopMenuEntry/AboutMenuTestFixture.cs | 1 + COMETwebapp.sln.DotSettings | 40 +++---- COMETwebapp/COMETwebapp.csproj | 10 +- COMETwebapp/Components/Shared/About.razor.cs | 7 +- COMETwebapp/Dockerfile | 9 +- .../Extensions/ServiceCollectionExtensions.cs | 89 +++++++++++++++ COMETwebapp/Pages/Error.cshtml | 50 +++++++++ COMETwebapp/Pages/Error.cshtml.cs | 58 ++++++++++ COMETwebapp/Pages/Index.razor | 2 +- COMETwebapp/Pages/_Host.cshtml | 106 ++++++++++++++++++ COMETwebapp/Program.cs | 98 +++------------- COMETwebapp/Properties/launchSettings.json | 18 ++- COMETwebapp/_Imports.razor | 1 - COMETwebapp/appsettings.Development.json | 3 + COMETwebapp/appsettings.json | 11 ++ COMETwebapp/nginx.conf | 15 --- .../wwwroot/DefaultTextConfiguration.json | 12 ++ COMETwebapp/wwwroot/index.html | 85 -------------- CommonLibrary.DotSettings | 26 +++++ WebAppHeader.DotSettings | 25 +++++ 20 files changed, 438 insertions(+), 228 deletions(-) create mode 100644 COMETwebapp/Extensions/ServiceCollectionExtensions.cs create mode 100644 COMETwebapp/Pages/Error.cshtml create mode 100644 COMETwebapp/Pages/Error.cshtml.cs create mode 100644 COMETwebapp/Pages/_Host.cshtml create mode 100644 COMETwebapp/appsettings.Development.json create mode 100644 COMETwebapp/appsettings.json delete mode 100644 COMETwebapp/nginx.conf create mode 100644 COMETwebapp/wwwroot/DefaultTextConfiguration.json delete mode 100644 COMETwebapp/wwwroot/index.html create mode 100644 CommonLibrary.DotSettings create mode 100644 WebAppHeader.DotSettings diff --git a/COMETwebapp.Tests/Shared/TopMenuEntry/AboutMenuTestFixture.cs b/COMETwebapp.Tests/Shared/TopMenuEntry/AboutMenuTestFixture.cs index cc73d4e3..7e82e9ab 100644 --- a/COMETwebapp.Tests/Shared/TopMenuEntry/AboutMenuTestFixture.cs +++ b/COMETwebapp.Tests/Shared/TopMenuEntry/AboutMenuTestFixture.cs @@ -55,6 +55,7 @@ public void Setup() this.versionService = new Mock(); this.versionService.Setup(x => x.GetVersion()).Returns("1.1.2"); this.context.Services.AddSingleton(this.versionService.Object); + this.context.Services.AddSingleton(new Mock().Object); this.context.ConfigureDevExpressBlazor(); } diff --git a/COMETwebapp.sln.DotSettings b/COMETwebapp.sln.DotSettings index d6f1c489..5cc4b15c 100644 --- a/COMETwebapp.sln.DotSettings +++ b/COMETwebapp.sln.DotSettings @@ -1,4 +1,4 @@ - + HINT WARNING DO_NOT_SHOW @@ -251,30 +251,7 @@ True True True - -------------------------------------------------------------------------------------------------------------------- - <copyright file="${File.FileName}" company="RHEA System S.A."> - Copyright (c) ${CurrentDate.Year} RHEA System S.A. - - Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Jaime Bernar, Théate Antoine - - This file is part of COMET WEB Community Edition - The COMET WEB Community Edition is the RHEA Web Application implementation of ECSS-E-TM-10-25 Annex A and Annex C. - - The COMET WEB Community Edition is free software; you can redistribute it and/or - modify it under the terms of the GNU Affero General Public - License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. - - The COMET WEB Community Edition is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - </copyright> - -------------------------------------------------------------------------------------------------------------------- - + True False False @@ -282,7 +259,18 @@ False <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> - True + True + C:\CODE\COMET\COMET-WEB-Community-Edition\CommonLibrary.DotSettings + ..\CommonLibrary.DotSettings + True + C:\CODE\COMET\COMET-WEB-Community-Edition\WebAppHeader.DotSettings + ..\WebAppHeader.DotSettings + True + CommonLibraryHeader + False + 1 + True + 2 True True True diff --git a/COMETwebapp/COMETwebapp.csproj b/COMETwebapp/COMETwebapp.csproj index 2e509d08..3e324bb4 100644 --- a/COMETwebapp/COMETwebapp.csproj +++ b/COMETwebapp/COMETwebapp.csproj @@ -1,4 +1,4 @@ - + net7.0 @@ -21,8 +21,6 @@ - - @@ -30,4 +28,10 @@ + + + Always + + + diff --git a/COMETwebapp/Components/Shared/About.razor.cs b/COMETwebapp/Components/Shared/About.razor.cs index 0a988477..07f07907 100644 --- a/COMETwebapp/Components/Shared/About.razor.cs +++ b/COMETwebapp/Components/Shared/About.razor.cs @@ -49,10 +49,10 @@ public partial class About private string license = string.Empty; /// - /// The + /// The /// [Inject] - public HttpClient HttpClient { get; set; } + public IHttpClientFactory HttpClientFactory { get; set; } /// /// The @@ -66,7 +66,8 @@ public partial class About protected override async Task OnInitializedAsync() { this.cometWebVersion = this.VersionService.GetVersion(); - this.license = await this.HttpClient.GetStringAsync(GitUrl); + var httpClient = this.HttpClientFactory.CreateClient("About"); + this.license = await httpClient.GetStringAsync(GitUrl); } } } diff --git a/COMETwebapp/Dockerfile b/COMETwebapp/Dockerfile index 9e11258b..ec9b5e23 100644 --- a/COMETwebapp/Dockerfile +++ b/COMETwebapp/Dockerfile @@ -14,7 +14,8 @@ RUN dotnet build COMETwebapp -c Release -o /app/build --no-restore FROM build AS publish RUN dotnet publish COMETwebapp -c Release -o /app/publish -FROM nginx:alpine AS final -WORKDIR /usr/share/nginx/html -COPY --from=publish /app/publish/wwwroot . -COPY COMETwebapp/nginx.conf /etc/nginx/nginx.conf \ No newline at end of file +FROM mcr.microsoft.com/dotnet/aspnet:7.0-alpine AS final +WORKDIR /app +COPY --from=publish /app/publish . + +ENTRYPOINT ["dotnet", "COMETwebapp.dll"] \ No newline at end of file diff --git a/COMETwebapp/Extensions/ServiceCollectionExtensions.cs b/COMETwebapp/Extensions/ServiceCollectionExtensions.cs new file mode 100644 index 00000000..c78ffcc4 --- /dev/null +++ b/COMETwebapp/Extensions/ServiceCollectionExtensions.cs @@ -0,0 +1,89 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// Copyright (c) 2024 RHEA System S.A. +// +// Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Jaime Bernar, Théate Antoine +// +// This file is part of COMET WEB Community Edition +// The COMET WEB Community Edition is the RHEA Web Application implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// +// The COMET WEB Community Edition is free software; you can redistribute it and/or +// modify it under the terms of the GNU Affero General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// The COMET WEB Community Edition is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace COMETwebapp.Extensions +{ + using COMETwebapp.Model.Viewer; + using COMETwebapp.Services.Interoperability; + using COMETwebapp.Services.ShowHideDeprecatedThingsService; + using COMETwebapp.Services.SubscriptionService; + using COMETwebapp.Utilities; + using COMETwebapp.ViewModels.Components.BookEditor; + using COMETwebapp.ViewModels.Components.ModelDashboard; + using COMETwebapp.ViewModels.Components.ModelDashboard.ParameterValues; + using COMETwebapp.ViewModels.Components.ModelEditor; + using COMETwebapp.ViewModels.Components.ParameterEditor; + using COMETwebapp.ViewModels.Components.ReferenceData; + using COMETwebapp.ViewModels.Components.SubscriptionDashboard; + using COMETwebapp.ViewModels.Components.SystemRepresentation; + using COMETwebapp.ViewModels.Components.UserManagement; + using COMETwebapp.ViewModels.Components.Viewer; + using COMETwebapp.ViewModels.Shared.TopMenuEntry; + + /// + /// Extension class for the + /// + public static class ServiceCollectionExtensions + { + /// + /// Register all services required to run the application inside the + /// + /// The + public static void RegisterServices(this IServiceCollection serviceCollection) + { + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddScoped(); + serviceCollection.AddHttpClient(); + serviceCollection.AddAntDesign(); + } + + /// + /// Register all view models required to run the application inside the + /// + /// The + public static void RegisterViewModels(this IServiceCollection serviceCollection) + { + serviceCollection.AddScoped(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + serviceCollection.AddTransient(); + } + } +} diff --git a/COMETwebapp/Pages/Error.cshtml b/COMETwebapp/Pages/Error.cshtml new file mode 100644 index 00000000..098b5d1e --- /dev/null +++ b/COMETwebapp/Pages/Error.cshtml @@ -0,0 +1,50 @@ +@page + +@model COMETwebapp.Pages.ErrorModel + + + + + + + + Error + + + + + +
+
+

Error.

+

An error occurred while processing your request.

+ + @if (this.Model.ShowRequestId) + { +

+ Request ID: @(this.Model.RequestId) +

+ } + +

Development Mode

+

+ Swapping to the Development environment displays detailed information about the error that occurred. +

+

+ The Development environment shouldn't be enabled for deployed applications. + It can result in displaying sensitive information from exceptions to end users. + For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development + and restarting the app. +

+
+
+ + + \ No newline at end of file diff --git a/COMETwebapp/Pages/Error.cshtml.cs b/COMETwebapp/Pages/Error.cshtml.cs new file mode 100644 index 00000000..3fdc7eec --- /dev/null +++ b/COMETwebapp/Pages/Error.cshtml.cs @@ -0,0 +1,58 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// Copyright (c) 2024 RHEA System S.A. +// +// Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Jaime Bernar, Théate Antoine +// +// This file is part of COMET WEB Community Edition +// The COMET WEB Community Edition is the RHEA Web Application implementation of ECSS-E-TM-10-25 +// Annex A and Annex C. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace COMETwebapp.Pages +{ + using System.Diagnostics; + + using Microsoft.AspNetCore.Mvc; + using Microsoft.AspNetCore.Mvc.RazorPages; + + /// + /// Data model that provide information about request when an error occurs + /// + [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] + [IgnoreAntiforgeryToken] + public class ErrorModel : PageModel + { + /// + /// Gets or sets the request id + /// + public string RequestId { get; set; } + + /// + /// Gets the assert the the should be shown + /// + public bool ShowRequestId => !string.IsNullOrEmpty(this.RequestId); + + /// + /// Sets the based on context + /// + public void OnGet() + { + this.RequestId = Activity.Current?.Id ?? this.HttpContext.TraceIdentifier; + } + } +} diff --git a/COMETwebapp/Pages/Index.razor b/COMETwebapp/Pages/Index.razor index 731fed46..a9fec8c6 100644 --- a/COMETwebapp/Pages/Index.razor +++ b/COMETwebapp/Pages/Index.razor @@ -20,4 +20,4 @@ // along with this program. If not, see http://www.gnu.org/licenses/. -------------------------------------------------------------------------------> @page "/" - \ No newline at end of file + diff --git a/COMETwebapp/Pages/_Host.cshtml b/COMETwebapp/Pages/_Host.cshtml new file mode 100644 index 00000000..553cb921 --- /dev/null +++ b/COMETwebapp/Pages/_Host.cshtml @@ -0,0 +1,106 @@ +@page "/" + +@using COMET.Web.Common +@using Microsoft.AspNetCore.Components.Web +@using Microsoft.AspNetCore.Mvc.TagHelpers +@namespace COMETwebapp.Pages +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers + + + + + + + CDP4-COMET Community Edition + + + + + + + + + + + + + + + + + + +
+ An unhandled error has occurred. + Reload + �� +
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/COMETwebapp/Program.cs b/COMETwebapp/Program.cs index 943652ba..e057e5a2 100644 --- a/COMETwebapp/Program.cs +++ b/COMETwebapp/Program.cs @@ -24,37 +24,15 @@ namespace COMETwebapp { - using COMET.Web.Common.Extensions; - - using COMETwebapp.Model; - using COMETwebapp.Model.Viewer; - using COMETwebapp.Services.Interoperability; - using COMETwebapp.Services.ShowHideDeprecatedThingsService; - using COMETwebapp.Services.SubscriptionService; - using COMETwebapp.Shared.TopMenuEntry; - using COMETwebapp.Utilities; - using COMETwebapp.ViewModels.Components.ModelDashboard; - using COMETwebapp.ViewModels.Components.ModelDashboard.ParameterValues; - using COMETwebapp.ViewModels.Components.ModelEditor; - using COMETwebapp.ViewModels.Components.ParameterEditor; - using COMETwebapp.ViewModels.Components.ReferenceData; - using COMETwebapp.ViewModels.Components.SubscriptionDashboard; - using COMETwebapp.ViewModels.Components.SystemRepresentation; - using COMETwebapp.ViewModels.Components.UserManagement; - using COMETwebapp.ViewModels.Components.Viewer; - using COMETwebapp.ViewModels.Shared.TopMenuEntry; - - using Microsoft.AspNetCore.Components.WebAssembly.Hosting; - using System.Diagnostics.CodeAnalysis; using System.Reflection; - using COMET.Web.Common; + using COMET.Web.Common.Extensions; using COMET.Web.Common.Shared.TopMenuEntry; - using COMETwebapp.ViewModels.Components.BookEditor; - - using Microsoft.AspNetCore.Components.Web; + using COMETwebapp.Extensions; + using COMETwebapp.Model; + using COMETwebapp.Shared.TopMenuEntry; /// /// Point of entry of the application @@ -67,69 +45,29 @@ public class Program /// public static async Task Main(string[] args) { - var builder = WebAssemblyHostBuilder.CreateDefault(args); + var builder = WebApplication.CreateBuilder(args); - builder.RootComponents.Add("#app"); - builder.RootComponents.Add("head::after"); + builder.Services.AddRazorPages(); + builder.Services.AddServerSideBlazor(); - builder.Services.RegisterCommonLibrary(false, options => + builder.Services.RegisterCommonLibrary(true, options => { options.Applications = Applications.ExistingApplications; options.AdditionalAssemblies.Add(Assembly.GetAssembly(typeof(Program))); - options.AdditionalMenuEntries.AddRange(new List{ typeof(ApplicationMenu), typeof(ModelMenu), typeof(SessionMenu), typeof(ShowHideDeprecatedThings), typeof(AboutMenu)}); - }); - - builder.Services.AddScoped(_ => new HttpClient() - { - BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) + options.AdditionalMenuEntries.AddRange(new List { typeof(ApplicationMenu), typeof(ModelMenu), typeof(SessionMenu), typeof(ShowHideDeprecatedThings), typeof(AboutMenu) }); }); - RegisterServices(builder); - RegisterViewModels(builder); + builder.Services.RegisterServices(); + builder.Services.RegisterViewModels(); - var host = builder.Build(); - await host.Services.InitializeServices(); - await host.RunAsync(); - } + var app = builder.Build(); + app.UseStaticFiles(); + app.UseRouting(); + app.MapBlazorHub(); + app.MapFallbackToPage("/_Host"); - /// - /// Register all services required to run the application inside the - /// - /// The - public static void RegisterServices(WebAssemblyHostBuilder builder) - { - builder.Services.AddScoped(); - builder.Services.AddSingleton(); - builder.Services.AddSingleton(); - builder.Services.AddSingleton(); - builder.Services.AddSingleton(); - builder.Services.AddSingleton(); - builder.Services.AddSingleton(); - builder.Services.AddAntDesign(); - } - - /// - /// Register all view models required to run the application inside the - /// - /// The - public static void RegisterViewModels(WebAssemblyHostBuilder builder) - { - builder.Services.AddSingleton(); - builder.Services.AddTransient(); - builder.Services.AddTransient(); - builder.Services.AddTransient(); - builder.Services.AddTransient(); - builder.Services.AddTransient(); - builder.Services.AddTransient(); - builder.Services.AddTransient(); - builder.Services.AddTransient(); - builder.Services.AddTransient(); - builder.Services.AddTransient(); - builder.Services.AddTransient(); - builder.Services.AddTransient(); - builder.Services.AddTransient(); - builder.Services.AddTransient(); - builder.Services.AddTransient(); + await app.Services.InitializeServices(); + await app.RunAsync(); } } } diff --git a/COMETwebapp/Properties/launchSettings.json b/COMETwebapp/Properties/launchSettings.json index ab56c665..1204e0a3 100644 --- a/COMETwebapp/Properties/launchSettings.json +++ b/COMETwebapp/Properties/launchSettings.json @@ -8,23 +8,21 @@ } }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", + "http": { + "commandName": "Project", + "dotnetRunMessages": true, "launchBrowser": true, - "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", + "applicationUrl": "http://localhost:5136", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, - "COMETwebapp": { - "commandName": "Project", - "dotnetRunMessages": "true", + "IIS Express": { + "commandName": "IISExpress", "launchBrowser": true, - "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - }, - "applicationUrl": "https://localhost:5136" + } } } -} \ No newline at end of file +} diff --git a/COMETwebapp/_Imports.razor b/COMETwebapp/_Imports.razor index 9af0a01d..a658abe9 100644 --- a/COMETwebapp/_Imports.razor +++ b/COMETwebapp/_Imports.razor @@ -12,7 +12,6 @@ @using Microsoft.AspNetCore.Components.Routing @using Microsoft.AspNetCore.Components.Web @using Microsoft.AspNetCore.Components.Web.Virtualization -@using Microsoft.AspNetCore.Components.WebAssembly.Http @using Microsoft.AspNetCore.Components.Authorization @using Microsoft.JSInterop @using COMETwebapp diff --git a/COMETwebapp/appsettings.Development.json b/COMETwebapp/appsettings.Development.json new file mode 100644 index 00000000..b9091509 --- /dev/null +++ b/COMETwebapp/appsettings.Development.json @@ -0,0 +1,3 @@ +{ + "DetailedErrors": true +} diff --git a/COMETwebapp/appsettings.json b/COMETwebapp/appsettings.json new file mode 100644 index 00000000..0b634009 --- /dev/null +++ b/COMETwebapp/appsettings.json @@ -0,0 +1,11 @@ +{ + "AllowedHosts": "*", + "StringTablePath": "wwwroot/DefaultTextConfiguration.json", + "ServerConfiguration": { + "ServerAddress": "", + "BookInputConfiguration": { + "ShowName": true, + "ShowShortName": true + } + } +} diff --git a/COMETwebapp/nginx.conf b/COMETwebapp/nginx.conf deleted file mode 100644 index 787420c4..00000000 --- a/COMETwebapp/nginx.conf +++ /dev/null @@ -1,15 +0,0 @@ -events { } -http { - - include mime.types; - - server { - listen 80; - - location / { - add_header blazor-environment Production; - root /usr/share/nginx/html; - try_files $uri $uri/ /index.html =404; - } - } -} \ No newline at end of file diff --git a/COMETwebapp/wwwroot/DefaultTextConfiguration.json b/COMETwebapp/wwwroot/DefaultTextConfiguration.json new file mode 100644 index 00000000..4b39342b --- /dev/null +++ b/COMETwebapp/wwwroot/DefaultTextConfiguration.json @@ -0,0 +1,12 @@ +{ + "OpenEngineeringModelPlaceholder": "Select an Engineering Model", + "OpenIterationPlaceholder": "Select an Iteration", + "OpenDomainOfExpertisePlaceholder": "Select a Domain of Expertise", + "ModelTitleCaption": "Model", + "IterationTitleCaption": "Iteration", + "DomainTitleCaption": "Domain", + "LandingPageTitle": "", + "NavigationApplicationSelectorTitle": "Application", + "NavigationModelSelectorTitle": "Models", + "ModelOpenButtonCaption": "Open Model" +} diff --git a/COMETwebapp/wwwroot/index.html b/COMETwebapp/wwwroot/index.html deleted file mode 100644 index f76a344b..00000000 --- a/COMETwebapp/wwwroot/index.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - CDP4-COMET Community Edition - - - - - - - - - - - - - - -
- -
-
-
CDP4-COMET Community Edition
-
Loading...
-
-
- -
- An unhandled error has occurred. - Reload - �� -
- - - - - - - - - - - - - - - - diff --git a/CommonLibrary.DotSettings b/CommonLibrary.DotSettings new file mode 100644 index 00000000..cf31dfd4 --- /dev/null +++ b/CommonLibrary.DotSettings @@ -0,0 +1,26 @@ + + -------------------------------------------------------------------------------------------------------------------- + <copyright file="${File.FileName}" company="RHEA System S.A."> + Copyright (c) ${CurrentDate.Year} RHEA System S.A. + + Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Jaime Bernar, Théate Antoine + + This file is part of COMET WEB Community Edition + The COMET WEB Community Edition is the RHEA Web Application implementation of ECSS-E-TM-10-25 + Annex A and Annex C. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + </copyright> + -------------------------------------------------------------------------------------------------------------------- + True \ No newline at end of file diff --git a/WebAppHeader.DotSettings b/WebAppHeader.DotSettings new file mode 100644 index 00000000..de5cc1c5 --- /dev/null +++ b/WebAppHeader.DotSettings @@ -0,0 +1,25 @@ + + -------------------------------------------------------------------------------------------------------------------- + <copyright file="${File.FileName}" company="RHEA System S.A."> + Copyright (c) ${CurrentDate.Year} RHEA System S.A. + + Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Jaime Bernar, Théate Antoine + + This file is part of COMET WEB Community Edition + The COMET WEB Community Edition is the RHEA Web Application implementation of ECSS-E-TM-10-25 Annex A and Annex C. + + The COMET WEB Community Edition is free software; you can redistribute it and/or + modify it under the terms of the GNU Affero General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + The COMET WEB Community Edition is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + </copyright> + -------------------------------------------------------------------------------------------------------------------- + \ No newline at end of file From 4c60c07fee6df865284d5ae8600bcaa6fa52e161 Mon Sep 17 00:00:00 2001 From: antoineatrhea Date: Wed, 3 Jan 2024 10:30:20 +0100 Subject: [PATCH 2/3] test --- ...ServiceCollectionExtensionsTestFixtures.cs | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 COMETwebapp.Tests/Extensions/ServiceCollectionExtensionsTestFixtures.cs diff --git a/COMETwebapp.Tests/Extensions/ServiceCollectionExtensionsTestFixtures.cs b/COMETwebapp.Tests/Extensions/ServiceCollectionExtensionsTestFixtures.cs new file mode 100644 index 00000000..5ac98a09 --- /dev/null +++ b/COMETwebapp.Tests/Extensions/ServiceCollectionExtensionsTestFixtures.cs @@ -0,0 +1,50 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// Copyright (c) 2024 RHEA System S.A. +// +// Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Jaime Bernar, Théate Antoine +// +// This file is part of COMET WEB Community Edition +// The COMET WEB Community Edition is the RHEA Web Application implementation of ECSS-E-TM-10-25 Annex A and Annex C. +// +// The COMET WEB Community Edition is free software; you can redistribute it and/or +// modify it under the terms of the GNU Affero General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// The COMET WEB Community Edition is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace COMETwebapp.Tests.Extensions +{ + using COMETwebapp.Extensions; + + using Microsoft.Extensions.DependencyInjection; + + using Moq; + + using NUnit.Framework; + + [TestFixture] + public class ServiceCollectionExtensionsTestFixtures + { + [Test] + public void VerifyRegistration() + { + var serviceCollection = new Mock(); + + Assert.Multiple(() => + { + Assert.That(() => serviceCollection.Object.RegisterServices(), Throws.Nothing); + Assert.That(() => serviceCollection.Object.RegisterViewModels(), Throws.Nothing); + }); + } + } +} From 826e677dbdf623532883d118cfe12b56719f8056 Mon Sep 17 00:00:00 2001 From: antoineatrhea Date: Wed, 21 Feb 2024 13:37:17 +0100 Subject: [PATCH 3/3] Rebase and dotsettings update --- WebAppHeader.DotSettings | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/WebAppHeader.DotSettings b/WebAppHeader.DotSettings index de5cc1c5..68f9b441 100644 --- a/WebAppHeader.DotSettings +++ b/WebAppHeader.DotSettings @@ -22,4 +22,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. </copyright> -------------------------------------------------------------------------------------------------------------------- - \ No newline at end of file + + True \ No newline at end of file