From 0021f0976a77e9e86d1acb5766f4eb2e443c05c5 Mon Sep 17 00:00:00 2001 From: samatrhea Date: Sat, 2 Sep 2023 07:35:22 +0200 Subject: [PATCH] [Update] dependencies --- .../SySML2.NET.REST.Tests.csproj | 8 +- SysML2.NET.API/SysML2.NET.API.csproj | 2 +- .../SysML2.NET.CodeGenerator.Tests.csproj | 8 +- .../SysML2.NET.CodeGenerator.csproj | 4 +- .../SysML2.NET.Dal.Tests.csproj | 8 +- ...ML2.NET.Serializer.Dictionary.Tests.csproj | 8 +- .../SysML2.NET.Serializer.Json.Tests.csproj | 8 +- .../SysML2.NET.Serializer.Json.csproj | 2 +- .../CommitHistoryServiceTestFixture.cs | 127 ------------------ .../SysML2.NET.Viewer.Tests.csproj | 13 +- SysML2.NET.Viewer/Pages/ProjectDetails.razor | 13 +- .../Pages/ProjectDetails.razor.cs | 33 ----- SysML2.NET.Viewer/Program.cs | 3 - .../CommitHistory/CommitHistoryService.cs | 127 ------------------ .../CommitHistory/ICommitHistoryService.cs | 49 ------- SysML2.NET.Viewer/SysML2.NET.Viewer.csproj | 15 +-- SysML2.NET/SysML2.NET.csproj | 2 +- 17 files changed, 43 insertions(+), 387 deletions(-) delete mode 100644 SysML2.NET.Viewer.Tests/Services/CommitHistory/CommitHistoryServiceTestFixture.cs delete mode 100644 SysML2.NET.Viewer/Services/CommitHistory/CommitHistoryService.cs delete mode 100644 SysML2.NET.Viewer/Services/CommitHistory/ICommitHistoryService.cs diff --git a/SySML2.NET.REST.Tests/SySML2.NET.REST.Tests.csproj b/SySML2.NET.REST.Tests/SySML2.NET.REST.Tests.csproj index f75931e1..65602a02 100644 --- a/SySML2.NET.REST.Tests/SySML2.NET.REST.Tests.csproj +++ b/SySML2.NET.REST.Tests/SySML2.NET.REST.Tests.csproj @@ -19,16 +19,16 @@ - + - + - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/SysML2.NET.API/SysML2.NET.API.csproj b/SysML2.NET.API/SysML2.NET.API.csproj index fadc992a..534b2f1f 100644 --- a/SysML2.NET.API/SysML2.NET.API.csproj +++ b/SysML2.NET.API/SysML2.NET.API.csproj @@ -27,7 +27,7 @@ - + diff --git a/SysML2.NET.CodeGenerator.Tests/SysML2.NET.CodeGenerator.Tests.csproj b/SysML2.NET.CodeGenerator.Tests/SysML2.NET.CodeGenerator.Tests.csproj index a0c391f9..3f4f4304 100644 --- a/SysML2.NET.CodeGenerator.Tests/SysML2.NET.CodeGenerator.Tests.csproj +++ b/SysML2.NET.CodeGenerator.Tests/SysML2.NET.CodeGenerator.Tests.csproj @@ -351,16 +351,16 @@ - + - + - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/SysML2.NET.CodeGenerator/SysML2.NET.CodeGenerator.csproj b/SysML2.NET.CodeGenerator/SysML2.NET.CodeGenerator.csproj index 4738134e..c751ee76 100644 --- a/SysML2.NET.CodeGenerator/SysML2.NET.CodeGenerator.csproj +++ b/SysML2.NET.CodeGenerator/SysML2.NET.CodeGenerator.csproj @@ -23,8 +23,8 @@ - - + + diff --git a/SysML2.NET.Dal.Tests/SysML2.NET.Dal.Tests.csproj b/SysML2.NET.Dal.Tests/SysML2.NET.Dal.Tests.csproj index e32f2a7a..db40f524 100644 --- a/SysML2.NET.Dal.Tests/SysML2.NET.Dal.Tests.csproj +++ b/SysML2.NET.Dal.Tests/SysML2.NET.Dal.Tests.csproj @@ -19,16 +19,16 @@ - + - + - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/SysML2.NET.Serializer.Dictionary.Tests/SysML2.NET.Serializer.Dictionary.Tests.csproj b/SysML2.NET.Serializer.Dictionary.Tests/SysML2.NET.Serializer.Dictionary.Tests.csproj index 34002147..a78fbeb5 100644 --- a/SysML2.NET.Serializer.Dictionary.Tests/SysML2.NET.Serializer.Dictionary.Tests.csproj +++ b/SysML2.NET.Serializer.Dictionary.Tests/SysML2.NET.Serializer.Dictionary.Tests.csproj @@ -19,16 +19,16 @@ - + - + - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/SysML2.NET.Serializer.Json.Tests/SysML2.NET.Serializer.Json.Tests.csproj b/SysML2.NET.Serializer.Json.Tests/SysML2.NET.Serializer.Json.Tests.csproj index 224569b2..c0d6e410 100644 --- a/SysML2.NET.Serializer.Json.Tests/SysML2.NET.Serializer.Json.Tests.csproj +++ b/SysML2.NET.Serializer.Json.Tests/SysML2.NET.Serializer.Json.Tests.csproj @@ -19,16 +19,16 @@ - + - + - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/SysML2.NET.Serializer.Json/SysML2.NET.Serializer.Json.csproj b/SysML2.NET.Serializer.Json/SysML2.NET.Serializer.Json.csproj index b251c045..8ebafac4 100644 --- a/SysML2.NET.Serializer.Json/SysML2.NET.Serializer.Json.csproj +++ b/SysML2.NET.Serializer.Json/SysML2.NET.Serializer.Json.csproj @@ -25,7 +25,7 @@ - + diff --git a/SysML2.NET.Viewer.Tests/Services/CommitHistory/CommitHistoryServiceTestFixture.cs b/SysML2.NET.Viewer.Tests/Services/CommitHistory/CommitHistoryServiceTestFixture.cs deleted file mode 100644 index f3cac227..00000000 --- a/SysML2.NET.Viewer.Tests/Services/CommitHistory/CommitHistoryServiceTestFixture.cs +++ /dev/null @@ -1,127 +0,0 @@ -// ------------------------------------------------------------------------------------------------- -// -// -// Copyright 2022-2023 RHEA System S.A. -// -// 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 SysML2.NET.Viewer.Tests.Services.CommitHistory -{ - using System; - using System.Collections.Generic; - - using NUnit.Framework; - - using SysML2.NET.PIM.DTO; - - using SysML2.NET.Viewer.Services.CommitHistory; - - /// - /// Suite of tests for the - /// - [TestFixture] - public class CommitHistoryServiceTestFixture - { - private CommitHistoryService commitHistoryService; - - private Branch branch; - - private List commits; - - [SetUp] - public void SetUp() - { - this.commitHistoryService = new CommitHistoryService(); - - this.CreateTestData(); - } - - private void CreateTestData() - { - var projectId = Guid.NewGuid(); - - var head = new Commit - { - Id = Guid.NewGuid(), - OwningProject = projectId, - Description = "5" - }; - - - var commit_1 = new Commit - { - Id = Guid.NewGuid(), - OwningProject = projectId, - Description = "1" - }; - - var commit_2 = new Commit - { - Id = Guid.NewGuid(), - OwningProject = projectId, - Description = "2" - }; - - var commit_3 = new Commit - { - Id = Guid.NewGuid(), - OwningProject = projectId, - Description = "3" - }; - - var commit_4 = new Commit - { - Id = Guid.NewGuid(), - OwningProject = projectId, - Description = "4" - }; - - this.branch = new Branch - { - Id = Guid.NewGuid(), - Head = head.Id, - }; - - head.PreviousCommit = commit_4.Id; - commit_4.PreviousCommit = commit_3.Id; - commit_3.PreviousCommit = commit_2.Id; - commit_2.PreviousCommit = commit_1.Id; - - this.commits = new List(); - this.commits.Add(commit_2); - this.commits.Add(commit_4); - this.commits.Add(commit_1); - this.commits.Add(head); - this.commits.Add(commit_3); - this.commits.Add(new Commit() {Id = Guid.NewGuid()}); - this.commits.Add(new Commit() { Id = Guid.NewGuid() }); - } - - [Test] - public void Verify_that_expected_commit_history_is_returned() - { - var history = this.commitHistoryService.QueryCommitHistory(this.branch, this.commits); - - Assert.That(history.Length, Is.EqualTo(5)); - - Assert.That(history[0].Description, Is.EqualTo("5")); - Assert.That(history[1].Description, Is.EqualTo("4")); - Assert.That(history[2].Description, Is.EqualTo("3")); - Assert.That(history[3].Description, Is.EqualTo("2")); - Assert.That(history[4].Description, Is.EqualTo("1")); - } - } -} diff --git a/SysML2.NET.Viewer.Tests/SysML2.NET.Viewer.Tests.csproj b/SysML2.NET.Viewer.Tests/SysML2.NET.Viewer.Tests.csproj index 3fb4f760..953826f2 100644 --- a/SysML2.NET.Viewer.Tests/SysML2.NET.Viewer.Tests.csproj +++ b/SysML2.NET.Viewer.Tests/SysML2.NET.Viewer.Tests.csproj @@ -18,26 +18,25 @@ - + - - + + - + - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + all runtime; build; native; contentfiles; analyzers; buildtransitive - diff --git a/SysML2.NET.Viewer/Pages/ProjectDetails.razor b/SysML2.NET.Viewer/Pages/ProjectDetails.razor index 883be461..f15f5958 100644 --- a/SysML2.NET.Viewer/Pages/ProjectDetails.razor +++ b/SysML2.NET.Viewer/Pages/ProjectDetails.razor @@ -78,18 +78,14 @@ else - - + } diff --git a/SysML2.NET.Viewer/Pages/ProjectDetails.razor.cs b/SysML2.NET.Viewer/Pages/ProjectDetails.razor.cs index 0ad992ef..a884261d 100644 --- a/SysML2.NET.Viewer/Pages/ProjectDetails.razor.cs +++ b/SysML2.NET.Viewer/Pages/ProjectDetails.razor.cs @@ -33,8 +33,6 @@ namespace SysML2.NET.Viewer.Pages using SysML2.NET.PIM.DTO; using SySML2.NET.REST; - using SysML2.NET.Viewer.Services.CommitHistory; - /// /// Code-behind for the page /// @@ -69,11 +67,6 @@ public partial class ProjectDetails /// private IEnumerable commits; - /// - /// The history for the selected Branch - /// - private Commit[] commitHistory; - /// /// The s that are contained by the /// selected loaded from the SysML2 model server @@ -110,13 +103,6 @@ protected override async Task OnInitializedAsync() [Inject] public IRestClient RestClient { get; set; } - /// - /// Gets or sets the injected used to compute the - /// history of a - /// - [Inject] - public ICommitHistoryService CommitHistoryService { get; set; } - /// /// Load the data /// @@ -145,8 +131,6 @@ protected async Task LoadData() this.commits = await this.RestClient.RequestCommits(this.project.Id, null, null, cts.Token); this.tags = await this.RestClient.RequestTags(this.project.Id, null, null, cts.Token); - - this.commitHistory = this.CommitHistoryService.QueryCommitHistory(this.branches.Single(x => x.Id == this.selectedBranchId), this.commits); } catch (Exception e) { @@ -158,22 +142,5 @@ protected async Task LoadData() StateHasChanged(); } } - - /// - /// event handler for the change event of the branch combo-box - /// - /// - /// The identifier of the selected - /// - private void BranchSelectionChange(object value) - { - var identifier = value.ToString(); - - if (!string.IsNullOrEmpty(identifier)) - { - this.selectedBranchId = Guid.Parse(identifier); - this.commitHistory = this.CommitHistoryService.QueryCommitHistory(this.branches.Single(x => x.Id == this.selectedBranchId), this.commits); - } - } } } diff --git a/SysML2.NET.Viewer/Program.cs b/SysML2.NET.Viewer/Program.cs index a5ed4773..7690a64c 100644 --- a/SysML2.NET.Viewer/Program.cs +++ b/SysML2.NET.Viewer/Program.cs @@ -41,7 +41,6 @@ namespace SysML2.NET.Viewer using SySML2.NET.REST; using SysML2.NET.Serializer.Json; using SysML2.NET.Viewer.Services.Authentication; - using SysML2.NET.Viewer.Services.CommitHistory; /// /// The purpose of the class is to provide the @@ -101,8 +100,6 @@ private static void AddServices(WebAssemblyHostBuilder builder) builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); - - builder.Services.AddScoped(); } /// diff --git a/SysML2.NET.Viewer/Services/CommitHistory/CommitHistoryService.cs b/SysML2.NET.Viewer/Services/CommitHistory/CommitHistoryService.cs deleted file mode 100644 index dba9aeeb..00000000 --- a/SysML2.NET.Viewer/Services/CommitHistory/CommitHistoryService.cs +++ /dev/null @@ -1,127 +0,0 @@ -// ------------------------------------------------------------------------------------------------- -// -// -// Copyright 2022-2023 RHEA System S.A. -// -// 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 SysML2.NET.Viewer.Services.CommitHistory -{ - using System.Linq; - using System.Collections.Generic; - - using SysML2.NET.PIM.DTO; - - using Microsoft.Extensions.Logging; - using Microsoft.Extensions.Logging.Abstractions; - - /// - /// The purpose of the is to compute the - /// history of a branch - /// - public class CommitHistoryService : ICommitHistoryService - { - /// - /// The used to log - /// - private readonly ILogger logger; - - /// - /// Initializes a new instance of the class. - /// - /// - /// The (injected) used to setup logging - /// - public CommitHistoryService(ILoggerFactory loggerFactory = null) - { - this.logger = loggerFactory == null ? NullLogger.Instance : loggerFactory.CreateLogger(); - } - - /// - /// Queries the s that belong to a and - /// returns them in array ordered using the commit history - /// - /// - /// The owning of the s - /// - /// - /// A list of s - /// - /// - /// An array of where the s are returned in historical order - /// using the property. The latest commit (Head) is returned first. - /// - public Commit[] QueryCommitHistory(Branch branch, IEnumerable commits) - { - this.logger.LogDebug("Querying the Commit History"); - - var result = new List(); - - var head = commits.SingleOrDefault(x => x.Id == branch.Head); - - if (head == null) - { - this.logger.LogWarning("The head commit is missing from the Branch:{branch}", branch.Id); - } - - result.Add(head); - - var commitHistory = this.RecursivelyComputeCommitHistory(head, commits); - - result.AddRange(commitHistory); - - return result.ToArray(); - } - - /// - /// Recursively iterates through the to compute the historical - /// order using the property - /// - /// - /// The current for which the subsequent s are to be computed - /// - /// - /// The list of s on the basis of which history is to be computed - /// - /// - /// an s - /// - private IEnumerable RecursivelyComputeCommitHistory(Commit currentCommit, IEnumerable commits) - { - var result = new List(); - - if (currentCommit.PreviousCommit == null) - { - return result; - } - - var commitsRange = commits.ToList(); - - foreach (var commit in commits) - { - if (commit.Id == currentCommit.PreviousCommit) - { - result.Add(commit); - commitsRange.Remove(commit); - - result.AddRange(this.RecursivelyComputeCommitHistory(commit, commitsRange)); - } - } - - return result; - } - } -} diff --git a/SysML2.NET.Viewer/Services/CommitHistory/ICommitHistoryService.cs b/SysML2.NET.Viewer/Services/CommitHistory/ICommitHistoryService.cs deleted file mode 100644 index 50b3b752..00000000 --- a/SysML2.NET.Viewer/Services/CommitHistory/ICommitHistoryService.cs +++ /dev/null @@ -1,49 +0,0 @@ -// ------------------------------------------------------------------------------------------------- -// -// -// Copyright 2022-2023 RHEA System S.A. -// -// 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 SysML2.NET.Viewer.Services.CommitHistory -{ - using System.Collections.Generic; - - using SysML2.NET.PIM.DTO; - - /// - /// The purpose of the is to compute the - /// history of a branch - /// - public interface ICommitHistoryService - { - /// - /// Queries the s that belong to a and - /// returns them in array ordered using the commit history - /// - /// - /// The owning of the s - /// - /// - /// A list of s - /// - /// - /// An array of where the s are returned in historical order - /// using the property. The latest commit (Head) is returned first. - /// - Commit[] QueryCommitHistory(Branch branch, IEnumerable commits); - } -} diff --git a/SysML2.NET.Viewer/SysML2.NET.Viewer.csproj b/SysML2.NET.Viewer/SysML2.NET.Viewer.csproj index 649dea4b..ab1e1d4c 100644 --- a/SysML2.NET.Viewer/SysML2.NET.Viewer.csproj +++ b/SysML2.NET.Viewer/SysML2.NET.Viewer.csproj @@ -17,19 +17,18 @@ - - - - - + + + + + - - + + - diff --git a/SysML2.NET/SysML2.NET.csproj b/SysML2.NET/SysML2.NET.csproj index 8165451d..e503300e 100644 --- a/SysML2.NET/SysML2.NET.csproj +++ b/SysML2.NET/SysML2.NET.csproj @@ -24,7 +24,7 @@ - +