Skip to content
This repository was archived by the owner on Mar 16, 2021. It is now read-only.

Commit

Permalink
Revert "add json tests and fix existing case"
Browse files Browse the repository at this point in the history
This reverts commit 149c6a5.
  • Loading branch information
Scott Bommarito committed May 20, 2019
1 parent 149c6a5 commit 3c3bf53
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 186 deletions.
25 changes: 1 addition & 24 deletions src/Catalog/sparql/ConstructCatalogEntryGraph.rq
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ CONSTRUCT
nuget:language ?language ;
nuget:authors ?authors ;
nuget:tag ?tag ;
nuget:minClientVersion ?minClientVersion ;
nuget:deprecation ?deprecation .
nuget:minClientVersion ?minClientVersion .

?dependency_group a nuget:PackageDependencyGroup ;
nuget:dependency ?dependency ;
Expand All @@ -32,15 +31,6 @@ CONSTRUCT
nuget:id ?dependency_id ;
nuget:range ?dependency_range ;
nuget:version ?dependency_version .

?deprecation a nuget:deprecation ;
nuget:reasons ?deprecation_reasons ;
nuget:message ?deprecation_message ;
nuget:alternatePackage ?deprecation_alternatePackage .

?deprecation_alternatePackage a nuget:alternatePackage ;
nuget:id ?deprecation_alternatePackage_id ;
nuget:range ?deprecation_alternatePackage_range .
}
WHERE
{
Expand Down Expand Up @@ -77,17 +67,4 @@ WHERE
OPTIONAL { ?dependency nuget:version ?dependency_version . }
}
}

