Merge remote-tracking branch 'origin/v9/dev' into v9/task/package-refactor

# Conflicts:
#	src/Umbraco.Core/Migrations/IMigration.cs
#	src/Umbraco.Core/Migrations/MigrationPlan.cs
#	src/Umbraco.Infrastructure/Migrations/IMigrationContext.cs
#	src/Umbraco.Infrastructure/Runtime/RuntimeState.cs
#	src/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Migrations/MigrationTests.cs
#	src/Umbraco.Web.UI.NetCore/umbraco/config/lang/en.xml
#	src/Umbraco.Web.UI.NetCore/umbraco/config/lang/en_us.xml
This commit is contained in:
Bjarke Berg
2021-06-29 14:23:08 +02:00
283 changed files with 6740 additions and 2365 deletions

View File

@@ -21,7 +21,6 @@ namespace Umbraco.Cms.Tests.Integration
// ensure composers are added
protected override void CustomTestSetup(IUmbracoBuilder builder)
{
builder.AddNuCache();
builder.AddComposers();
}

View File

@@ -23,6 +23,7 @@ namespace Umbraco.Cms.Tests.Integration.Testing
private readonly Lazy<IMapperCollection> _mappers;
private readonly IDbProviderFactoryCreator _dbProviderFactoryCreator;
private readonly DatabaseSchemaCreatorFactory _databaseSchemaCreatorFactory;
private readonly NPocoMapperCollection _npocoMappers;
public TestUmbracoDatabaseFactoryProvider(
ILoggerFactory loggerFactory,
@@ -30,7 +31,8 @@ namespace Umbraco.Cms.Tests.Integration.Testing
IOptions<ConnectionStrings> connectionStrings,
Lazy<IMapperCollection> mappers,
IDbProviderFactoryCreator dbProviderFactoryCreator,
DatabaseSchemaCreatorFactory databaseSchemaCreatorFactory)
DatabaseSchemaCreatorFactory databaseSchemaCreatorFactory,
NPocoMapperCollection npocoMappers)
{
_loggerFactory = loggerFactory;
_globalSettings = globalSettings;
@@ -38,19 +40,18 @@ namespace Umbraco.Cms.Tests.Integration.Testing
_mappers = mappers;
_dbProviderFactoryCreator = dbProviderFactoryCreator;
_databaseSchemaCreatorFactory = databaseSchemaCreatorFactory;
_npocoMappers = npocoMappers;
}
public IUmbracoDatabaseFactory Create()
{
// ReSharper disable once ArrangeMethodOrOperatorBody
return new UmbracoDatabaseFactory(
=> new UmbracoDatabaseFactory(
_loggerFactory.CreateLogger<UmbracoDatabaseFactory>(),
_loggerFactory,
_globalSettings,
_connectionStrings,
_mappers,
_dbProviderFactoryCreator,
_databaseSchemaCreatorFactory);
}
_databaseSchemaCreatorFactory,
_npocoMappers);
}
}

View File

