Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Ensure language property is read from the nupkg

  • Loading branch information...
commit 91995845d04e671871217861cb75f49cf249cfa6 1 parent 5d648f4
@pranavkm pranavkm authored
View
3  .gitignore
@@ -9,4 +9,5 @@ _AzurePackage
*.bak
NuGetGallery.sln.docstates
_ReSharper.NuGetGallery
-_PackagedWebsite
+_PackagedWebsite
+TestResults
View
37 Facts/Services/PackageServiceFacts.cs
@@ -92,6 +92,7 @@ public void WillReadThePropertiesFromTheNuGetPackageWhenCreatingANewPackage()
Assert.Equal("theTags", package.Tags);
Assert.Equal("theTitle", package.Title);
Assert.Equal("theCopyright", package.Copyright);
+ Assert.Null(package.Language);
Assert.False(package.IsPrerelease);
Assert.Equal("theFirstAuthor, theSecondAuthor", package.FlattenedAuthors);
@@ -99,6 +100,27 @@ public void WillReadThePropertiesFromTheNuGetPackageWhenCreatingANewPackage()
}
[Fact]
+ public void WillReadTheLanguagePropertyFromThePackage()
+ {
+ var packageRegistrationRepo = new Mock<IEntityRepository<PackageRegistration>>();
+ var service = CreateService(
+ packageRegistrationRepo: packageRegistrationRepo,
+ setup: mockPackageSvc =>
+ {
+ mockPackageSvc.Setup(x => x.FindPackageRegistrationById(It.IsAny<string>())).Returns((PackageRegistration)null);
+ });
+ var nugetPackage = CreateNuGetPackage(p => p.Setup(s => s.Language).Returns("fr"));
+ var currentUser = new User();
+
+ var package = service.CreatePackage(
+ nugetPackage.Object,
+ currentUser);
+
+ // Assert
+ Assert.Equal("fr", package.Language);
+ }
+
+ [Fact]
public void WillReadPrereleaseFlagFromNuGetPackage()
{
// Arrange
@@ -415,6 +437,21 @@ void WillThrowIfTheNuGetPackageTitleIsLongerThan4000()
}
[Fact]
+ void WillThrowIfTheNuGetPackageLanguageIsLongerThan20()
+ {
+ // Arrange
+ var service = CreateService();
+ var nugetPackage = CreateNuGetPackage();
+ nugetPackage.Setup(x => x.Language).Returns(new string('a', 21));
+
+ // Act
+ var ex = Assert.Throws<EntityException>(() => service.CreatePackage(nugetPackage.Object, null));
+
+ // Assert
+ Assert.Equal(String.Format(Strings.NuGetPackagePropertyTooLong, "Language", "20"), ex.Message);
+ }
+
+ [Fact]
void WillSaveSupportedFrameworks()
{
var packageRegistrationRepo = new Mock<IEntityRepository<PackageRegistration>>();
View
3  Website/DataServices/PackageExtensions.cs
@@ -33,6 +33,7 @@ public static IQueryable<V1FeedPackage> ToV1FeedPackageQuery(this IQueryable<Pac
GalleryDetailsUrl = siteRoot + "packages/" + p.PackageRegistration.Id + "/" + p.Version,
IconUrl = p.IconUrl,
IsLatestVersion = p.IsLatestStable,
+ Language = p.Language,
LastUpdated = p.LastUpdated,
LicenseUrl = p.LicenseUrl,
PackageHash = p.Hash,
@@ -75,7 +76,7 @@ public static IQueryable<V2FeedPackage> ToV2FeedPackageQuery(this IQueryable<Pac
IsPrerelease = p.IsPrerelease,
LastUpdated = p.LastUpdated,
LicenseUrl = p.LicenseUrl,
- Language = null,
+ Language = p.Language,
PackageHash = p.Hash,
PackageHashAlgorithm = p.HashAlgorithm,
PackageSize = p.PackageFileSize,
View
2  Website/DataServices/V1FeedPackage.cs
@@ -24,6 +24,7 @@ public class V1FeedPackage
public string GalleryDetailsUrl { get; set; }
public string IconUrl { get; set; }
public bool IsLatestVersion { get; set; }
+ public string Language { get; set; }
public DateTime LastUpdated { get; set; }
public string LicenseUrl { get; set; }
public string PackageHash { get; set; }
@@ -62,7 +63,6 @@ public double VersionRating
}
public string Categories { get { return String.Empty; } }
- public string Language { get { return ""; } }
public string PackageType { get { return "Package"; } }
public decimal Price { get { return 0; } }
public bool Prerelease { get { return false; } }
View
2  Website/DataServices/V2FeedPackage.cs
@@ -25,9 +25,9 @@ public class V2FeedPackage
public bool IsLatestVersion { get; set; }
public bool IsAbsoluteLatestVersion { get; set; }
public bool IsPrerelease { get; set; }
+ public string Language { get; set; }
public DateTime LastUpdated { get; set; }
public DateTime Published { get; set; }
- public string Language { get; set; }
public string LicenseUrl { get; set; }
public string PackageHash { get; set; }
public string PackageHashAlgorithm { get; set; }
View
4 Website/Entities/Package.cs
@@ -36,6 +36,10 @@ public Package()
public bool IsLatestStable { get; set; }
public DateTime LastUpdated { get; set; }
public string LicenseUrl { get; set; }
+
+ [StringLength(20)]
+ public string Language { get; set; }
+
public DateTime Published { get; set; }
public long PackageFileSize { get; set; }
public string ProjectUrl { get; set; }
View
24 Website/Migrations/201208171904586_Language.Designer.cs
@@ -0,0 +1,24 @@
+// <auto-generated />
+namespace NuGetGallery.Migrations
+{
+ using System.Data.Entity.Migrations;
+ using System.Data.Entity.Migrations.Infrastructure;
+
+ public sealed partial class Language : IMigrationMetadata
+ {
+ string IMigrationMetadata.Id
+ {
+ get { return "201208171904586_Language"; }
+ }
+
+ string IMigrationMetadata.Source
+ {
+ get { return null; }
+ }
+
+ string IMigrationMetadata.Target
+ {
+ get { return "H4sIAAAAAAAEAO0dy3LcuPGeqvzD1JySVK1GdlKu3S1pt7SyvavEr/LYm6OKGkIjZjnkLMmxpfxaDvmk/EIIPkA8uvEgQc6MrYtKA4CNRqPRaDS60f/7z3/PfrzfxLNPJMujNDmfPzk5nc9IskrDKFmfz3fF7Tffzn/84Y9/OHsRbu5nv7btntJ25ZdJfj6/K4rt94tFvrojmyA/2USrLM3T2+JklW4WQZgunp6efrt4crogJYh5CWs2O3u/S4poQ6of5c/LNFmRbbEL4tdpSOK8KS9rlhXU2ZtgQ/JtsCLn8ze7n0nxcxDHJHuYzy7iKChxWJL41hGh0+8oQnPWVdnZixKp4uHDw5ZUHZ7PL3dZUJDwJSEh37Bs+g/yIBSURe+ydEuy4uE9uW0+LxvNZwvxw4X8JfuO/4jicD6/Soq/Pp3P3uziOLiJy4LbIM7JfLZ99v2ySDPyM0lIheC7oChIVs7LVUiqMTS0+H77zI4c3y1On1JyLIIkSYugKCdZwVzCk/5tEV0WWckv89nL6J6Er0iyLu4Ysq+D+7ak/Hc++5hEJXuVHxXZjvCDq39Lnb4JPk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MawvscIiTPqBYMiK0BYrOgrlWc1+KFbKCKQ7LYsiikzkwVI0X+pEM0cIfGhi3qxe1+bzLjRCs15AKVlX4dBWsyhe5RI9dnEAaz17cfKniX5cfCAm0XqUAKey9UEflEog23okCOT7iJDG6SfYdAPSdqnAiKaX9EYPpiDgF8FTInoYtqrpA9mOPcy8opppZ1ycE9jRwVeNGcgB7IwCQLgQlgsFJyichFN0fTlzijQywdw9OCgtvoIG6hEZjRxPQjUMO2R3FkipaL5ajJI7qP4Fpl7p8aIMGLp+hxGxtXofYWJb1Q4TT/yi+ARyyEKKTDlF3U21QCg2p0PzrhvJBFkznNhJJ8Pl3SL02iNmnJYL5LtBST9YmSRtfWcYsENp0cKOSD+ckx4stP7vGyARSUnOxurNFbeFpCsqfSgqus8X7XUJfXql/PSd5tO5A0MRiCVkJtzisDX31q71NkjBqm0hvPrwmRRAGRXCRFdFtsCrK6hXJ88ro+GsQ7yqLxg0Jr5K3u2K7K8ohk81NLGif9FJK1//ZQsH57G31SlnuYwglmhF9rOZt8tMuikOG90vgwQoEBL3tal4ionNJJ52sHxikN2liCaghH7uk+0A225i+x/02WQafCI6bmYYixc6eR8G61IF5CtYl7RNcAX1Sruui7ID/ouuv/Fmya7i5/+H/SzhO608YAQA="; }
+ }
+ }
+}
View
17 Website/Migrations/201208171904586_Language.cs
@@ -0,0 +1,17 @@
+namespace NuGetGallery.Migrations
+{
+ using System.Data.Entity.Migrations;
+
+ public partial class Language : DbMigration
+ {
+ public override void Up()
+ {
+ AddColumn("Packages", "Language", c => c.String(maxLength: 20));
+ }
+
+ public override void Down()
+ {
+ DropColumn("Packages", "Language");
+ }
+ }
+}
View
13 Website/Services/PackageService.cs
@@ -266,11 +266,12 @@ Package CreatePackageFromNuGetPackage(PackageRegistration packageRegistration, I
Hash = cryptoSvc.GenerateHash(packageFileStream.ReadAllBytes()),
PackageFileSize = packageFileStream.Length,
Created = now,
+ Language = nugetPackage.Language,
LastUpdated = now,
Published = now,
Copyright = nugetPackage.Copyright,
IsPrerelease = !nugetPackage.IsReleaseVersion(),
- Listed = true
+ Listed = true,
};
if (nugetPackage.IconUrl != null)
@@ -326,6 +327,7 @@ public virtual IEnumerable<FrameworkName> GetSupportedFrameworks(IPackage packag
static void ValidateNuGetPackage(IPackage nugetPackage)
{
+ // TODO: Change this to use DataAnnotations
if (nugetPackage.Id.Length > 128)
throw new EntityException(Strings.NuGetPackagePropertyTooLong, "Id", "128");
if (nugetPackage.Authors != null && String.Join(",", nugetPackage.Authors.ToArray()).Length > 4000)
@@ -342,12 +344,17 @@ static void ValidateNuGetPackage(IPackage nugetPackage)
throw new EntityException(Strings.NuGetPackagePropertyTooLong, "LicenseUrl", "4000");
if (nugetPackage.ProjectUrl != null && nugetPackage.ProjectUrl.ToString().Length > 4000)
throw new EntityException(Strings.NuGetPackagePropertyTooLong, "ProjectUrl", "4000");
- if (nugetPackage.Summary != null && nugetPackage.Summary.ToString().Length > 4000)
+ if (nugetPackage.Summary != null && nugetPackage.Summary.Length > 4000)
throw new EntityException(Strings.NuGetPackagePropertyTooLong, "Summary", "4000");
if (nugetPackage.Tags != null && nugetPackage.Tags.ToString().Length > 4000)
throw new EntityException(Strings.NuGetPackagePropertyTooLong, "Tags", "4000");
- if (nugetPackage.Title != null && nugetPackage.Title.ToString().Length > 4000)
+ if (nugetPackage.Title != null && nugetPackage.Title.Length > 4000)
throw new EntityException(Strings.NuGetPackagePropertyTooLong, "Title", "4000");
+
+ if (nugetPackage.Language != null && nugetPackage.Language.Length > 20)
+ {
+ throw new EntityException(Strings.NuGetPackagePropertyTooLong, "Language", "20");
+ }
}
private static void UpdateIsLatest(PackageRegistration packageRegistration)
View
4 Website/Website.csproj
@@ -355,6 +355,10 @@
<Compile Include="Migrations\201206250141447_ExecuteELMAHSql.Designer.cs">
<DependentUpon>201206250141447_ExecuteELMAHSql.cs</DependentUpon>
</Compile>
+ <Compile Include="Migrations\201208171904586_Language.cs" />
+ <Compile Include="Migrations\201208171904586_Language.Designer.cs">
+ <DependentUpon>201208171904586_Language.cs</DependentUpon>
+ </Compile>
<Compile Include="Migrations\MigrationsConfiguration.cs" />
<Compile Include="PackageCurators\IAutomaticPackageCurator.cs" />
<Compile Include="PackageCurators\AutomaticPackageCurator.cs" />
Please sign in to comment.
Something went wrong with that request. Please try again.