2021-05-21 12:32:39 +02:00
|
|
|
|
using System.Configuration;
|
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
using Umbraco.Cms.Core.Composing;
|
|
|
|
|
|
using Umbraco.Cms.Core.DependencyInjection;
|
|
|
|
|
|
using Umbraco.Cms.Infrastructure.PublishedCache;
|
2021-04-26 15:40:46 +10:00
|
|
|
|
|
|
|
|
|
|
// see https://github.com/Shazwazza/UmbracoScripts/tree/master/src/LoadTesting
|
|
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.TestData
|
|
|
|
|
|
{
|
|
|
|
|
|
public class LoadTestComposer : ComponentComposer<LoadTestComponent>, IUserComposer
|
|
|
|
|
|
{
|
2021-05-21 12:32:39 +02:00
|
|
|
|
public override void Compose(IUmbracoBuilder builder)
|
2021-04-26 15:40:46 +10:00
|
|
|
|
{
|
2021-05-21 12:32:39 +02:00
|
|
|
|
base.Compose(builder);
|
2021-04-26 15:40:46 +10:00
|
|
|
|
|
|
|
|
|
|
if (ConfigurationManager.AppSettings["Umbraco.TestData.Enabled"] != "true")
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
2021-05-21 12:32:39 +02:00
|
|
|
|
builder.Services.AddScoped(typeof(LoadTestController), typeof(LoadTestController));
|
2021-04-26 15:40:46 +10:00
|
|
|
|
|
|
|
|
|
|
if (ConfigurationManager.AppSettings["Umbraco.TestData.IgnoreLocalDb"] == "true")
|
|
|
|
|
|
{
|
2021-05-21 12:32:39 +02:00
|
|
|
|
builder.Services.AddSingleton(factory => new PublishedSnapshotServiceOptions
|
2021-04-26 15:40:46 +10:00
|
|
|
|
{
|
|
|
|
|
|
IgnoreLocalDb = true
|
|
|
|
|
|
});
|
2021-05-21 12:32:39 +02:00
|
|
|
|
}
|
2021-04-26 15:40:46 +10:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|