From c1c39049bfd310519ea0d7784c07cbb63867cc6c Mon Sep 17 00:00:00 2001 From: Alex Vorobiev Date: Thu, 5 Nov 2020 13:58:21 +0100 Subject: [PATCH] Bumped version numbers to 6.2.2 (#150) * Bumped version numbers * Attempt to push again through appveyor * adjust configuration * Make relative paths for requests consistent --- CDP4Dal.NetCore.Tests/DAL/DalTestFixture.cs | 24 ++++++++++----------- CDP4Dal.Tests/DAL/DalTestFixture.cs | 24 ++++++++++----------- CDP4Dal/CDP4Dal.csproj | 4 ++-- CDP4Dal/DAL/Dal.cs | 7 ++++-- CDP4JsonFileDal/CDP4JsonFileDal.csproj | 7 ++---- CDP4ServicesDal/CDP4ServicesDal.csproj | 7 +++--- CDP4ServicesDal/CdpServicesDal.cs | 16 ++++++++++---- CDP4WspDal/CDP4WspDal.csproj | 9 ++++---- CDP4WspDal/WSPDal.cs | 12 ++++++++--- appveyor.yml | 15 +++++++++++-- 10 files changed, 74 insertions(+), 51 deletions(-) diff --git a/CDP4Dal.NetCore.Tests/DAL/DalTestFixture.cs b/CDP4Dal.NetCore.Tests/DAL/DalTestFixture.cs index 792a1f0b0..bbdad1ae8 100644 --- a/CDP4Dal.NetCore.Tests/DAL/DalTestFixture.cs +++ b/CDP4Dal.NetCore.Tests/DAL/DalTestFixture.cs @@ -98,31 +98,31 @@ public void Verify_That_UriBuilder_Constructs_Proper_Uris() var pathWithSlash = $"/{this.somePath}"; var correctFullUri = "http://someuri:80/SiteDirectory"; - Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, pathWithSlash).ToString()); - + Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, ref pathWithSlash).ToString()); + Assert.AreEqual(this.somePath, pathWithSlash); this.credentials = new Credentials("John", "Doe", new Uri("http://someURI/")); - Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, pathWithSlash).ToString()); + Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, ref pathWithSlash).ToString()); var pathWithoutSlash = $"{this.somePath}"; - Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, pathWithoutSlash).ToString()); + Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, ref pathWithoutSlash).ToString()); this.credentials = new Credentials("John", "Doe", new Uri("http://someURI/mdb/")); correctFullUri = "http://someuri:80/mdb/SiteDirectory"; - Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, pathWithoutSlash).ToString()); - Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, pathWithSlash).ToString()); + Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, ref pathWithoutSlash).ToString()); + Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, ref pathWithSlash).ToString()); this.credentials = new Credentials("John", "Doe", new Uri("http://someURI/mdb/a/b/c")); correctFullUri = "http://someuri:80/mdb/a/b/c/SiteDirectory"; - Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, pathWithoutSlash).ToString()); - Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, pathWithSlash).ToString()); + Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, ref pathWithoutSlash).ToString()); + Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, ref pathWithSlash).ToString()); this.credentials = new Credentials("John", "Doe", new Uri("http://someURI/mdb/a/b/c/")); - Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, pathWithoutSlash).ToString()); - Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, pathWithSlash).ToString()); + Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, ref pathWithoutSlash).ToString()); + Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, ref pathWithSlash).ToString()); } [Test] @@ -316,9 +316,9 @@ public string CleanPathSlashes(string path) return base.CleanPathStartingSlash(path); } - public UriBuilder GetBuilder(Uri uri, string path) + public UriBuilder GetBuilder(Uri uri, ref string path) { - return base.GetUriBuilder(uri, path); + return base.GetUriBuilder(uri, ref path); } internal void TestOperationContainerFileVerification(OperationContainer operationContainer, IEnumerable files) diff --git a/CDP4Dal.Tests/DAL/DalTestFixture.cs b/CDP4Dal.Tests/DAL/DalTestFixture.cs index 87c08713b..4970402d9 100644 --- a/CDP4Dal.Tests/DAL/DalTestFixture.cs +++ b/CDP4Dal.Tests/DAL/DalTestFixture.cs @@ -98,31 +98,31 @@ public void Verify_That_UriBuilder_Constructs_Proper_Uris() var pathWithSlash = $"/{this.somePath}"; var correctFullUri = "http://someuri:80/SiteDirectory"; - Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, pathWithSlash).ToString()); - + Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, ref pathWithSlash).ToString()); + Assert.AreEqual(this.somePath, pathWithSlash); this.credentials = new Credentials("John", "Doe", new Uri("http://someURI/")); - Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, pathWithSlash).ToString()); + Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, ref pathWithSlash).ToString()); var pathWithoutSlash = $"{this.somePath}"; - Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, pathWithoutSlash).ToString()); + Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, ref pathWithoutSlash).ToString()); this.credentials = new Credentials("John", "Doe", new Uri("http://someURI/mdb/")); correctFullUri = "http://someuri:80/mdb/SiteDirectory"; - Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, pathWithoutSlash).ToString()); - Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, pathWithSlash).ToString()); + Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, ref pathWithoutSlash).ToString()); + Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, ref pathWithSlash).ToString()); this.credentials = new Credentials("John", "Doe", new Uri("http://someURI/mdb/a/b/c")); correctFullUri = "http://someuri:80/mdb/a/b/c/SiteDirectory"; - Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, pathWithoutSlash).ToString()); - Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, pathWithSlash).ToString()); + Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, ref pathWithoutSlash).ToString()); + Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, ref pathWithSlash).ToString()); this.credentials = new Credentials("John", "Doe", new Uri("http://someURI/mdb/a/b/c/")); - Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, pathWithoutSlash).ToString()); - Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, pathWithSlash).ToString()); + Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, ref pathWithoutSlash).ToString()); + Assert.AreEqual(correctFullUri, dal.GetBuilder(this.credentials.Uri, ref pathWithSlash).ToString()); } [Test] @@ -316,9 +316,9 @@ public string CleanPathSlashes(string path) return base.CleanPathStartingSlash(path); } - public UriBuilder GetBuilder(Uri uri, string path) + public UriBuilder GetBuilder(Uri uri, ref string path) { - return base.GetUriBuilder(uri, path); + return base.GetUriBuilder(uri, ref path); } internal void TestOperationContainerFileVerification(OperationContainer operationContainer, IEnumerable files) diff --git a/CDP4Dal/CDP4Dal.csproj b/CDP4Dal/CDP4Dal.csproj index 65aa486c3..09853c542 100644 --- a/CDP4Dal/CDP4Dal.csproj +++ b/CDP4Dal/CDP4Dal.csproj @@ -4,7 +4,7 @@ net45;net451;net452;net46;net461;net462;net47;net471;net472;net48;netstandard2.0;netstandard2.1;netcoreapp3.1 RHEA System S.A. CDP4Dal Community Edition - 6.2.0 + 6.2.2 CDP4 Data Access Layer library, a consumer of an ECSS-E-TM-10-25 Annex C API Copyright © RHEA System S.A. Sam, Merlin, Alex, Naron, Alexander, Yevhen, Nathaniel, Kamil @@ -19,7 +19,7 @@ CDP CDP4 ECSS-E-TM-10-25 LGPL-3.0-only - [Update] to CDP4Common 6.2.0 + [Update] Uri handling diff --git a/CDP4Dal/DAL/Dal.cs b/CDP4Dal/DAL/Dal.cs index 58d40f15e..e1f2dae6e 100644 --- a/CDP4Dal/DAL/Dal.cs +++ b/CDP4Dal/DAL/Dal.cs @@ -290,12 +290,15 @@ protected string CleanPathStartingSlash(string path) /// subpaths in it already /// /// The base uri (including subpaths) - /// The path to be appended. + /// The ref to a path to be appended. /// A complete object. - protected UriBuilder GetUriBuilder(Uri uri, string path) + protected UriBuilder GetUriBuilder(Uri uri, ref string path) { var cleanPath = this.CleanPathStartingSlash(path); + // make sure the original request path is consistently WITHOUT leading slash + path = cleanPath; + var result = new UriBuilder(uri); result.Path = $"{result.Path}{(result.Path.EndsWith("/") ? string.Empty : "/")}{cleanPath}"; diff --git a/CDP4JsonFileDal/CDP4JsonFileDal.csproj b/CDP4JsonFileDal/CDP4JsonFileDal.csproj index 3d9ee7fe3..7b512d393 100644 --- a/CDP4JsonFileDal/CDP4JsonFileDal.csproj +++ b/CDP4JsonFileDal/CDP4JsonFileDal.csproj @@ -4,7 +4,7 @@ net45;net451;net452;net46;net461;net462;net47;net471;net472;net48;netstandard2.0;netstandard2.1;netcoreapp3.1 RHEA System S.A. CDP4JsonFileDal Community Edition - 6.2.0 + 6.2.2 CDP4 Json File Dal Plugin Copyright © RHEA System S.A. Sam, Merlin, Alex, Naron, Alexander, Yevhen, Nathaniel, Kamil @@ -19,10 +19,7 @@ CDP CDP4 ECSS-E-TM-10-25 LGPL-3.0-only - [Update] to CDP4Common 6.2.0 - [Update] to CDP4Dal 6.2.0 - [Update] DotNetZip 1.13.8 - [Fix] serialization of Person related objects; fixes #131 + [Update] to CDP4Dal 6.2.2 diff --git a/CDP4ServicesDal/CDP4ServicesDal.csproj b/CDP4ServicesDal/CDP4ServicesDal.csproj index 70480fa07..12d2b498e 100644 --- a/CDP4ServicesDal/CDP4ServicesDal.csproj +++ b/CDP4ServicesDal/CDP4ServicesDal.csproj @@ -4,7 +4,7 @@ net45;net451;net452;net46;net461;net462;net47;net471;net472;net48;netstandard2.0;netstandard2.1;netcoreapp3.1 RHEA System S.A. CDP4ServicesDal Community Edition - 6.2.0 + 6.2.2 CDP4ServicesDal Dal Plugin Copyright © RHEA System S.A. Sam, Merlin, Alex, Naron, Alexander, Yevhen, Nathaniel, Kamil @@ -19,9 +19,8 @@ CDP CDP4 ECSS-E-TM-10-25 LGPL-3.0-only - [Update] to CDP4Common 6.2.0; - [Update] to CDP4Dal 6.2.0 - [Update] to CDP4JsonSerializer 6.2.0 + [Update] to CDP4Dal 6.2.2 + [Fix] Uri handling diff --git a/CDP4ServicesDal/CdpServicesDal.cs b/CDP4ServicesDal/CdpServicesDal.cs index dba47aba3..5fc45a2f7 100644 --- a/CDP4ServicesDal/CdpServicesDal.cs +++ b/CDP4ServicesDal/CdpServicesDal.cs @@ -143,7 +143,9 @@ public override async Task> Write(OperationContainer operatio var postToken = operationContainer.Token; var resourcePath = $"{operationContainer.Context}{attribute}"; - var uriBuilder = this.GetUriBuilder(this.Credentials.Uri, resourcePath); + var uriBuilder = this.GetUriBuilder(this.Credentials.Uri, ref resourcePath); + + Logger.Debug("Resource Path {0}: {1}", postToken, resourcePath); Logger.Debug("CDP4 Services POST: {0} - {1}", postToken, uriBuilder); var requestContent = this.CreateHttpContent(postToken, operationContainer, files); @@ -279,7 +281,9 @@ public override async Task ReadFile(Thing thing, CancellationToken cance var resourcePath = $"{thingRoute}?includeFileData=true"; var readToken = CDP4Common.Helpers.TokenGenerator.GenerateRandomToken(); - var uriBuilder = this.GetUriBuilder(this.Credentials.Uri, resourcePath); + var uriBuilder = this.GetUriBuilder(this.Credentials.Uri, ref resourcePath); + + Logger.Debug("Resource Path {0}: {1}", readToken, resourcePath); Logger.Debug("CDP4Services GET {0}: {1}", readToken, uriBuilder); var requestsw = Stopwatch.StartNew(); @@ -362,7 +366,9 @@ public override async Task> Read(T thing, CancellationToke var resourcePath = $"{thingRoute}{attributes?.ToString()}"; var readToken = CDP4Common.Helpers.TokenGenerator.GenerateRandomToken(); - var uriBuilder = this.GetUriBuilder(this.Credentials.Uri, resourcePath); + var uriBuilder = this.GetUriBuilder(this.Credentials.Uri, ref resourcePath); + + Logger.Debug("Resource Path {0}: {1}", readToken, resourcePath); Logger.Debug("CDP4Services GET {0}: {1}", readToken, uriBuilder); var requestsw = Stopwatch.StartNew(); @@ -492,7 +498,9 @@ public override async Task> Open(Credentials credentials, Can var watch = Stopwatch.StartNew(); - var uriBuilder = this.GetUriBuilder(credentials.Uri, resourcePath); + var uriBuilder = this.GetUriBuilder(credentials.Uri, ref resourcePath); + + Logger.Debug("Resource Path {0}: {1}", openToken, resourcePath); Logger.Debug("CDP4Services Open {0}: {1}", openToken, uriBuilder); var requestsw = Stopwatch.StartNew(); diff --git a/CDP4WspDal/CDP4WspDal.csproj b/CDP4WspDal/CDP4WspDal.csproj index 54412e419..5ccdb8bc9 100644 --- a/CDP4WspDal/CDP4WspDal.csproj +++ b/CDP4WspDal/CDP4WspDal.csproj @@ -4,7 +4,7 @@ net45;net451;net452;net46;net461;net462;net47;net471;net472;net48;netstandard2.0;netstandard2.1;netcoreapp3.1 RHEA System S.A. CDP4WspDal Community Edition - 6.2.0 + 6.2.2 CDP4 WSP Dal Plugin Copyright © RHEA System S.A. Sam, Merlin, Alex, Naron, Alexander, Yevhen, Nathaniel, Kamil @@ -19,10 +19,9 @@ CDP CDP4 ECSS-E-TM-10-25 LGPL-3.0-only - [Update] to CDP4Common 6.2.0; - [Update] to CDP4Dal 6.2.0 - [Update] to CDP4JsonSerializer 6.2.0 - + [Update] to CDP4Dal 6.2.2 + [Fix] Uri handling + diff --git a/CDP4WspDal/WSPDal.cs b/CDP4WspDal/WSPDal.cs index 11da31dbd..336542de3 100644 --- a/CDP4WspDal/WSPDal.cs +++ b/CDP4WspDal/WSPDal.cs @@ -156,7 +156,9 @@ public override async Task> Write(OperationContainer operatio var postToken = operationContainer.Token; var resourcePath = $"{operationContainer.Context}{attribute}"; - var uriBuilder = this.GetUriBuilder(this.Credentials.Uri, resourcePath); + var uriBuilder = this.GetUriBuilder(this.Credentials.Uri, ref resourcePath); + + Logger.Debug("Resource Path {0}: {1}", postToken, resourcePath); Logger.Debug("WSP Dal POST: {0} - {1}", postToken, uriBuilder); var requestContent = this.CreateHttpContent(postToken, operationContainer, files); @@ -338,7 +340,9 @@ public override async Task> Read(T thing, CancellationToke var resourcePath = $"{thingRoute}{attributes.ToString()}"; var readToken = CDP4Common.Helpers.TokenGenerator.GenerateRandomToken(); - var uriBuilder = this.GetUriBuilder(this.Credentials.Uri, resourcePath); + var uriBuilder = this.GetUriBuilder(this.Credentials.Uri, ref resourcePath); + + Logger.Debug("Resource Path {0}: {1}", readToken, resourcePath); Logger.Debug("WSP GET {0}: {1}", readToken, uriBuilder); var requestsw = Stopwatch.StartNew(); @@ -464,7 +468,9 @@ public override async Task> Open(Credentials credentials, Can var watch = Stopwatch.StartNew(); - var uriBuilder = this.GetUriBuilder(credentials.Uri, resourcePath); + var uriBuilder = this.GetUriBuilder(credentials.Uri, ref resourcePath); + + Logger.Debug("Resource Path {0}: {1}", openToken, resourcePath); Logger.Debug("WSP Open {0}: {1}", openToken, uriBuilder); var requestsw = Stopwatch.StartNew(); diff --git a/appveyor.yml b/appveyor.yml index 9e5e93cb8..674a6404f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,6 +14,9 @@ environment: SONARCLOUD_TOKEN: secure: t9Adl8VvYx+PRNMC3aXmpSErjxmh/LaCV52WW1X/IxGgjkGYRTf7ZYcNs4s3Fqrt + GITHUB_TOKEN: + secure: uS7/WlBplrAs/j9ab9P3SUN7GZyf4QAHZX//YpDOzXG/DZ6o1MGHdIWLHHdDYM5P + skip_branch_with_pr: true for: @@ -59,8 +62,16 @@ build_script: - cmd: dotnet build CDP4-SDK-NETF.sln --configuration %CONFIGURATION% -v q --framework net45 - cmd: dotnet build CDP4-SDK-NETC.sln --configuration %CONFIGURATION% -v q --framework netcoreapp3.1 - ps: >- - Write-Host Building Nugets - dotnet pack CDP4-SDK-NETF.sln --configuration $env:CONFIGURATION -p:TargetFrameworks=net45 --no-build --include-symbols --version-suffix "$env:APPVEYOR_BUILD_NUMBER" + if ($env:APPVEYOR_PULL_REQUEST_NUMBER) { + Write-Host Building Nugets PR# $env:APPVEYOR_PULL_REQUEST_NUMBER + dotnet pack CDP4-SDK-NETF.sln --configuration $env:CONFIGURATION -p:TargetFrameworks=net45 --no-build --version-suffix "$env:APPVEYOR_BUILD_NUMBER-PR$env:APPVEYOR_PULL_REQUEST_NUMBER" + nuget sources add -name github -username RHEAGROUP -password $env:GITHUB_TOKEN -source https://nuget.pkg.github.com/RHEAGROUP/index.json + nuget setApiKey $env:GITHUB_TOKEN -Source "github" -Verbosity quiet + + Get-ChildItem -Path C:\projects\cdp4-sdk-community-edition\ -Filter *.nupkg -Recurse -File -Name| ForEach-Object { + nuget push $_ -Source "github" + } + } test_script: - >