OPTIONAL
{
?catalogEntry nuget:deprecation ?deprecation .
?deprecation nuget:reasons ?deprecation_reasons .
OPTIONAL { ?deprecation nuget:message ?deprecation_message . }
OPTIONAL
{
?deprecation nuget:alternatePackage ?deprecation_alternatePackage .
?deprecation_alternatePackage nuget:id ?deprecation_alternatePackage_id .
?deprecation_alternatePackage nuget:range ?deprecation_alternatePackage_range .
}
}
}
1 change: 0 additions & 1 deletion tests/CatalogTests/CatalogTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
<Compile Include="Dnx\DnxCatalogCollectorTests.cs" />
<Compile Include="Dnx\DnxMakerTests.cs" />
<Compile Include="Helpers\AsyncExtensionsTests.cs" />
<Compile Include="Helpers\RegistrationPackageDeprecationDetails.cs" />
<Compile Include="Helpers\CatalogIndependentPage.cs" />
<Compile Include="Helpers\CatalogIndex.cs" />
<Compile Include="Helpers\CatalogPackageDetails.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ internal sealed class CatalogIndependentPackageDetails
internal string CommitTimeStamp { get; }
[JsonProperty(CatalogConstants.Created)]
internal string Created { get; }
[JsonProperty(CatalogConstants.Deprecation)]
internal RegistrationPackageDeprecation Deprecation { get; }
[JsonProperty(CatalogConstants.Description)]
internal string Description { get; }
[JsonProperty(CatalogConstants.Id)]
Expand Down Expand Up @@ -99,8 +97,7 @@ internal CatalogIndependentPackageDetails(
string version = null,
string baseUri = null,
string commitId = null,
DateTimeOffset? commitTimeStamp = null,
RegistrationPackageDeprecation deprecation = null)
DateTimeOffset? commitTimeStamp = null)
{
var utc = commitTimeStamp ?? DateTimeOffset.UtcNow;

Expand All @@ -119,7 +116,6 @@ internal CatalogIndependentPackageDetails(
CommitId = commitId ?? Guid.NewGuid().ToString("D");
CommitTimeStamp = utc.ToString(CatalogConstants.CommitTimeStampFormat);
Created = utc.AddHours(-2).ToString(CatalogConstants.DateTimeFormat);
Deprecation = deprecation;
Description = TestUtility.CreateRandomAlphanumericString();
LastEdited = utc.AddHours(-1).ToString(CatalogConstants.DateTimeFormat);
Listed = true;
Expand Down

This file was deleted.

4 changes: 0 additions & 4 deletions tests/CatalogTests/Helpers/RegistrationPackageDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ internal sealed class RegistrationPackageDetails
internal string TypeKeyword { get; }
[JsonProperty(CatalogConstants.Authors)]
internal string Authors { get; }
[JsonProperty(CatalogConstants.Deprecation)]
internal RegistrationPackageDeprecation Deprecation { get; }
[JsonProperty(CatalogConstants.Description)]
internal string Description { get; }
[JsonProperty(CatalogConstants.IconUrl)]
Expand Down Expand Up @@ -52,7 +50,6 @@ internal RegistrationPackageDetails(
string idKeyword,
string typeKeyword,
string authors,
RegistrationPackageDeprecation deprecation,
string description,
string iconUrl,
string id,
Expand All @@ -72,7 +69,6 @@ internal RegistrationPackageDetails(
IdKeyword = idKeyword;
TypeKeyword = typeKeyword;
Authors = authors;
Deprecation = deprecation;
Description = description;
IconUrl = iconUrl;
Id = id;
Expand Down
97 changes: 0 additions & 97 deletions tests/CatalogTests/Registration/RegistrationMakerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,69 +167,6 @@ public async Task ProcessAsync_WithCustomPackageCountThreshold_TransitionsToPage
}
}

[Fact]
public async Task ProcessAsync_WithDeprecationInformation_FormatsPageCorrectly()
{
const int partitionSize = 1;
var pages = new List<ExpectedPage>();
IReadOnlyDictionary<string, IGraph> newItem;
MemoryStorage storage;
IReadOnlyList<ExpectedPage> expectedPages;

var packageDetailsList = new[]
{
// No deprecation
new CatalogIndependentPackageDetails(
id: "deprecationTests",
version: "2.4.3"),

// Single reason
new CatalogIndependentPackageDetails(
id: "deprecationTests",
version: "3.6.5",
deprecation: new RegistrationPackageDeprecation(
new[] {"r1" })),

// Message
new CatalogIndependentPackageDetails(
id: "deprecationTests",
version: "4.7.6",
deprecation: new RegistrationPackageDeprecation(
new[] {"r1", "r2" },
"the cow goes moo")),

// Alternate package
new CatalogIndependentPackageDetails(
id: "deprecationTests",
version: "5.9.8",
deprecation: new RegistrationPackageDeprecation(
new[] {"r1", "r2" },
null,
new RegistrationPackageDeprecationAlternatePackage("altPkg", "breezepackages"))),

// Message and alternate package
new CatalogIndependentPackageDetails(
id: "deprecationTests",
version: "6.0.2",
deprecation: new RegistrationPackageDeprecation(
new[] {"r1", "r2" },
"the package goes nuu",
new RegistrationPackageDeprecationAlternatePackage("altPkg", "breezepackages"))),
};

foreach (var packageDetails in packageDetailsList)
{
newItem = CreateNewItem(packageDetails);
storage = await ProcessAsync(newItem, packageDetails.Id, partitionSize);

pages.Add(new ExpectedPage(packageDetails));

expectedPages = Repaginate(pages, partitionSize);

Verify(storage, expectedPages, partitionSize);
}
}

private static IReadOnlyDictionary<string, IGraph> CreateNewItem(CatalogIndependentPackageDetails packageDetails)
{
var json = JsonConvert.SerializeObject(packageDetails, _jsonSettings);
Expand Down Expand Up @@ -384,9 +321,6 @@ private void VerifyRegistrationIndex(
new JObject(
new JProperty(CatalogConstants.ContainerKeyword, CatalogConstants.SetKeyword),
new JProperty(CatalogConstants.IdKeyword, CatalogConstants.Tag))),
new JProperty(CatalogConstants.Reasons,
new JObject(
new JProperty(CatalogConstants.ContainerKeyword, CatalogConstants.SetKeyword))),
new JProperty(CatalogConstants.PackageTargetFrameworks,
new JObject(
new JProperty(CatalogConstants.ContainerKeyword, CatalogConstants.SetKeyword),
Expand Down Expand Up @@ -512,34 +446,6 @@ private void VerifyRegistrationPackage(
Assert.Empty(package.CatalogEntry.Title);
Assert.Equal(packageDetails.Version, package.CatalogEntry.Version);

var actualDeprecation = package.CatalogEntry.Deprecation;
var expectedDeprecation = packageDetails.Deprecation;
if (expectedDeprecation == null)
{
Assert.Null(actualDeprecation);
}
else
{
Assert.NotNull(actualDeprecation);

Assert.Equal(expectedDeprecation.Reasons.OrderBy(r => r), actualDeprecation.Reasons.OrderBy(r => r));
Assert.Equal(expectedDeprecation.Message, actualDeprecation.Message);

var actualDeprecationAltPackage = actualDeprecation.AlternatePackage;
var expectedDeprecationAltPackage = expectedDeprecation.AlternatePackage;
if (expectedDeprecationAltPackage == null)
{
Assert.Null(actualDeprecationAltPackage);
}
else
{
Assert.NotNull(actualDeprecationAltPackage);

Assert.Equal(expectedDeprecationAltPackage.Id, actualDeprecationAltPackage.Id);
Assert.Equal(expectedDeprecationAltPackage.Range, actualDeprecationAltPackage.Range);
}
}

var independentPackageUri = GetRegistrationPackageVersionUri(packageId, packageVersion);
var independentPackage = GetStorageContent<RegistrationIndependentPackage>(
registrationStorage,
Expand Down Expand Up @@ -621,9 +527,6 @@ private static JObject GetExpectedIndexOrPageContext()
new JObject(
new JProperty(CatalogConstants.ContainerKeyword, CatalogConstants.SetKeyword),
new JProperty(CatalogConstants.IdKeyword, CatalogConstants.Tag))),
new JProperty(CatalogConstants.Reasons,
new JObject(
new JProperty(CatalogConstants.ContainerKeyword, CatalogConstants.SetKeyword))),
new JProperty(CatalogConstants.PackageTargetFrameworks,
new JObject(
new JProperty(CatalogConstants.ContainerKeyword, CatalogConstants.SetKeyword),
Expand Down
5 changes: 0 additions & 5 deletions tests/NgTests/CatalogConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ namespace NgTests
{
public static class CatalogConstants
{
public const string AlternatePackage = "alternatePackage";
public const string AppendOnlyCatalog = "AppendOnlyCatalog";
public const string Authors = "authors";
public const string Catalog = "catalog";
Expand All @@ -32,7 +31,6 @@ public static class CatalogConstants
public const string Dependency = "dependency";
public const string DependencyGroup = "dependencyGroup";
public const string DependencyGroups = "dependencyGroups";
public const string Deprecation = "deprecation";
public const string Description = "description";
public const string Details = "details";
public const string Entries = "entries";
Expand All @@ -50,7 +48,6 @@ public static class CatalogConstants
public const string Links = "links";
public const string Listed = "listed";
public const string Lower = "lower";
public const string Message = "message";
public const string MinClientVersion = "minClientVersion";
public const string Name = "name";
public const string NuGet = "nuget";
Expand Down Expand Up @@ -81,8 +78,6 @@ public static class CatalogConstants
public const string Permalink = "Permalink";
public const string ProjectUrl = "projectUrl";
public const string Published = "published";
public const string Range = "range";
public const string Reasons = "reasons";
public const string RequireLicenseAcceptance = "requireLicenseAcceptance";
public const string Registration = "registration";
public const string SetKeyword = "@set";
Expand Down

0 comments on commit 3c3bf53

Please sign in to comment.