From 0be0dd7b9b4ac42839853110d3942ac463900578 Mon Sep 17 00:00:00 2001 From: Patrick Assuied Date: Sat, 6 Jul 2019 23:57:37 -0700 Subject: [PATCH 1/5] Implement NuGet V2 Feed support --- CHANGELOG.md | 3 + .../Feeds/Web/NuGetV2ServiceFeed.cs | 203 +++++ .../ExportedNuGetV2ServiceFeedFactory.cs | 19 + src/ProjectFileTools/ProjectFileTools.csproj | 1 + .../source.extension.vsixmanifest | 2 +- .../NuGetV2ServiceFeedTests.cs | 116 +++ .../ProjectFileTools.NuGetSearch.Tests.csproj | 11 +- .../GetPackageInfo.CommonLogging.xml | 47 ++ .../GetPackageNames.CommonLogging.xml | 753 ++++++++++++++++++ .../GetPackageVersions.CommonLogging.xml | 384 +++++++++ .../UnitTest1.cs | 6 +- 11 files changed, 1536 insertions(+), 9 deletions(-) create mode 100644 src/ProjectFileTools.NuGetSearch/Feeds/Web/NuGetV2ServiceFeed.cs create mode 100644 src/ProjectFileTools/Exports/ExportedNuGetV2ServiceFeedFactory.cs create mode 100644 test/ProjectFileTools.NuGetSearch.Tests/NuGetV2ServiceFeedTests.cs create mode 100644 test/ProjectFileTools.NuGetSearch.Tests/TestFiles/GetPackageInfo.CommonLogging.xml create mode 100644 test/ProjectFileTools.NuGetSearch.Tests/TestFiles/GetPackageNames.CommonLogging.xml create mode 100644 test/ProjectFileTools.NuGetSearch.Tests/TestFiles/GetPackageVersions.CommonLogging.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index 1794a61..c18466f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ download in the These are the changes to each version that has been released on the official Visual Studio extension gallery. +## 1.4 +- [x] Implement NuGet V2 Feed support + ## 1.1 - [x] Go To Definition (F12) for MSBuild imports diff --git a/src/ProjectFileTools.NuGetSearch/Feeds/Web/NuGetV2ServiceFeed.cs b/src/ProjectFileTools.NuGetSearch/Feeds/Web/NuGetV2ServiceFeed.cs new file mode 100644 index 0000000..60701fc --- /dev/null +++ b/src/ProjectFileTools.NuGetSearch/Feeds/Web/NuGetV2ServiceFeed.cs @@ -0,0 +1,203 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using System.Xml.Linq; +using Newtonsoft.Json.Linq; +using ProjectFileTools.NuGetSearch.Contracts; +using ProjectFileTools.NuGetSearch.IO; +using ProjectFileTools.NuGetSearch.Search; + +namespace ProjectFileTools.NuGetSearch.Feeds.Web +{ + public class NuGetV2ServiceFeedFactory : IPackageFeedFactory + { + private readonly IWebRequestFactory _webRequestFactory; + + public NuGetV2ServiceFeedFactory(IWebRequestFactory webRequestFactory) + { + _webRequestFactory = webRequestFactory; + } + + public bool TryHandle(string feed, out IPackageFeed instance) + { + if (Uri.TryCreate(feed, UriKind.Absolute, out Uri location) && feed.EndsWith("nuget", StringComparison.OrdinalIgnoreCase)) + { + instance = new NuGetV2ServiceFeed(feed, _webRequestFactory); + return true; + } + + instance = null; + return false; + } + } + + public class NuGetV2ServiceFeed : IPackageFeed + { + private readonly string _feed; + private readonly FeedKind _kind; + private readonly IWebRequestFactory _webRequestFactory; + + public NuGetV2ServiceFeed(string feed, IWebRequestFactory webRequestFactory) + { + _webRequestFactory = webRequestFactory; + _feed = feed; + _kind = feed.IndexOf("nuget.org", StringComparison.OrdinalIgnoreCase) > -1 ? FeedKind.NuGet : FeedKind.MyGet; + } + + public string DisplayName => $"{_feed} (NuGet v2)"; + + private async Task ExecuteAutocompleteServiceQueryAsync(IEnumerable endpoints, Func query, CancellationToken cancellationToken) + { + if (endpoints == null) + { + return null; + } + + for (int i = 0; i < endpoints.Count(); ++i) + { + string endpoint = endpoints.First(); + + try + { + string location = query(endpoint); + var xml = await _webRequestFactory.GetStringAsync(location, cancellationToken).ConfigureAwait(false); + return XDocument.Parse(xml); + } + catch (Exception) + { + //TODO: Possibly log the failure to get the document + } + } + + return null; + } + + public async Task GetPackageNamesAsync(string prefix, IPackageQueryConfiguration queryConfiguration, CancellationToken cancellationToken) + { + if (cancellationToken.IsCancellationRequested) + { + return PackageNameSearchResult.Failure; + } + + IReadOnlyList results = new List(); + string frameworkQuery = !string.IsNullOrEmpty(queryConfiguration.CompatibiltyTarget) ? $"&targetFramework={queryConfiguration.CompatibiltyTarget}" : ""; + var serviceEndpoints = new[] { $"{_feed}/Search()" }; + Func queryFunc = x => $"{x}?searchTerm={prefix}{frameworkQuery}&includePrerelease={queryConfiguration.IncludePreRelease}"; + XDocument document = await ExecuteAutocompleteServiceQueryAsync(serviceEndpoints, queryFunc, cancellationToken).ConfigureAwait(false); + + if (document != null) + { + try + { + results = GetPackageNamesFromNuGetV2CompatibleQueryResult(document); + return new PackageNameSearchResult(results, _kind); + } + catch + { + } + } + + return PackageNameSearchResult.Failure; + } + + public async Task GetPackageInfoAsync(string packageId, string version, IPackageQueryConfiguration queryConfiguration, CancellationToken cancellationToken) + { + if (packageId == null) + { + return null; + } + + var serviceEndpoints = new[] { $"{_feed}/Packages(Id='{packageId}',Version='{version}')" }; + Func queryFunc = x => $"{x}"; + XDocument document = await ExecuteAutocompleteServiceQueryAsync(serviceEndpoints, queryFunc, cancellationToken).ConfigureAwait(false); + + if (document != null) + { + var el = document.Root; + + var id = GetPropertyValue(document, el, "Id"); + var title = GetPropertyValue(document, el, "Title"); + var authors = GetPropertyValue(document, el, "Authors"); + var summary = GetPropertyValue(document, el, "Summary"); + var description = GetPropertyValue(document, el, "Description"); + var projectUrl = GetPropertyValue(document, el, "ProjectUrl"); + var licenseUrl = GetPropertyValue(document, el, "LicenseUrl"); + var iconUrl = GetPropertyValue(document, el, "IconUrl"); + var tags = GetPropertyValue(document, el, "Tags"); + var packageInfo = new PackageInfo(id, version, title, authors, summary, description, licenseUrl, projectUrl, iconUrl, tags, _kind); + return packageInfo; + } + + + return null; + } + + private static string GetPropertyValue(XDocument document, XElement el, string propertyKey) + { + return el + .Element(document.Root.GetNamespaceOfPrefix("m") + "properties") + .Element(document.Root.GetNamespaceOfPrefix("d") + propertyKey) + ?.Value; + } + + public async Task GetPackageVersionsAsync(string id, IPackageQueryConfiguration queryConfiguration, CancellationToken cancellationToken) + { + IReadOnlyList results = new List(); + var serviceEndpoints = new[] { $"{_feed}/FindPackagesById()" }; + Func queryFunc = x => $"{x}?id='{id}'"; + XDocument document = await ExecuteAutocompleteServiceQueryAsync(serviceEndpoints, queryFunc, cancellationToken).ConfigureAwait(false); + + try + { + results = GetPackageVersionsFromNuGetV2CompatibleQueryResult(id, document); + } + catch + { + return PackageVersionSearchResult.Failure; + } + + return new PackageVersionSearchResult(results, _kind); + } + + private static IReadOnlyList GetPackageVersionsFromNuGetV2CompatibleQueryResult(string id, XDocument document) + { + List results = new List(); + + if (document != null) + { + foreach (var el in document.Root.Elements(document.Root.GetDefaultNamespace() + "entry")) + { + var pkgId = GetPropertyValue(document, el, "Id"); + + var pkgVersion = GetPropertyValue(document, el, "Version"); + + if (pkgId.Equals(pkgId, StringComparison.OrdinalIgnoreCase)) + { + results.Add(pkgVersion); + } + } + } + + return results.AsReadOnly(); + } + + private static IReadOnlyList GetPackageNamesFromNuGetV2CompatibleQueryResult(XDocument document) + { + List results = new List(); + + if (document != null) + { + foreach (var el in document.Root.Elements(document.Root.GetDefaultNamespace() +"entry")) + { + var id = GetPropertyValue(document, el, "Id"); + + results.Add(id); + } + } + + return results.Distinct().ToList().AsReadOnly(); + } + } +} diff --git a/src/ProjectFileTools/Exports/ExportedNuGetV2ServiceFeedFactory.cs b/src/ProjectFileTools/Exports/ExportedNuGetV2ServiceFeedFactory.cs new file mode 100644 index 0000000..03e7d79 --- /dev/null +++ b/src/ProjectFileTools/Exports/ExportedNuGetV2ServiceFeedFactory.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.Composition; +using Microsoft.VisualStudio.Utilities; +using ProjectFileTools.NuGetSearch.Contracts; +using ProjectFileTools.NuGetSearch.Feeds.Web; +using ProjectFileTools.NuGetSearch.IO; + +namespace ProjectFileTools.Exports +{ + [Export(typeof(IPackageFeedFactory))] + [Name("Default NuGet v2 Service Feed Factory")] + internal class ExportedNuGetV2ServiceFeedFactory : NuGetV2ServiceFeedFactory + { + [ImportingConstructor] + public ExportedNuGetV2ServiceFeedFactory(IWebRequestFactory webRequestFactory) + : base(webRequestFactory) + { + } + } +} diff --git a/src/ProjectFileTools/ProjectFileTools.csproj b/src/ProjectFileTools/ProjectFileTools.csproj index f8302d5..d64dfab 100644 --- a/src/ProjectFileTools/ProjectFileTools.csproj +++ b/src/ProjectFileTools/ProjectFileTools.csproj @@ -49,6 +49,7 @@ 4 + diff --git a/src/ProjectFileTools/source.extension.vsixmanifest b/src/ProjectFileTools/source.extension.vsixmanifest index 1479281..87f3867 100644 --- a/src/ProjectFileTools/source.extension.vsixmanifest +++ b/src/ProjectFileTools/source.extension.vsixmanifest @@ -10,7 +10,7 @@ project, csproj, vbproj - + diff --git a/test/ProjectFileTools.NuGetSearch.Tests/NuGetV2ServiceFeedTests.cs b/test/ProjectFileTools.NuGetSearch.Tests/NuGetV2ServiceFeedTests.cs new file mode 100644 index 0000000..c4cad04 --- /dev/null +++ b/test/ProjectFileTools.NuGetSearch.Tests/NuGetV2ServiceFeedTests.cs @@ -0,0 +1,116 @@ +using FluentAssertions; +using Moq; +using ProjectFileTools.NuGetSearch.Feeds; +using ProjectFileTools.NuGetSearch.Feeds.Web; +using ProjectFileTools.NuGetSearch.IO; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Xunit; + +namespace ProjectFileTools.NuGetSearch.Tests +{ + /// + /// The tests below only work when signing is disabled. + /// When signing enabled, no test will be found as a result of `ProjectFileTools.NuGetSearch` failing to load with signing key validation error + /// + public class NuGetV2ServiceFeedTests + { + + public class TheDisplayNameProperty + { + + [Theory] + [InlineData("http://localhost/nuget")] + public void GivenFeed_ReturnDisplayName(string feed) + { + var webRequestFactory = Mock.Of(); + var sut = new NuGetV2ServiceFeed(feed, webRequestFactory); + sut.DisplayName.Should().Be($"{feed} (NuGet v2)"); + } + } + + public class TheGetPackageNamesAsyncMethod + { + [Theory] + [InlineData("http://localhost/nuget", "GetPackageNames.CommonLogging.xml")] + public async Task GivenPackagesFound_ReturnListOfIds(string feed, string testFile) + { + var webRequestFactory = Mock.Of(); + + Mock.Get(webRequestFactory) + .Setup(f => f.GetStringAsync("http://localhost/nuget/Search()?searchTerm=Common.Logging&targetFramework=netcoreapp2.0&includePrerelease=False", It.IsAny())) + .Returns(Task.FromResult(GetXmlFromTestFile(testFile))); + + var sut = new NuGetV2ServiceFeed(feed, webRequestFactory); + + var packageNameResults = await sut.GetPackageNamesAsync("Common.Logging", new PackageQueryConfiguration("netcoreapp2.0", false), new CancellationToken()); + packageNameResults.Names.Count.Should().Be(5); + } + } + + public class TheGetPackageVersionsAsyncMethod + { + [Theory] + [InlineData("http://localhost/nuget", "GetPackageVersions.CommonLogging.xml")] + public async Task GivenPackagesFound_ReturnListOfVersions(string feed, string testFile) + { + var webRequestFactory = Mock.Of(); + + Mock.Get(webRequestFactory) + .Setup(f => f.GetStringAsync("http://localhost/nuget/FindPackagesById()?id='Acme.Common.Logging.AspNetCore'", It.IsAny())) + .Returns(Task.FromResult(GetXmlFromTestFile(testFile))); + + var sut = new NuGetV2ServiceFeed(feed, webRequestFactory); + + var packageNameResults = await sut.GetPackageVersionsAsync("Acme.Common.Logging.AspNetCore", new PackageQueryConfiguration("netcoreapp2.0", false), new CancellationToken()); + packageNameResults.Versions.Count.Should().Be(8); + Assert.Collection(packageNameResults.Versions, + v => v.Should().Be("1.6.0.5"), + v => v.Should().Be("1.6.1"), + v => v.Should().Be("1.6.2"), + v => v.Should().Be("1.7.0"), + v => v.Should().Be("1.7.1"), + v => v.Should().Be("1.8.0"), + v => v.Should().Be("1.9.0"), + v => v.Should().Be("1.9.1")); + } + } + + public class TheGetPackageInfoAsyncMethod + { + [Theory] + [InlineData("http://localhost/nuget", "GetPackageInfo.CommonLogging.xml")] + public async Task GivenPackageFound_ReturnPackageInfo(string feed, string testFile) + { + var webRequestFactory = Mock.Of(); + + Mock.Get(webRequestFactory) + .Setup(f => f.GetStringAsync("http://localhost/nuget/Packages(Id='Acme.Common.Logging.AspNetCore',Version='1.8.0')", It.IsAny())) + .Returns(Task.FromResult(GetXmlFromTestFile(testFile))); + + var sut = new NuGetV2ServiceFeed(feed, webRequestFactory); + + var pkgInfo = await sut.GetPackageInfoAsync("Acme.Common.Logging.AspNetCore", "1.8.0", new PackageQueryConfiguration("netcoreapp2.0", false), new CancellationToken()); + + pkgInfo.Id.Should().Be("Acme.Common.Logging.AspNetCore"); + pkgInfo.Title.Should().Be("Common Logging AspNetCore"); + pkgInfo.Summary.Should().BeNullOrEmpty(); + pkgInfo.Description.Should().Be("Common Logging integration within Aspnet core services"); + pkgInfo.Authors.Should().Be("Patrick Assuied"); + pkgInfo.Version.Should().Be("1.8.0"); + pkgInfo.ProjectUrl.Should().Be("https://bitbucket.acme.com/projects/Acme/repos/Acme-common-logging"); + pkgInfo.LicenseUrl.Should().BeNullOrEmpty(); + pkgInfo.Tags.Should().Be(" common logging aspnetcore "); + + + } + } + + public static string GetXmlFromTestFile(string filename) + { + string path = Path.Combine(Directory.GetCurrentDirectory(), $"../../test/ProjectFileTools.NuGetSearch.Tests/TestFiles/{filename}"); + return File.ReadAllText(path); + } + } +} diff --git a/test/ProjectFileTools.NuGetSearch.Tests/ProjectFileTools.NuGetSearch.Tests.csproj b/test/ProjectFileTools.NuGetSearch.Tests/ProjectFileTools.NuGetSearch.Tests.csproj index dc4b922..dc3c7fc 100644 --- a/test/ProjectFileTools.NuGetSearch.Tests/ProjectFileTools.NuGetSearch.Tests.csproj +++ b/test/ProjectFileTools.NuGetSearch.Tests/ProjectFileTools.NuGetSearch.Tests.csproj @@ -5,11 +5,12 @@ - - - - - + + + + + + diff --git a/test/ProjectFileTools.NuGetSearch.Tests/TestFiles/GetPackageInfo.CommonLogging.xml b/test/ProjectFileTools.NuGetSearch.Tests/TestFiles/GetPackageInfo.CommonLogging.xml new file mode 100644 index 0000000..a74c6a4 --- /dev/null +++ b/test/ProjectFileTools.NuGetSearch.Tests/TestFiles/GetPackageInfo.CommonLogging.xml @@ -0,0 +1,47 @@ + + + http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.AspNetCore',Version='1.8.0') + + + + Acme.Common.Logging.AspNetCore + 2018-11-21T17:31:07Z + 2018-11-21T17:31:07Z + + Patrick Assuied + + + + + Acme.Common.Logging.AspNetCore + 1.8.0 + 1.8.0 + false + Common Logging AspNetCore + Patrick Assuied + Patrick Assuied + + + https://bitbucket.acme.com/projects/Acme/repos/Acme-common-logging + -1 + false + false + Common Logging integration within Aspnet core services + + ## Available in CHANGELOG.md + 2018-11-21T17:31:07.1944763Z + 2018-11-21T17:31:07.1944763Z + Acme.Common.Logging.Configuration:1.8.0:netcoreapp2.0|Microsoft.AspNetCore.Diagnostics:2.0.3:netcoreapp2.0|NLog.Web.AspNetCore:4.5.4:netcoreapp2.0|SourceLink.Copy.PdbFiles:2.8.3:netcoreapp2.0|SourceLink.Create.CommandLine:2.8.3:netcoreapp2.0|Acme.Common.Logging.Configuration:1.8.0:netcoreapp2.1|Microsoft.AspNetCore.Diagnostics:2.1.1:netcoreapp2.1|NLog.Web.AspNetCore:4.5.4:netcoreapp2.1|SourceLink.Copy.PdbFiles:2.8.3:netcoreapp2.1|SourceLink.Create.CommandLine:2.8.3:netcoreapp2.1 + KP5xJayLLtWJx59wz6rSHW8tvxNY4xp/3eCsqG2QF7wINphpXs+0k2rKLigMWq/6geWptbdXXjJdZXYJUG0EUQ== + SHA512 + 22002 + Copyright 2016-2018 + common logging aspnetcore + false + false + true + -1 + + + + \ No newline at end of file diff --git a/test/ProjectFileTools.NuGetSearch.Tests/TestFiles/GetPackageNames.CommonLogging.xml b/test/ProjectFileTools.NuGetSearch.Tests/TestFiles/GetPackageNames.CommonLogging.xml new file mode 100644 index 0000000..71370d1 --- /dev/null +++ b/test/ProjectFileTools.NuGetSearch.Tests/TestFiles/GetPackageNames.CommonLogging.xml @@ -0,0 +1,753 @@ + + + http://schemas.datacontract.org/2004/07/ + + <updated>2019-07-07T04:48:53Z</updated> + <link rel="self" href="http://localhost/Nuget/nuget/Packages" /> + <entry> + <id>http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.AspNetCore',Version='1.6.0.5')</id> + <category term="NuGet.Server.Core.DataServices.ODataPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> + <link rel="edit" href="http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.AspNetCore',Version='1.6.0.5')" /> + <link rel="self" href="http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.AspNetCore',Version='1.6.0.5')" /> + <title type="text">Acme.Common.Logging.AspNetCore + 2018-04-09T19:12:53Z + 2018-04-09T19:12:53Z + + Patrick Assuied + + + + + Acme.Common.Logging.AspNetCore + 1.6.0.5 + 1.6.0.5 + false + Common Logging AspNetCore + Patrick Assuied + Patrick Assuied + + + https://bitbucket.Acme.com/projects/Acme/repos/Acme-common-logging + -1 + false + false + Common Logging integration within Aspnet core services + + + ## 1.6.0 + - Support for .NET core + + 2018-04-09T19:12:53.6418356Z + 2018-04-09T19:12:53.6418356Z + Acme.Common.Logging.Configuration:1.6.0.5:netcoreapp2.0|Microsoft.AspNetCore.Diagnostics:2.0.2:netcoreapp2.0|NLog.Web.AspNetCore:4.5.1:netcoreapp2.0 + zclx15xLnnUxm63+IqBWUNCYWAYcHvumBD1CbsXuSpdame0fHPcfv9FlMRodIOHUF9q/yXqkGo/AQTRlMAa88Q== + SHA512 + 11395 + Copyright 2016-2018 + common logging aspnetcore + false + false + true + -1 + + + + + + http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.AspNetCore',Version='1.6.1') + + + + Acme.Common.Logging.AspNetCore + 2018-05-04T21:45:54Z + 2018-05-04T21:45:54Z + + Patrick Assuied + + + + + Acme.Common.Logging.AspNetCore + 1.6.1 + 1.6.1 + false + Common Logging AspNetCore + Patrick Assuied + Patrick Assuied + + + https://bitbucket.Acme.com/projects/Acme/repos/Acme-common-logging + -1 + false + false + Common Logging integration within Aspnet core services + + + ## 1.6.0 + - Support for .NET core + + 2018-05-04T21:45:54.0222438Z + 2018-05-04T21:45:54.0222438Z + Acme.Common.Logging.Configuration:1.6.1:netcoreapp2.0|Microsoft.AspNetCore.Diagnostics:2.0.2:netcoreapp2.0|NLog.Web.AspNetCore:4.5.1:netcoreapp2.0 + 7uBobOiTDhyz6s4P1Fnzgh1PokLYXU7G5E7nHDIpeCoj1B/f/augtWBBcqpuxv+hyDnGsVtyOxxPqso1Jhk1yw== + SHA512 + 11399 + Copyright 2016-2018 + common logging aspnetcore + false + false + true + -1 + + + + + + http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.Configuration',Version='1.1.2.0') + + + + Acme.Common.Logging.Configuration + 2016-11-16T04:09:55Z + 2016-11-16T04:09:55Z + + Acme OnDemand, Inc. + + + + + Acme.Common.Logging.Configuration + 1.1.2.0 + 1.1.2 + false + Acme Common Logging Configuration + Acme OnDemand, Inc. + Acme OnDemand, Inc. + + + https://wiki.Acmeondemand.com/display/PLAT/Acme.Common.Logging + -1 + false + false + Common Logging Configuration + + + 2016-11-16T04:09:55.6754695Z + 2016-11-16T04:09:55.6754695Z + Common.Logging.NLog41:3.3.1|Microsoft.AspNet.WebApi.Core:5.2.3 + Cu8qd2sESppuG4hEc3Etlum0S82vhTmDDaLqKHwMfGWuz57sGZkiQyARLEvIDL96eAb4szOslpAYxAhUApuapQ== + SHA512 + 16428 + Copyright 2016 + common logging configuration + false + false + true + -1 + + + + + + http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.Configuration',Version='1.1.3.0') + + + + Acme.Common.Logging.Configuration + 2016-12-12T18:26:29Z + 2016-12-12T18:26:29Z + + Acme OnDemand, Inc. + + + + + Acme.Common.Logging.Configuration + 1.1.3.0 + 1.1.3 + false + Acme Common Logging Configuration + Acme OnDemand, Inc. + Acme OnDemand, Inc. + + + https://wiki.Acmeondemand.com/display/PLAT/Acme.Common.Logging + -1 + false + false + Common Logging Configuration + + + 2016-12-12T18:26:29.8353212Z + 2016-12-12T18:26:29.8353212Z + Common.Logging.NLog41:3.3.1|Microsoft.AspNet.WebApi.Core:5.2.3 + +Jtb8P8swXBxC8HBqViEyp/0N3+fwoMCPbcTWHeUPOnA93/5P7EopkShQ0XudRK2cMa1LiZf/9AW7HFkNstpqg== + SHA512 + 17319 + Copyright 2016 + common logging configuration + false + false + true + -1 + + + + + + http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.Configuration',Version='1.1.3.2') + + + + Acme.Common.Logging.Configuration + 2016-12-29T06:29:44Z + 2016-12-29T06:29:44Z + + Acme OnDemand, Inc. + + + + + Acme.Common.Logging.Configuration + 1.1.3.2 + 1.1.3.2 + false + Acme Common Logging Configuration + Acme OnDemand, Inc. + Acme OnDemand, Inc. + + + https://wiki.Acmeondemand.com/display/PLAT/Acme.Common.Logging + -1 + false + false + Common Logging Configuration + + + 2016-12-29T06:29:44.4691432Z + 2016-12-29T06:29:44.4701478Z + Common.Logging.NLog41:3.3.1|Acme.Configuration:1.0.1.0|Microsoft.AspNet.WebApi.Core:5.2.3 + N0r+Kg3T294d7uvAP5THOTZcPpuGD30GEev1HGuWXj5eqGH+APRFGvMppfOvyYTcjJfh8HJM8t2hvfXEnJbe8w== + SHA512 + 38607 + Copyright 2016 + common logging configuration + false + false + true + -1 + + + + + + http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.Context.Autofac',Version='1.0.0.2') + + + + Acme.Common.Logging.Context.Autofac + 2016-11-16T04:09:55Z + 2016-11-16T04:09:55Z + + Acme OnDemand, Inc. + + + + + Acme.Common.Logging.Context.Autofac + 1.0.0.2 + 1.0.0.2 + false + Acme Common Logging Platform Context Autofac integration + Acme OnDemand, Inc. + Acme OnDemand, Inc. + + + + -1 + false + false + Common Logging integration with Platform Context using Autofac + + + 2016-11-16T04:09:55.6874701Z + 2016-11-16T04:09:55.6874701Z + Autofac:3.5.2|Common.Logging.NLog41:3.3.1|Acme.Platform.Context.Serialization:1.0.3.0|Acme.Common.Logging.Configuration:1.0.0.2 + xBSkrpuRVaN4VE6jG1bzrJduetp/ErZm0M5/jEdoAIERLdwN4coAJw2AC5YITxgYUFiVea2RnIBfHk17Qjs6AA== + SHA512 + 9482 + Copyright 2016 + common logging platform context autofac + false + false + true + -1 + + + + + + http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.Context.Autofac',Version='1.0.1.0') + + + + Acme.Common.Logging.Context.Autofac + 2016-11-16T04:09:55Z + 2016-11-16T04:09:55Z + + Acme OnDemand, Inc. + + + + + Acme.Common.Logging.Context.Autofac + 1.0.1.0 + 1.0.1 + false + Acme Common Logging Platform Context Autofac integration + Acme OnDemand, Inc. + Acme OnDemand, Inc. + + + + -1 + false + false + Common Logging integration with Platform Context using Autofac + + + 2016-11-16T04:09:55.6984711Z + 2016-11-16T04:09:55.6984711Z + Autofac:3.5.2|Common.Logging.NLog41:3.3.1|Acme.Platform.Context.Serialization:1.0.3.0|Acme.Common.Logging.Configuration:1.0.1.0 + Q2UiaZF1NLAiRA/pBDZmjock5Rmf1dnE0FkLft8T+/Vkkp1GczNTOYLy99xOJ4XDnk3/oHPYK97N4vfJXA3i2g== + SHA512 + 10537 + Copyright 2016 + common logging platform context autofac + false + false + true + -1 + + + + + + http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.Context.Autofac',Version='1.0.2.0') + + + + Acme.Common.Logging.Context.Autofac + 2016-11-16T04:09:55Z + 2016-11-16T04:09:55Z + + Acme OnDemand, Inc. + + + + + Acme.Common.Logging.Context.Autofac + 1.0.2.0 + 1.0.2 + false + Acme Common Logging Platform Context Autofac integration + Acme OnDemand, Inc. + Acme OnDemand, Inc. + + + + -1 + false + false + Common Logging integration with Platform Context using Autofac + + + 2016-11-16T04:09:55.7144706Z + 2016-11-16T04:09:55.7154707Z + Autofac:3.5.2|Common.Logging.NLog41:3.3.1|Acme.Platform.Context.Serialization:1.0.3.0|Acme.Common.Logging.Configuration:1.0.2.0 + 7Y/XPZFOSTXFciSKUZfhVGPm/Y6of8+yUVdOLGBRBvUd5dSvbwlhHc8tuMNR/HKczTdeYLtrBalUezv06kyzAQ== + SHA512 + 10540 + Copyright 2016 + common logging platform context autofac + false + false + true + -1 + + + + + + http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.NLog',Version='4.5.0') + + + + Acme.Common.Logging.NLog + 2018-04-09T19:13:01Z + 2018-04-09T19:13:01Z + + Patrick Assuied + + + + + Acme.Common.Logging.NLog + 4.5.0 + 4.5.0 + false + Acme Common Logging NLog integration for .NET Framework and .NET Standard + Patrick Assuied + Patrick Assuied + + + https://bitbucket.Acme.com/projects/Acme/repos/Acme-common-logging + -1 + false + false + Common Logging NLog Integration for Acme for .NET Framework and .NET Standard. Port of Common.Logging.NLog until proper .NET standard support is added + + + ## 4.5.0 + - Integration with NLog 4.5 + + 2018-04-09T19:13:01.2458675Z + 2018-04-09T19:13:01.2468683Z + Common.Logging:[3.4.1, 4.0.0):net452|NLog:4.5.2:net452|Common.Logging:[3.4.1, 4.0.0):netstandard2.0|NLog:4.5.2:netstandard2.0 + eMynRZ/yRL/I//UEC9Rhp/YE4pOVekFIPH9r39lYuwS0VTlDjKhRH7zyk+A6jhiRRGTQiNORaXaR8NepTix7fg== + SHA512 + 29293 + Copyright 2016-2018 + common logging configuration nlog + false + false + true + -1 + + + + + + http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.NLog',Version='4.5.1') + + + + Acme.Common.Logging.NLog + 2018-06-30T18:10:12Z + 2018-06-30T18:10:12Z + + Patrick Assuied + + + + + Acme.Common.Logging.NLog + 4.5.1 + 4.5.1 + false + Acme Common Logging NLog integration for .NET Framework and .NET Standard + Patrick Assuied + Patrick Assuied + + + https://bitbucket.Acme.com/projects/Acme/repos/Acme-common-logging + -1 + false + false + Common Logging NLog Integration for Acme for .NET Framework and .NET Standard. Port of Common.Logging.NLog until proper .NET standard support is added + + + 2018-06-30T18:10:12.0216293Z + 2018-06-30T18:10:12.0216293Z + Common.Logging:[3.4.1, 4.0.0):net452|NLog:4.5.6:net452|Common.Logging:[3.4.1, 4.0.0):netstandard2.0|NLog:4.5.6:netstandard2.0 + P7uWjyK1uH48ftn9oI8pSFxfU6e0yzsPDOswYay6wk+q5XTh2mMUjKdNWPy7kee2PrD+8aBLjogQtsEQ8To3Sg== + SHA512 + 29268 + Copyright 2016-2018 + common logging configuration nlog + false + false + true + -1 + + + + + + http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.NLog',Version='4.5.2') + + + + Acme.Common.Logging.NLog + 2018-10-25T00:56:28Z + 2018-10-25T00:56:28Z + + Patrick Assuied + + + + + Acme.Common.Logging.NLog + 4.5.2 + 4.5.2 + false + Acme Common Logging NLog integration for .NET Framework and .NET Standard + Patrick Assuied + Patrick Assuied + + + https://bitbucket.Acme.com/projects/Acme/repos/Acme-common-logging + -1 + false + false + Common Logging NLog Integration for Acme for .NET Framework and .NET Standard. Port of Common.Logging.NLog until proper .NET standard support is added + + + 2018-10-25T00:56:28.0828448Z + 2018-10-25T00:56:28.0838453Z + Common.Logging:[3.4.1, 4.0.0):net452|NLog:4.5.6:net452|SourceLink.Copy.PdbFiles:2.8.3:net452|SourceLink.Create.CommandLine:2.8.3:net452|Common.Logging:[3.4.1, 4.0.0):netstandard2.0|NLog:4.5.6:netstandard2.0|SourceLink.Copy.PdbFiles:2.8.3:netstandard2.0|SourceLink.Create.CommandLine:2.8.3:netstandard2.0 + zcl4j9wMhszI5WmrqxKYJ43as6ZXxfsK+BNmGCm4A60xMH/t6IFVecOBVTUeBnsDx9tJdQGskFzJuSJUU8E9NA== + SHA512 + 29768 + Copyright 2016-2018 + common logging configuration nlog + true + true + true + -1 + + + + + + http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.WebApi',Version='1.0.0.2') + + + + Acme.Common.Logging.WebApi + 2016-11-16T04:09:55Z + 2016-11-16T04:09:55Z + + Acme OnDemand, Inc. + + + + + Acme.Common.Logging.WebApi + 1.0.0.2 + 1.0.0.2 + false + Acme Common Logging WebApi + Acme OnDemand, Inc. + Acme OnDemand, Inc. + + + + -1 + false + false + Common Logging integration within Web API Client + + + 2016-11-16T04:09:55.8324708Z + 2016-11-16T04:09:55.8324708Z + Common.Logging.NLog41:3.3.1|Microsoft.AspNet.WebApi.Core:5.2.3|Microsoft.Owin:3.0.1|Acme.Common.Logging.Configuration:1.0.0.2 + RSZgxyO1i61wl3ZFraJotbWHZ+5LLo/CMeo78inmxW+bKo6EqKZIJq4oLW9g4ucPMngjzy6TPTb7mFcwrEXxuw== + SHA512 + 10576 + Copyright 2016 + configuration contracts + false + false + true + -1 + + + + + + http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.WebApi',Version='1.0.1.0') + + + + Acme.Common.Logging.WebApi + 2016-11-16T04:09:55Z + 2016-11-16T04:09:55Z + + Acme OnDemand, Inc. + + + + + Acme.Common.Logging.WebApi + 1.0.1.0 + 1.0.1 + false + Acme Common Logging WebApi + Acme OnDemand, Inc. + Acme OnDemand, Inc. + + + + -1 + false + false + Common Logging integration within Web API Client + + + 2016-11-16T04:09:55.8425001Z + 2016-11-16T04:09:55.8425001Z + Common.Logging.NLog41:3.3.1|Microsoft.AspNet.WebApi.Core:5.2.3|Microsoft.Owin:3.0.1|Acme.Common.Logging.Configuration:1.0.1.0 + 0T7Nc9XQvY41Hjhs37kjavEuco0sCBrQP8hNIMVEvkAdnajMjLWueJNKGzRKaUpzTzyFCWfx5/ON4QJAolBHzg== + SHA512 + 11047 + Copyright 2016 + configuration contracts + false + false + true + -1 + + + + + + http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.WebApi',Version='1.0.2.0') + + + + Acme.Common.Logging.WebApi + 2016-11-16T04:09:55Z + 2016-11-16T04:09:55Z + + Acme OnDemand, Inc. + + + + + Acme.Common.Logging.WebApi + 1.0.2.0 + 1.0.2 + false + Acme Common Logging WebApi + Acme OnDemand, Inc. + Acme OnDemand, Inc. + + + + -1 + false + false + Common Logging integration within Web API Client + + + 2016-11-16T04:09:55.8514712Z + 2016-11-16T04:09:55.8514712Z + Common.Logging.NLog41:3.3.1|Microsoft.AspNet.WebApi.Core:5.2.3|Microsoft.Owin:3.0.1|Acme.Common.Logging.Configuration:1.0.2.0 + 1NXCMeB/UpKQuFKoilR2bIzYuovOQjaB/der3AgkcO5zbLo/bknGt61Cz/CLztUksOG95A9fO1zegI3NtlTmcA== + SHA512 + 11095 + Copyright 2016 + configuration contracts + false + false + true + -1 + + + + + + http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.WebApi',Version='1.0.3.0') + + + + Acme.Common.Logging.WebApi + 2016-11-16T04:09:55Z + 2016-11-16T04:09:55Z + + Acme OnDemand, Inc. + + + + + Acme.Common.Logging.WebApi + 1.0.3.0 + 1.0.3 + false + Acme Common Logging WebApi + Acme OnDemand, Inc. + Acme OnDemand, Inc. + + + + -1 + false + false + Common Logging integration within Web API Client + + + 2016-11-16T04:09:55.8634725Z + 2016-11-16T04:09:55.8634725Z + Common.Logging.NLog41:3.3.1|Microsoft.AspNet.WebApi.Core:5.2.3|Microsoft.Owin:3.0.1|Acme.Common.Logging.Configuration:1.0.3.0 + X9qk+cNFTpaeyM8SewBHHhbTkZPTsue5JmFIzHXvnwM3UgDWCx3wwa1Q83ALzYdJkwuKKPQMWKmGwdsGcUvarw== + SHA512 + 11107 + Copyright 2016 + configuration contracts + false + false + true + -1 + + + + + + http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.WebApi',Version='1.0.3.1') + + + + Acme.Common.Logging.WebApi + 2016-11-16T04:09:55Z + 2016-11-16T04:09:55Z + + Acme OnDemand, Inc. + + + + + Acme.Common.Logging.WebApi + 1.0.3.1 + 1.0.3.1 + false + Acme Common Logging WebApi + Acme OnDemand, Inc. + Acme OnDemand, Inc. + + + https://wiki.Acmeondemand.com/display/PLAT/Acme.Common.Logging + -1 + false + false + Common Logging integration within Web API Client + + + 2016-11-16T04:09:55.8715191Z + 2016-11-16T04:09:55.8715191Z + Common.Logging.NLog41:3.3.1|Microsoft.AspNet.WebApi.Core:5.2.3|Microsoft.Owin:3.0.1|Acme.Common.Logging.Configuration:1.0.3.1 + cKlVcH53vwWV9B2Z71b8BwAcpFEKdA/MSTx7YhLBl71cLJeCu7ODmlDqhWzYLtthZheimN5pv6g1LWfRoiinrA== + SHA512 + 11125 + Copyright 2016 + configuration contracts + false + false + true + -1 + + + + + + \ No newline at end of file diff --git a/test/ProjectFileTools.NuGetSearch.Tests/TestFiles/GetPackageVersions.CommonLogging.xml b/test/ProjectFileTools.NuGetSearch.Tests/TestFiles/GetPackageVersions.CommonLogging.xml new file mode 100644 index 0000000..039097f --- /dev/null +++ b/test/ProjectFileTools.NuGetSearch.Tests/TestFiles/GetPackageVersions.CommonLogging.xml @@ -0,0 +1,384 @@ + + + http://schemas.datacontract.org/2004/07/ + + <updated>2019-07-07T01:17:34Z</updated> + <link rel="self" href="http://localhost/Nuget/nuget/Packages" /> + <entry> + <id>http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.AspNetCore',Version='1.6.0.5')</id> + <category term="NuGet.Server.Core.DataServices.ODataPackage" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> + <link rel="edit" href="http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.AspNetCore',Version='1.6.0.5')" /> + <link rel="self" href="http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.AspNetCore',Version='1.6.0.5')" /> + <title type="text">Acme.Common.Logging.AspNetCore + 2018-04-09T19:12:53Z + 2018-04-09T19:12:53Z + + Patrick Assuied + + + + + Acme.Common.Logging.AspNetCore + 1.6.0.5 + 1.6.0.5 + false + Common Logging AspNetCore + Patrick Assuied + Patrick Assuied + + + https://bitbucket.Acme.com/projects/Acme/repos/Acme-common-logging + -1 + false + false + Common Logging integration within Aspnet core services + + + ## 1.6.0 + - Support for .NET core + + 2018-04-09T19:12:53.6418356Z + 2018-04-09T19:12:53.6418356Z + Acme.Common.Logging.Configuration:1.6.0.5:netcoreapp2.0|Microsoft.AspNetCore.Diagnostics:2.0.2:netcoreapp2.0|NLog.Web.AspNetCore:4.5.1:netcoreapp2.0 + zclx15xLnnUxm63+IqBWUNCYWAYcHvumBD1CbsXuSpdame0fHPcfv9FlMRodIOHUF9q/yXqkGo/AQTRlMAa88Q== + SHA512 + 11395 + Copyright 2016-2018 + common logging aspnetcore + false + false + true + -1 + + + + + + http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.AspNetCore',Version='1.6.1') + + + + Acme.Common.Logging.AspNetCore + 2018-05-04T21:45:54Z + 2018-05-04T21:45:54Z + + Patrick Assuied + + + + + Acme.Common.Logging.AspNetCore + 1.6.1 + 1.6.1 + false + Common Logging AspNetCore + Patrick Assuied + Patrick Assuied + + + https://bitbucket.Acme.com/projects/Acme/repos/Acme-common-logging + -1 + false + false + Common Logging integration within Aspnet core services + + + ## 1.6.0 + - Support for .NET core + + 2018-05-04T21:45:54.0222438Z + 2018-05-04T21:45:54.0222438Z + Acme.Common.Logging.Configuration:1.6.1:netcoreapp2.0|Microsoft.AspNetCore.Diagnostics:2.0.2:netcoreapp2.0|NLog.Web.AspNetCore:4.5.1:netcoreapp2.0 + 7uBobOiTDhyz6s4P1Fnzgh1PokLYXU7G5E7nHDIpeCoj1B/f/augtWBBcqpuxv+hyDnGsVtyOxxPqso1Jhk1yw== + SHA512 + 11399 + Copyright 2016-2018 + common logging aspnetcore + false + false + true + -1 + + + + + + http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.AspNetCore',Version='1.6.2') + + + + Acme.Common.Logging.AspNetCore + 2018-05-08T01:00:16Z + 2018-05-08T01:00:16Z + + Patrick Assuied + + + + + Acme.Common.Logging.AspNetCore + 1.6.2 + 1.6.2 + false + Common Logging AspNetCore + Patrick Assuied + Patrick Assuied + + + https://bitbucket.Acme.com/projects/Acme/repos/Acme-common-logging + -1 + false + false + Common Logging integration within Aspnet core services + + + ## 1.6.0 + - Support for .NET core + + 2018-05-08T01:00:16.2897639Z + 2018-05-08T01:00:16.2897639Z + Acme.Common.Logging.Configuration:1.6.2:netcoreapp2.0|Microsoft.AspNetCore.Diagnostics:2.0.2:netcoreapp2.0|NLog.Web.AspNetCore:4.5.1:netcoreapp2.0 + 5ReG+O25Ok1PxC7FXqbubma1UL3PJx7z8YmsThXUGhOih+2IP3k5fjtQo1pOHuTGc5UjOomhOKaeWEIbUXfshA== + SHA512 + 11399 + Copyright 2016-2018 + common logging aspnetcore + false + false + true + -1 + + + + + + http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.AspNetCore',Version='1.7.0') + + + + Acme.Common.Logging.AspNetCore + 2018-06-30T18:10:04Z + 2018-06-30T18:10:04Z + + Patrick Assuied + + + + + Acme.Common.Logging.AspNetCore + 1.7.0 + 1.7.0 + false + Common Logging AspNetCore + Patrick Assuied + Patrick Assuied + + + https://bitbucket.Acme.com/projects/Acme/repos/Acme-common-logging + -1 + false + false + Common Logging integration within Aspnet core services + + ## Available in CHANGELOG.md + 2018-06-30T18:10:04.5956766Z + 2018-06-30T18:10:04.5956766Z + Acme.Common.Logging.Configuration:1.7.0:netcoreapp2.0|Microsoft.AspNetCore.Diagnostics:2.0.2:netcoreapp2.0|NLog.Web.AspNetCore:4.5.4:netcoreapp2.0 + GF3yaZUYgqCqTLtBxsVzhthbQxBMWj9wWUOgyqcLuty+YmTaIGGToTPiP7T15oQoV9ti7QTYvKoQGJaJEA1TLg== + SHA512 + 11404 + Copyright 2016-2018 + common logging aspnetcore + false + false + true + -1 + + + + + + http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.AspNetCore',Version='1.7.1') + + + + Acme.Common.Logging.AspNetCore + 2018-10-25T00:56:19Z + 2018-10-25T00:56:19Z + + Patrick Assuied + + + + + Acme.Common.Logging.AspNetCore + 1.7.1 + 1.7.1 + false + Common Logging AspNetCore + Patrick Assuied + Patrick Assuied + + + https://bitbucket.Acme.com/projects/Acme/repos/Acme-common-logging + -1 + false + false + Common Logging integration within Aspnet core services + + ## Available in CHANGELOG.md + 2018-10-25T00:56:19.9908454Z + 2018-10-25T00:56:19.9908454Z + Acme.Common.Logging.Configuration:1.7.1:netcoreapp2.0|Microsoft.AspNetCore.Diagnostics:2.0.3:netcoreapp2.0|NLog.Web.AspNetCore:4.5.4:netcoreapp2.0|SourceLink.Copy.PdbFiles:2.8.3:netcoreapp2.0|SourceLink.Create.CommandLine:2.8.3:netcoreapp2.0|Acme.Common.Logging.Configuration:1.7.1:netcoreapp2.1|Microsoft.AspNetCore.Diagnostics:2.1.1:netcoreapp2.1|NLog.Web.AspNetCore:4.5.4:netcoreapp2.1|SourceLink.Copy.PdbFiles:2.8.3:netcoreapp2.1|SourceLink.Create.CommandLine:2.8.3:netcoreapp2.1 + E2a85BBdwDwqda2OdKClf/8g28csDkeffMPpe/36IFLZwvOspZUMXCb/cQOk5X3EVlls5nHgA1OKEvud1Spz0g== + SHA512 + 21295 + Copyright 2016-2018 + common logging aspnetcore + false + false + true + -1 + + + + + + http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.AspNetCore',Version='1.8.0') + + + + Acme.Common.Logging.AspNetCore + 2018-11-21T17:31:07Z + 2018-11-21T17:31:07Z + + Patrick Assuied + + + + + Acme.Common.Logging.AspNetCore + 1.8.0 + 1.8.0 + false + Common Logging AspNetCore + Patrick Assuied + Patrick Assuied + + + https://bitbucket.Acme.com/projects/Acme/repos/Acme-common-logging + -1 + false + false + Common Logging integration within Aspnet core services + + ## Available in CHANGELOG.md + 2018-11-21T17:31:07.1944763Z + 2018-11-21T17:31:07.1944763Z + Acme.Common.Logging.Configuration:1.8.0:netcoreapp2.0|Microsoft.AspNetCore.Diagnostics:2.0.3:netcoreapp2.0|NLog.Web.AspNetCore:4.5.4:netcoreapp2.0|SourceLink.Copy.PdbFiles:2.8.3:netcoreapp2.0|SourceLink.Create.CommandLine:2.8.3:netcoreapp2.0|Acme.Common.Logging.Configuration:1.8.0:netcoreapp2.1|Microsoft.AspNetCore.Diagnostics:2.1.1:netcoreapp2.1|NLog.Web.AspNetCore:4.5.4:netcoreapp2.1|SourceLink.Copy.PdbFiles:2.8.3:netcoreapp2.1|SourceLink.Create.CommandLine:2.8.3:netcoreapp2.1 + KP5xJayLLtWJx59wz6rSHW8tvxNY4xp/3eCsqG2QF7wINphpXs+0k2rKLigMWq/6geWptbdXXjJdZXYJUG0EUQ== + SHA512 + 22002 + Copyright 2016-2018 + common logging aspnetcore + false + false + true + -1 + + + + + + http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.AspNetCore',Version='1.9.0') + + + + Acme.Common.Logging.AspNetCore + 2019-06-19T00:57:53Z + 2019-06-19T00:57:53Z + + Patrick Assuied + + + + + Acme.Common.Logging.AspNetCore + 1.9.0 + 1.9.0 + false + Common Logging AspNetCore + Patrick Assuied + Patrick Assuied + + + https://bitbucket.Acme.com/projects/Acme/repos/Acme-common-logging + -1 + false + false + Common Logging integration within Aspnet core services + + ## Available in CHANGELOG.md + 2019-06-19T00:57:53.7070732Z + 2019-06-19T00:57:53.7080737Z + Acme.Common.Logging.Configuration:1.9.0:netcoreapp2.0|Microsoft.AspNetCore.Diagnostics:2.0.3:netcoreapp2.0|NLog.Web.AspNetCore:4.5.4:netcoreapp2.0|SourceLink.Copy.PdbFiles:2.8.3:netcoreapp2.0|SourceLink.Create.CommandLine:2.8.3:netcoreapp2.0|Acme.Common.Logging.Configuration:1.9.0:netcoreapp2.1|Microsoft.AspNetCore.Diagnostics:2.1.1:netcoreapp2.1|NLog.Web.AspNetCore:4.5.4:netcoreapp2.1|SourceLink.Copy.PdbFiles:2.8.3:netcoreapp2.1|SourceLink.Create.CommandLine:2.8.3:netcoreapp2.1 + tjgU5FxQZnzaW8oi3MIAPd0Oua7st8fsv1rtKmy3DipZMAZX8tYCrz/W94fq99CgQTD3BN8z6M6174645ZtIHg== + SHA512 + 22007 + Copyright 2016-2019 + common logging aspnetcore + false + false + true + -1 + + + + + + http://localhost/Nuget/nuget/Packages(Id='Acme.Common.Logging.AspNetCore',Version='1.9.1') + + + + Acme.Common.Logging.AspNetCore + 2019-06-20T23:33:38Z + 2019-06-20T23:33:38Z + + Patrick Assuied + + + + + Acme.Common.Logging.AspNetCore + 1.9.1 + 1.9.1 + false + Common Logging AspNetCore + Patrick Assuied + Patrick Assuied + + + https://bitbucket.Acme.com/projects/Acme/repos/Acme-common-logging + -1 + false + false + Common Logging integration within Aspnet core services + + ## Available in CHANGELOG.md + 2019-06-20T23:33:38.3885724Z + 2019-06-20T23:33:38.3885724Z + Acme.Common.Logging.Configuration:1.9.1:netcoreapp2.0|Microsoft.AspNetCore.Diagnostics:2.0.3:netcoreapp2.0|NLog.Web.AspNetCore:4.5.4:netcoreapp2.0|SourceLink.Copy.PdbFiles:2.8.3:netcoreapp2.0|SourceLink.Create.CommandLine:2.8.3:netcoreapp2.0|Acme.Common.Logging.Configuration:1.9.1:netcoreapp2.1|Microsoft.AspNetCore.Diagnostics:2.1.1:netcoreapp2.1|NLog.Web.AspNetCore:4.5.4:netcoreapp2.1|SourceLink.Copy.PdbFiles:2.8.3:netcoreapp2.1|SourceLink.Create.CommandLine:2.8.3:netcoreapp2.1 + yBIXe3PCTRziev9L+AzWKPszTzv7RGhzxmPs6HWqFfQJUNo/WaAE4ORim7dhiFpjluD0knZV9/dLYKl94n3N5A== + SHA512 + 22013 + Copyright 2016-2019 + common logging aspnetcore + true + true + true + -1 + + + + + \ No newline at end of file diff --git a/test/ProjectFileTools.NuGetSearch.Tests/UnitTest1.cs b/test/ProjectFileTools.NuGetSearch.Tests/UnitTest1.cs index 1f2d54f..b8c2486 100644 --- a/test/ProjectFileTools.NuGetSearch.Tests/UnitTest1.cs +++ b/test/ProjectFileTools.NuGetSearch.Tests/UnitTest1.cs @@ -1,6 +1,6 @@ using System; using System.Threading; -using Microsoft.VisualStudio.TestTools.UnitTesting; +// using Microsoft.VisualStudio.TestTools.UnitTesting; using NuGet.Frameworks; using ProjectFileTools.NuGetSearch.Contracts; using ProjectFileTools.NuGetSearch.Feeds; @@ -9,10 +9,10 @@ namespace PackageFeedManagerTests { - [TestClass] + // [TestClass] public class UnitTest1 { - [TestMethod] + // [TestMethod] public void TestMethod1() { //IFileSystem fileSystem = new MockFileSystem(); From 56d190a5544fa251c7cd66e64386d141ee985d29 Mon Sep 17 00:00:00 2001 From: Patrick Assuied Date: Sun, 7 Jul 2019 00:31:17 -0700 Subject: [PATCH 2/5] Fix Search query for GetParameterNamesAsync() in NuGet v2 - Changed WebRequestFactory to use static HttpClient to avoid connection socket exhaustion --- CHANGELOG.md | 1 + .../Feeds/Web/NuGetV2ServiceFeed.cs | 2 +- .../IO/WebRequestFactory.cs | 10 ++++------ .../NuGetV2ServiceFeedTests.cs | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c18466f..1b2fb44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ on the official Visual Studio extension gallery. ## 1.4 - [x] Implement NuGet V2 Feed support +- [x] Change WebRequestFactory to use a static HttpClient to avoid connection socket exhaustion problem ## 1.1 diff --git a/src/ProjectFileTools.NuGetSearch/Feeds/Web/NuGetV2ServiceFeed.cs b/src/ProjectFileTools.NuGetSearch/Feeds/Web/NuGetV2ServiceFeed.cs index 60701fc..a6243dc 100644 --- a/src/ProjectFileTools.NuGetSearch/Feeds/Web/NuGetV2ServiceFeed.cs +++ b/src/ProjectFileTools.NuGetSearch/Feeds/Web/NuGetV2ServiceFeed.cs @@ -84,7 +84,7 @@ public async Task GetPackageNamesAsync(string prefix, IReadOnlyList results = new List(); string frameworkQuery = !string.IsNullOrEmpty(queryConfiguration.CompatibiltyTarget) ? $"&targetFramework={queryConfiguration.CompatibiltyTarget}" : ""; var serviceEndpoints = new[] { $"{_feed}/Search()" }; - Func queryFunc = x => $"{x}?searchTerm={prefix}{frameworkQuery}&includePrerelease={queryConfiguration.IncludePreRelease}"; + Func queryFunc = x => $"{x}?searchTerm='{prefix}'{frameworkQuery}&includePrerelease={queryConfiguration.IncludePreRelease}"; XDocument document = await ExecuteAutocompleteServiceQueryAsync(serviceEndpoints, queryFunc, cancellationToken).ConfigureAwait(false); if (document != null) diff --git a/src/ProjectFileTools.NuGetSearch/IO/WebRequestFactory.cs b/src/ProjectFileTools.NuGetSearch/IO/WebRequestFactory.cs index d52dfad..2dac146 100644 --- a/src/ProjectFileTools.NuGetSearch/IO/WebRequestFactory.cs +++ b/src/ProjectFileTools.NuGetSearch/IO/WebRequestFactory.cs @@ -6,16 +6,14 @@ namespace ProjectFileTools.NuGetSearch.IO { public class WebRequestFactory : IWebRequestFactory { + private static readonly HttpClient _httpClient = new HttpClient(); public async Task GetStringAsync(string endpoint, CancellationToken cancellationToken) { try { - using (HttpClient client = new HttpClient()) - { - HttpResponseMessage responseMessage = await client.GetAsync(endpoint, cancellationToken).ConfigureAwait(false); - responseMessage.EnsureSuccessStatusCode(); - return await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); - } + HttpResponseMessage responseMessage = await _httpClient.GetAsync(endpoint, cancellationToken).ConfigureAwait(false); + responseMessage.EnsureSuccessStatusCode(); + return await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); } catch { diff --git a/test/ProjectFileTools.NuGetSearch.Tests/NuGetV2ServiceFeedTests.cs b/test/ProjectFileTools.NuGetSearch.Tests/NuGetV2ServiceFeedTests.cs index c4cad04..0ee09d1 100644 --- a/test/ProjectFileTools.NuGetSearch.Tests/NuGetV2ServiceFeedTests.cs +++ b/test/ProjectFileTools.NuGetSearch.Tests/NuGetV2ServiceFeedTests.cs @@ -39,7 +39,7 @@ public async Task GivenPackagesFound_ReturnListOfIds(string feed, string testFil var webRequestFactory = Mock.Of(); Mock.Get(webRequestFactory) - .Setup(f => f.GetStringAsync("http://localhost/nuget/Search()?searchTerm=Common.Logging&targetFramework=netcoreapp2.0&includePrerelease=False", It.IsAny())) + .Setup(f => f.GetStringAsync("http://localhost/nuget/Search()?searchTerm='Common.Logging'&targetFramework=netcoreapp2.0&includePrerelease=False", It.IsAny())) .Returns(Task.FromResult(GetXmlFromTestFile(testFile))); var sut = new NuGetV2ServiceFeed(feed, webRequestFactory); From 3b54f3017d3b1ff1357eff2ebb6bfcd14b5564b5 Mon Sep 17 00:00:00 2001 From: Patrick Assuied Date: Sun, 7 Jul 2019 08:26:28 -0700 Subject: [PATCH 3/5] Changes per PR feedback --- .../Feeds/Web/NuGetV2ServiceFeed.cs | 86 +++++++++---------- .../UnitTest1.cs | 4 +- 2 files changed, 44 insertions(+), 46 deletions(-) diff --git a/src/ProjectFileTools.NuGetSearch/Feeds/Web/NuGetV2ServiceFeed.cs b/src/ProjectFileTools.NuGetSearch/Feeds/Web/NuGetV2ServiceFeed.cs index a6243dc..95b518d 100644 --- a/src/ProjectFileTools.NuGetSearch/Feeds/Web/NuGetV2ServiceFeed.cs +++ b/src/ProjectFileTools.NuGetSearch/Feeds/Web/NuGetV2ServiceFeed.cs @@ -48,32 +48,7 @@ public NuGetV2ServiceFeed(string feed, IWebRequestFactory webRequestFactory) public string DisplayName => $"{_feed} (NuGet v2)"; - private async Task ExecuteAutocompleteServiceQueryAsync(IEnumerable endpoints, Func query, CancellationToken cancellationToken) - { - if (endpoints == null) - { - return null; - } - - for (int i = 0; i < endpoints.Count(); ++i) - { - string endpoint = endpoints.First(); - - try - { - string location = query(endpoint); - var xml = await _webRequestFactory.GetStringAsync(location, cancellationToken).ConfigureAwait(false); - return XDocument.Parse(xml); - } - catch (Exception) - { - //TODO: Possibly log the failure to get the document - } - } - - return null; - } - + public async Task GetPackageNamesAsync(string prefix, IPackageQueryConfiguration queryConfiguration, CancellationToken cancellationToken) { if (cancellationToken.IsCancellationRequested) @@ -83,9 +58,9 @@ public async Task GetPackageNamesAsync(string prefix, IReadOnlyList results = new List(); string frameworkQuery = !string.IsNullOrEmpty(queryConfiguration.CompatibiltyTarget) ? $"&targetFramework={queryConfiguration.CompatibiltyTarget}" : ""; - var serviceEndpoints = new[] { $"{_feed}/Search()" }; + var serviceEndpoint = $"{_feed}/Search()"; Func queryFunc = x => $"{x}?searchTerm='{prefix}'{frameworkQuery}&includePrerelease={queryConfiguration.IncludePreRelease}"; - XDocument document = await ExecuteAutocompleteServiceQueryAsync(serviceEndpoints, queryFunc, cancellationToken).ConfigureAwait(false); + XDocument document = await ExecuteAutocompleteServiceQueryAsync(serviceEndpoint, queryFunc, cancellationToken).ConfigureAwait(false); if (document != null) { @@ -109,9 +84,9 @@ public async Task GetPackageInfoAsync(string packageId, string ver return null; } - var serviceEndpoints = new[] { $"{_feed}/Packages(Id='{packageId}',Version='{version}')" }; + var serviceEndpoint = $"{_feed}/Packages(Id='{packageId}',Version='{version}')"; Func queryFunc = x => $"{x}"; - XDocument document = await ExecuteAutocompleteServiceQueryAsync(serviceEndpoints, queryFunc, cancellationToken).ConfigureAwait(false); + XDocument document = await ExecuteAutocompleteServiceQueryAsync(serviceEndpoint, queryFunc, cancellationToken).ConfigureAwait(false); if (document != null) { @@ -134,20 +109,12 @@ public async Task GetPackageInfoAsync(string packageId, string ver return null; } - private static string GetPropertyValue(XDocument document, XElement el, string propertyKey) - { - return el - .Element(document.Root.GetNamespaceOfPrefix("m") + "properties") - .Element(document.Root.GetNamespaceOfPrefix("d") + propertyKey) - ?.Value; - } - public async Task GetPackageVersionsAsync(string id, IPackageQueryConfiguration queryConfiguration, CancellationToken cancellationToken) { IReadOnlyList results = new List(); - var serviceEndpoints = new[] { $"{_feed}/FindPackagesById()" }; + var serviceEndpoint = $"{_feed}/FindPackagesById()"; Func queryFunc = x => $"{x}?id='{id}'"; - XDocument document = await ExecuteAutocompleteServiceQueryAsync(serviceEndpoints, queryFunc, cancellationToken).ConfigureAwait(false); + XDocument document = await ExecuteAutocompleteServiceQueryAsync(serviceEndpoint, queryFunc, cancellationToken).ConfigureAwait(false); try { @@ -161,6 +128,37 @@ public async Task GetPackageVersionsAsync(string id return new PackageVersionSearchResult(results, _kind); } + private async Task ExecuteAutocompleteServiceQueryAsync(string endpoint, Func query, CancellationToken cancellationToken) + { + if (endpoint == null) + { + return null; + } + + try + { + string location = query(endpoint); + var xml = await _webRequestFactory.GetStringAsync(location, cancellationToken).ConfigureAwait(false); + return XDocument.Parse(xml); + } + catch (Exception) + { + } + + return null; + } + + + private static string GetPropertyValue(XDocument document, XElement el, string propertyKey) + { + return el + .Element(document.Root.GetNamespaceOfPrefix("m") + "properties") + .Element(document.Root.GetNamespaceOfPrefix("d") + propertyKey) + ?.Value; + } + + + private static IReadOnlyList GetPackageVersionsFromNuGetV2CompatibleQueryResult(string id, XDocument document) { List results = new List(); @@ -180,7 +178,7 @@ private static IReadOnlyList GetPackageVersionsFromNuGetV2CompatibleQuer } } - return results.AsReadOnly(); + return results; } private static IReadOnlyList GetPackageNamesFromNuGetV2CompatibleQueryResult(XDocument document) @@ -189,15 +187,15 @@ private static IReadOnlyList GetPackageNamesFromNuGetV2CompatibleQueryRe if (document != null) { - foreach (var el in document.Root.Elements(document.Root.GetDefaultNamespace() +"entry")) + foreach (var el in document.Root.Elements(document.Root.GetDefaultNamespace() + "entry")) { var id = GetPropertyValue(document, el, "Id"); results.Add(id); } } - - return results.Distinct().ToList().AsReadOnly(); + + return results.Distinct().ToList(); } } } diff --git a/test/ProjectFileTools.NuGetSearch.Tests/UnitTest1.cs b/test/ProjectFileTools.NuGetSearch.Tests/UnitTest1.cs index b8c2486..f9d9818 100644 --- a/test/ProjectFileTools.NuGetSearch.Tests/UnitTest1.cs +++ b/test/ProjectFileTools.NuGetSearch.Tests/UnitTest1.cs @@ -6,13 +6,13 @@ using ProjectFileTools.NuGetSearch.Feeds; using ProjectFileTools.NuGetSearch.Feeds.Disk; using ProjectFileTools.NuGetSearch.IO; +using Xunit; namespace PackageFeedManagerTests { - // [TestClass] public class UnitTest1 { - // [TestMethod] + [Fact(Skip="Just for testing locally")] public void TestMethod1() { //IFileSystem fileSystem = new MockFileSystem(); From 7a677f51ea4b3610bcb6fb935641c13f90caa11d Mon Sep 17 00:00:00 2001 From: Patrick Assuied Date: Sun, 11 Aug 2019 08:32:37 -0700 Subject: [PATCH 4/5] Added `semVerLevel=2.0.0` query string per PR comment to include semver2 packages --- .../Feeds/Web/NuGetV2ServiceFeed.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ProjectFileTools.NuGetSearch/Feeds/Web/NuGetV2ServiceFeed.cs b/src/ProjectFileTools.NuGetSearch/Feeds/Web/NuGetV2ServiceFeed.cs index 95b518d..ff54afc 100644 --- a/src/ProjectFileTools.NuGetSearch/Feeds/Web/NuGetV2ServiceFeed.cs +++ b/src/ProjectFileTools.NuGetSearch/Feeds/Web/NuGetV2ServiceFeed.cs @@ -59,7 +59,7 @@ public async Task GetPackageNamesAsync(string prefix, IReadOnlyList results = new List(); string frameworkQuery = !string.IsNullOrEmpty(queryConfiguration.CompatibiltyTarget) ? $"&targetFramework={queryConfiguration.CompatibiltyTarget}" : ""; var serviceEndpoint = $"{_feed}/Search()"; - Func queryFunc = x => $"{x}?searchTerm='{prefix}'{frameworkQuery}&includePrerelease={queryConfiguration.IncludePreRelease}"; + Func queryFunc = x => $"{x}?searchTerm='{prefix}'{frameworkQuery}&includePrerelease={queryConfiguration.IncludePreRelease}&semVerLevel=2.0.0"; XDocument document = await ExecuteAutocompleteServiceQueryAsync(serviceEndpoint, queryFunc, cancellationToken).ConfigureAwait(false); if (document != null) @@ -148,7 +148,7 @@ private async Task ExecuteAutocompleteServiceQueryAsync(string endpoi return null; } - + private static string GetPropertyValue(XDocument document, XElement el, string propertyKey) { return el From 23a09255999df9b5d78b3db5132e0704a07ae287 Mon Sep 17 00:00:00 2001 From: Patrick Assuied Date: Sun, 11 Aug 2019 08:39:11 -0700 Subject: [PATCH 5/5] Fixed test setups following addition of semVerLevel query string --- .../NuGetV2ServiceFeedTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/ProjectFileTools.NuGetSearch.Tests/NuGetV2ServiceFeedTests.cs b/test/ProjectFileTools.NuGetSearch.Tests/NuGetV2ServiceFeedTests.cs index 0ee09d1..0784c8a 100644 --- a/test/ProjectFileTools.NuGetSearch.Tests/NuGetV2ServiceFeedTests.cs +++ b/test/ProjectFileTools.NuGetSearch.Tests/NuGetV2ServiceFeedTests.cs @@ -39,7 +39,7 @@ public async Task GivenPackagesFound_ReturnListOfIds(string feed, string testFil var webRequestFactory = Mock.Of(); Mock.Get(webRequestFactory) - .Setup(f => f.GetStringAsync("http://localhost/nuget/Search()?searchTerm='Common.Logging'&targetFramework=netcoreapp2.0&includePrerelease=False", It.IsAny())) + .Setup(f => f.GetStringAsync("http://localhost/nuget/Search()?searchTerm='Common.Logging'&targetFramework=netcoreapp2.0&includePrerelease=False&semVerLevel=2.0.0", It.IsAny())) .Returns(Task.FromResult(GetXmlFromTestFile(testFile))); var sut = new NuGetV2ServiceFeed(feed, webRequestFactory);