@@ -204,7 +204,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Migrations
{
}
public override void Migrate() =>
protected override void Migrate() =>
// Create User table with keys, indexes, etc.
Create.Table<UserDto>().Do();
@@ -217,7 +217,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Migrations
{
}
public override void Migrate()
protected override void Migrate()
{
// drops User table keys and indexes
// Execute.DropKeysAndIndexes("umbracoUser");
@@ -243,7 +243,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Migrations
{
}
public override void Migrate() =>
protected override void Migrate() =>
// Create User table keys and indexes.
Create.KeysAndIndexes<UserDto>().Do();
@@ -256,7 +256,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Migrations
{
}
public override void Migrate()
protected override void Migrate()
{
// Creates *all* tables keys and indexes
foreach (Type x in DatabaseSchemaCreator.OrderedTables)
@@ -279,7 +279,7 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Migrations
{
}
public override void Migrate()
protected override void Migrate()
{
// cannot delete the column without this, of course
Delete.KeysAndIndexes("umbracoUser").Do();

View File

@@ -8,6 +8,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using NPoco;
using NUnit.Framework;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.Models;
@@ -17,6 +18,7 @@ using Umbraco.Cms.Core.Sync;
using Umbraco.Cms.Infrastructure.Persistence;
using Umbraco.Cms.Infrastructure.Persistence.Dtos;
using Umbraco.Cms.Infrastructure.PublishedCache;
using Umbraco.Cms.Infrastructure.PublishedCache.DataSource;
using Umbraco.Cms.Tests.Common.Builders;
using Umbraco.Cms.Tests.Common.Testing;
using Umbraco.Cms.Tests.Integration.Testing;
@@ -51,12 +53,14 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services
protected override void CustomTestSetup(IUmbracoBuilder builder)
{
InMemoryConfiguration[Constants.Configuration.ConfigNuCache + ":" + nameof(NuCacheSettings.NuCacheSerializerType)] = NuCacheSerializerType.JSON.ToString();
builder.AddNuCache();
builder.Services.AddUnique<IServerMessenger, ScopedRepositoryTests.LocalServerMessenger>();
}
private void AssertJsonStartsWith(int id, string expected)
{
string json = GetJson(id).Replace('"', '\'');
int pos = json.IndexOf("'cd':", StringComparison.InvariantCultureIgnoreCase);
json = json.Substring(0, pos + "'cd':".Length);

View File

@@ -183,27 +183,27 @@ namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services
// Arrange
MediaType mediaType = MediaTypeBuilder.CreateNewMediaType();
MediaTypeService.Save(mediaType);
IMedia media = MediaService.CreateMedia(string.Empty, -1, "video");
IMedia media = MediaService.CreateMedia(string.Empty, -1, Constants.Conventions.MediaTypes.VideoAlias);
// Act & Assert
Assert.Throws<ArgumentException>(() => MediaService.Save(media));
}
/*
[Test]
public void Ensure_Content_Xml_Created()
{
var mediaType = MockedContentTypes.CreateVideoMediaType();
MediaTypeService.Save(mediaType);
var media = MediaService.CreateMedia("Test", -1, "video");
MediaService.Save(media);
using (var scope = ScopeProvider.CreateScope())
{
Assert.IsTrue(scope.Database.Exists<ContentXmlDto>(media.Id));
}
}*/
// [Test]
// public void Ensure_Content_Xml_Created()
// {
// var mediaType = MediaTypeBuilder.CreateVideoMediaType();
// MediaTypeService.Save(mediaType);
// var media = MediaService.CreateMedia("Test", -1, Constants.Conventions.MediaTypes.VideoAlias);
//
// MediaService.Save(media);
//
// using (var scope = ScopeProvider.CreateScope())
// {
// Assert.IsTrue(scope.Database.Exists<ContentXmlDto>(media.Id));
// }
// }
[Test]
public void Can_Get_Media_By_Path()

View File

@@ -12,11 +12,17 @@
</PropertyGroup>
<ItemGroup>
<Compile Remove="App_Data\**" />
<Compile Remove="TEMP\**" />
<Compile Remove="Umbraco\**" />
<EmbeddedResource Remove="App_Data\**" />
<EmbeddedResource Remove="TEMP\**" />
<EmbeddedResource Remove="Umbraco\**" />
<None Remove="App_Data\**" />
<None Remove="TEMP\**" />
<Compile Remove="Views\**" />
<EmbeddedResource Remove="Views\**" />
<None Remove="Umbraco\**" />
<None Remove="Views\**" />
<None Remove="create_slicing_filter_condition.sh" />
<None Remove="Umbraco.Examine.Lucene\UmbracoExamine\TestFiles\media.xml" />
@@ -66,10 +72,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Examine.Lucene" Version="2.0.0-beta.150" />
<PackageReference Include="Examine.Lucene" Version="2.0.0-beta.154" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="5.0.6" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="5.0.7" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="NUnit" Version="3.13.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0">
@@ -80,10 +86,6 @@
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
</ItemGroup>
<ItemGroup>
<Folder Include="Umbraco\logs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Umbraco.Core\Umbraco.Core.csproj" />
<ProjectReference Include="..\Umbraco.Infrastructure\Umbraco.Infrastructure.csproj" />