From 733de4a1669f3806964d93d657cd2ee729833199 Mon Sep 17 00:00:00 2001 From: Louis DeJardin Date: Tue, 30 Nov 2010 13:46:13 -0800 Subject: [PATCH 1/6] Adding a component to experimental module to capture ioc costing --HG-- branch : perf extra : rebase_source : aa936df6717501a84fafce41f8130ced8217fa42 --- .../profiling-setup-commands.txt | 2 +- .../Orchard.Experimental/ContainerSpy.cs | 311 ++++++++++++++++++ .../Controllers/HomeController.cs | 11 +- .../Orchard.Experimental.csproj | 2 + 4 files changed, 324 insertions(+), 2 deletions(-) create mode 100644 src/Orchard.Web/Modules/Orchard.Experimental/ContainerSpy.cs diff --git a/src/Orchard.Profile/profiling-setup-commands.txt b/src/Orchard.Profile/profiling-setup-commands.txt index 5f23eb33a..0ce689258 100644 --- a/src/Orchard.Profile/profiling-setup-commands.txt +++ b/src/Orchard.Profile/profiling-setup-commands.txt @@ -1 +1 @@ -setup /SiteName:Profiling /AdminUsername:admin /AdminPassword:profiling-secret /DatabaseProvider:SqlCe /EnabledFeatures:Profiling,Orchard.Framework,Routable,Common,Dashboard,Feeds,Orchard.PublishLater,HomePage,Contents,Navigation,Reports,Scheduling,Indexing,Settings,Localization,XmlRpc,Orchard.Users,Orchard.Roles,TinyMce,Orchard.Themes,Orchard.MultiTenancy,Orchard.Blogs,Orchard.Comments,Orchard.Modules,Orchard.Scripting,Orchard.Scripting.Lightweight,Orchard.Widgets,Orchard.Media,Orchard.Tags,Orchard.Experimental +setup /SiteName:Profiling /AdminUsername:admin /AdminPassword:profiling-secret /DatabaseProvider:SQLServer /DatabaseConnectionString:"Data Source=.;Initial Catalog=Orchard;Integrated Security=True" /EnabledFeatures:Profiling,Orchard.Framework,Common,Containers,Contents,Dashboard,Feeds,HomePage,Navigation,Reports,Routable,Scheduling,Settings,Shapes,Orchard.PublishLater,Orchard.Blogs,Orchard.Comments,Orchard.ContentTypes,Orchard.jQuery,Orchard.Lists,Orchard.Media,Orchard.Modules,Orchard.Pages,Orchard.Roles,Orchard.Tags,Orchard.Themes,Orchard.Users,Orchard.Scripting,Orchard.Scripting.Lightweight,Orchard.Widgets,TinyMce,TheThemeMachine diff --git a/src/Orchard.Web/Modules/Orchard.Experimental/ContainerSpy.cs b/src/Orchard.Web/Modules/Orchard.Experimental/ContainerSpy.cs new file mode 100644 index 000000000..1dc981610 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Experimental/ContainerSpy.cs @@ -0,0 +1,311 @@ +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Threading; +using System.Xml.Linq; +using Autofac; +using Autofac.Core; + +namespace Orchard.Experimental { + // note - not thread aware + + public interface IContainerSpyOutput { + void Write(XElement target); + } + + public class ContainerSpy : Module, IDependency { + private readonly ConcurrentDictionary _contexts = new ConcurrentDictionary(); + + protected override void Load(ContainerBuilder builder) { + builder.RegisterInstance(new Output(_contexts)).As(); + + //builder.RegisterCallback(cr => cr.Registered += (_, registered) => { + // registered.ComponentRegistration.Preparing += (__, preparing) => Preparing(GetContext(_contexts), preparing); + // registered.ComponentRegistration.Activating += (__, activating) => Activating(GetContext(_contexts), activating); + // registered.ComponentRegistration.Activated += (__, activated) => Activated(GetContext(_contexts), activated); + //}); + } + + protected override void AttachToComponentRegistration(IComponentRegistry componentRegistry, IComponentRegistration registration) { + registration.Preparing += (__, preparing) => Preparing(GetContext(_contexts), preparing); + registration.Activating += (__, activating) => Activating(GetContext(_contexts), activating); + registration.Activated += (__, activated) => Activated(GetContext(_contexts), activated); + } + + static ThreadContext GetContext(ConcurrentDictionary nodes) { + return nodes.GetOrAdd(Thread.CurrentThread.ManagedThreadId, _ => { + var tc = new ThreadContext(); + tc.Root = tc.Clock = tc.Chain = tc.Focus = new Node(tc); + return tc; + }); + } + + private static void Preparing(ThreadContext context, PreparingEventArgs preparing) { + context.Focus = context.Focus.Preparing(preparing); + context.Chain = context.Chain.Link(preparing, context.Focus); + context.Clock = MoveClock(context.Clock, context.Focus); + } + + private static void Activating(ThreadContext context, ActivatingEventArgs activating) { + context.Focus = context.Focus.Activating(activating); + } + + private static void Activated(ThreadContext context, ActivatedEventArgs activated) { + context.Clock = MoveClock(context.Clock, context.Root); + context.Chain = context.Chain.Activated(activated); + } + + private static Node MoveClock(Node currentClock, Node newClock) { + var scanEnable = newClock; + while (scanEnable.Hot == false) { + scanEnable.Hot = true; + scanEnable = scanEnable._parent; + } + + var scanDisable = currentClock; + while (scanDisable != scanEnable) { + scanDisable.Hot = false; + scanDisable = scanDisable._parent; + } + return newClock; + } + + + + + class ThreadContext { + public Node Root { get; set; } + public Node Focus { get; set; } + public Node Chain { get; set; } + public Node Clock { get; set; } + } + + class Node { + private readonly ThreadContext _threadContext; + public Node _parent; + private Node _chain; + public readonly IComponentRegistration _component; + public readonly IDictionary _children = new Dictionary(); + + public int _preparingCount; + public int _activatingCount; + public int _activatedCount; + + private bool _hot; + readonly Stopwatch _stopwatch = new Stopwatch(); + private long _time; + + public Node(ThreadContext threadContext) { + _threadContext = threadContext; + _hot = true; // meta-nodes are hot to avoid any timing + } + + public Node(Node parent, IComponentRegistration component) { + _threadContext = parent._threadContext; + _parent = parent; + _component = component; + } + + public bool Hot { + get { + return _hot; + } + set { + if (_hot == value) + return; + + _hot = value; + if (_hot) { + _stopwatch.Start(); + } + else { + _stopwatch.Stop(); + } + } + } + + public long Time { + get { return _time+ _stopwatch.ElapsedTicks * 1000000 / Stopwatch.Frequency; } + } + public void AddTime(long time) { _time += time; } + + public override string ToString() { + if (_component == null) + return "root"; + + return _component.ToString(); + } + + + private static void TraceMessage(string format, IComponentRegistration component) { + //Trace.WriteLine(Message(format, component)); + } + private static string Message(string format, IComponentRegistration component) { + return string.Format(format, component.Id, string.Join(",", component.Services), Thread.CurrentThread.ManagedThreadId); + } + + public Node Preparing(PreparingEventArgs e) { + // move focus down a level on the tree + // add a link in chain + Node child; + lock (_children) { + if (!_children.TryGetValue(e.Component.Id, out child)) { + child = new Node(this, e.Component); + _children[e.Component.Id] = child; + } + } + + TraceMessage("Preparing[{2}] {0} {1}", e.Component); + Interlocked.Increment(ref child._preparingCount); + return child; + } + + public Node Link(PreparingEventArgs e, Node focus) { + if (focus._chain != null) { + TraceMessage("REACTIVATED: Preparing[{2}] {0} {1}", e.Component); + } + focus._chain = this; + return focus; + } + + public Node Activating(ActivatingEventArgs e) { + // move focus up a level on the tree + if (_component == null) { + TraceMessage("UNMATCHED: Activating[{2}] {0} {1}", e.Component); + return this; + } + + if (_component.Id != e.Component.Id) { + TraceMessage("MISSING: Activating[{2}] {0} {1}", _component); + return _parent.Activating(e); + } + + TraceMessage("Activating[{2}] {0} {1}", e.Component); + Interlocked.Increment(ref _activatingCount); + return _parent; + } + + public Node Activated(ActivatedEventArgs e) { + // remove a link in chain + if (_component == null) { + TraceMessage("UNMATCHED: Activated[{2}] {0} {1}", e.Component); + return this; + } + + if (_component.Id != e.Component.Id) { + _chain = _chain.Activated(e); + return this; + } + + TraceMessage("Activated[{2}] {0} {1}", e.Component); + Interlocked.Increment(ref _activatedCount); + var chain = _chain; + _chain = null; + return chain; + } + + } + + class Output : IContainerSpyOutput { + private readonly ConcurrentDictionary _root; + + public Output(ConcurrentDictionary root) { + _root = root; + } + + public void Write(XElement target) { + var elts = _root.Values + .Select(entry => Write(entry.Root)) + .OrderByDescending(GetWeight) + .ToArray(); + + var merged = _root.Values.Aggregate(new Node(null), (a, n) => Merge(a, n.Root)); + + var totals = new TotalVisitor(); + totals.Visit(merged); + + target.Add(Write(merged)); + target.Add(Write(totals._totals)); + target.Add(elts); + } + + private class TotalVisitor { + public Node _totals = new Node(null); + + public void Visit(Node source) { + foreach (var child in source._children) { + Visit(child.Key, child.Value); + } + } + + public void Visit(Guid key, Node source) { + Node target; + if (!_totals._children.TryGetValue(key, out target)) { + target = new Node(_totals, source._component); + _totals._children[key] = target; + } + target._preparingCount += source._preparingCount; + target._activatingCount += source._activatingCount; + target._activatedCount += source._activatedCount; + foreach (var child in source._children) { + Visit(child.Key, child.Value); + } + } + + } + + private static Node Merge(Node target, Node source) { + target._preparingCount += source._preparingCount; + target._activatingCount += source._activatingCount; + target._activatedCount += source._activatedCount; + target.AddTime(source.Time); + foreach (var sourceChild in source._children) { + Node targetChild; + if (!target._children.TryGetValue(sourceChild.Key, out targetChild)) { + targetChild = new Node(target, sourceChild.Value._component); + target._children[sourceChild.Key] = targetChild; + } + Merge(targetChild, sourceChild.Value); + } + return target; + } + + private XElement Write(Node node) { + var elt = new XElement( + "Component", + new XAttribute("services", node._component != null ? string.Join(",", node._component.Services) : "root"), + new XAttribute("preparing", node._preparingCount), + new XAttribute("activating", node._activatingCount), + new XAttribute("activated", node._activatedCount)); + + lock (node._children) { + var elts = node._children.Values + .Select(Write) + .OrderByDescending(GetMicrosecondInclusive) + .ToArray(); + elt.Add(elts); + + var weight = elts.Aggregate(node._preparingCount, (a, e) => a + GetWeight(e)); + + elt.SetAttributeValue("weight", weight); + elt.SetAttributeValue("usinc", node.Time); + if (weight != 0) + elt.SetAttributeValue("usincper", node.Time / weight); + } + + return elt; + } + + private static long GetMicrosecondInclusive(XElement elt) { + var attr = elt.Attribute("usinc"); + return attr == null ? 0 : long.Parse(attr.Value); + } + private static int GetWeight(XElement elt) { + var attr = elt.Attribute("weight"); + return attr == null ? 0 : int.Parse(attr.Value); + } + } + } +} diff --git a/src/Orchard.Web/Modules/Orchard.Experimental/Controllers/HomeController.cs b/src/Orchard.Web/Modules/Orchard.Experimental/Controllers/HomeController.cs index 96e7eaef2..c4d0a94f3 100644 --- a/src/Orchard.Web/Modules/Orchard.Experimental/Controllers/HomeController.cs +++ b/src/Orchard.Web/Modules/Orchard.Experimental/Controllers/HomeController.cs @@ -1,6 +1,7 @@ using System; using System.Web; using System.Web.Mvc; +using System.Xml.Linq; using Orchard.Experimental.Models; using Orchard.DisplayManagement; using Orchard.Localization; @@ -13,9 +14,11 @@ namespace Orchard.Experimental.Controllers { [Themed, Admin] public class HomeController : Controller { private readonly INotifier _notifier; + private readonly IContainerSpyOutput _containerSpyOutput; - public HomeController(INotifier notifier, IShapeFactory shapeFactory) { + public HomeController(INotifier notifier, IShapeFactory shapeFactory, IContainerSpyOutput containerSpyOutput) { _notifier = notifier; + _containerSpyOutput = containerSpyOutput; T = NullLocalizer.Instance; Shape = shapeFactory; } @@ -107,6 +110,12 @@ namespace Orchard.Experimental.Controllers { public static string Break(dynamic view) { return view.Model.Box.Title; } + + public ActionResult ContainerData() { + var root = new XElement("root"); + _containerSpyOutput.Write(root); + return Content(root.ToString(), "text/xml"); + } } } diff --git a/src/Orchard.Web/Modules/Orchard.Experimental/Orchard.Experimental.csproj b/src/Orchard.Web/Modules/Orchard.Experimental/Orchard.Experimental.csproj index 199efe302..227310757 100644 --- a/src/Orchard.Web/Modules/Orchard.Experimental/Orchard.Experimental.csproj +++ b/src/Orchard.Web/Modules/Orchard.Experimental/Orchard.Experimental.csproj @@ -34,6 +34,7 @@ 4 + ..\..\..\..\lib\nhprof\HibernatingRhinos.Profiler.Appender.dll @@ -53,6 +54,7 @@ + From 2a0c34bcab0f097c0e16b7f3ca90beb7e254596b Mon Sep 17 00:00:00 2001 From: Suha Can Date: Wed, 1 Dec 2010 15:33:04 -0800 Subject: [PATCH 2/6] PERF: Fixing 16889 IText pooling --HG-- branch : perf --- src/Orchard/Localization/IText.cs | 2 +- src/Orchard/Localization/LocalizationModule.cs | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Orchard/Localization/IText.cs b/src/Orchard/Localization/IText.cs index 26579a12f..8ebcf880d 100644 --- a/src/Orchard/Localization/IText.cs +++ b/src/Orchard/Localization/IText.cs @@ -1,5 +1,5 @@ namespace Orchard.Localization { - public interface IText { + public interface IText : ISingletonDependency { LocalizedString Get(string textHint, params object[] args); } } \ No newline at end of file diff --git a/src/Orchard/Localization/LocalizationModule.cs b/src/Orchard/Localization/LocalizationModule.cs index 6dd193a1f..254a769c5 100644 --- a/src/Orchard/Localization/LocalizationModule.cs +++ b/src/Orchard/Localization/LocalizationModule.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Reflection; using Autofac; using Autofac.Core; @@ -6,6 +7,11 @@ using Module = Autofac.Module; namespace Orchard.Localization { public class LocalizationModule : Module { + private readonly IDictionary _localizerCache; + + public LocalizationModule() { + _localizerCache = new Dictionary(); + } protected override void Load(ContainerBuilder builder) { builder.RegisterType().As().InstancePerDependency(); @@ -19,8 +25,14 @@ namespace Orchard.Localization { var scope = registration.Activator.LimitType.FullName; registration.Activated += (sender, e) => { - var localizer = LocalizationUtilities.Resolve(e.Context, scope); - userProperty.SetValue(e.Instance, localizer, null); + if (_localizerCache.ContainsKey(scope)) { + userProperty.SetValue(e.Instance, _localizerCache[scope], null); + } + else { + var localizer = LocalizationUtilities.Resolve(e.Context, scope); + _localizerCache.Add(scope, localizer); + userProperty.SetValue(e.Instance, localizer, null); + } }; } } From a4b1f2f36dee8a2164de47f2a7ae4646f77f6854 Mon Sep 17 00:00:00 2001 From: Suha Can Date: Wed, 1 Dec 2010 15:46:13 -0800 Subject: [PATCH 3/6] PERF: Fixing 16890 ILogger pooling --HG-- branch : perf --- src/Orchard/Logging/ILogger.cs | 2 +- src/Orchard/Logging/LoggingModule.cs | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Orchard/Logging/ILogger.cs b/src/Orchard/Logging/ILogger.cs index 045db2ef8..6e7963609 100644 --- a/src/Orchard/Logging/ILogger.cs +++ b/src/Orchard/Logging/ILogger.cs @@ -9,7 +9,7 @@ namespace Orchard.Logging { Fatal } - public interface ILogger { + public interface ILogger : ISingletonDependency { bool IsEnabled(LogLevel level); void Log(LogLevel level, Exception exception, string format, params object[] args); } diff --git a/src/Orchard/Logging/LoggingModule.cs b/src/Orchard/Logging/LoggingModule.cs index 9474c5671..de55b5017 100644 --- a/src/Orchard/Logging/LoggingModule.cs +++ b/src/Orchard/Logging/LoggingModule.cs @@ -11,6 +11,12 @@ using Module = Autofac.Module; namespace Orchard.Logging { public class LoggingModule : Module { + private readonly IDictionary _loggerCache; + + public LoggingModule() { + _loggerCache = new Dictionary(); + } + protected override void Load(ContainerBuilder moduleBuilder) { // by default, use Orchard's logger that delegates to Castle's logger factory moduleBuilder.RegisterType().As().InstancePerLifetimeScope(); @@ -65,8 +71,15 @@ namespace Orchard.Logging { var propertyInfo = entry.PropertyInfo; yield return (ctx, instance) => { - var propertyValue = ctx.Resolve(new TypedParameter(typeof(Type), componentType)); - propertyInfo.SetValue(instance, propertyValue, null); + string component = componentType.ToString(); + if (_loggerCache.ContainsKey(component)) { + propertyInfo.SetValue(instance, _loggerCache[component], null); + } + else { + var propertyValue = ctx.Resolve(new TypedParameter(typeof(Type), componentType)); + _loggerCache.Add(component, propertyValue); + propertyInfo.SetValue(instance, propertyValue, null); + } }; } } From b88178b5421adb95b746bbcb6ccd2119f9f930f1 Mon Sep 17 00:00:00 2001 From: Louis DeJardin Date: Wed, 1 Dec 2010 19:37:10 -0800 Subject: [PATCH 4/6] Avoiding the eager creation of certain proxies to optional records cannot be done in fluent config the IsSelectable = false prevents unused ContentPartRecord proxies from being created for each ContentItemRecord or ContentItemVersionRecord. done for perf reasons - has no other side-effect --HG-- branch : perf --- src/Orchard/Data/SessionFactoryHolder.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Orchard/Data/SessionFactoryHolder.cs b/src/Orchard/Data/SessionFactoryHolder.cs index 56f4038fa..f7ba7389a 100644 --- a/src/Orchard/Data/SessionFactoryHolder.cs +++ b/src/Orchard/Data/SessionFactoryHolder.cs @@ -86,6 +86,23 @@ namespace Orchard.Data { _dataServicesProviderFactory .CreateProvider(parameters) .BuildConfiguration(parameters)); + + #region NH-2.1.2 specific optimization + // cannot be done in fluent config + // the IsSelectable = false prevents unused ContentPartRecord proxies from being created + // for each ContentItemRecord or ContentItemVersionRecord. + // done for perf reasons - has no other side-effect + + foreach (var persistentClass in config.ClassMappings) { + if (persistentClass.EntityName.StartsWith("Orchard.ContentManagement.Records.")) { + foreach (var property in persistentClass.PropertyIterator) { + if (property.Name.EndsWith("Record") && !property.IsBasicPropertyAccessor) { + property.IsSelectable = false; + } + } + } + } + #endregion return config; } From 5a0742d61d74c706e4233a196078c520f03c8885 Mon Sep 17 00:00:00 2001 From: Suha Can Date: Thu, 2 Dec 2010 16:11:47 -0800 Subject: [PATCH 5/6] PERF: 16858 Shape table cached too aggressively, should expired on file changes, deletion and creation --HG-- branch : perf --- src/Orchard.Web/Modules/Orchard.Setup/SetupMode.cs | 3 ++- .../Descriptors/DefaultShapeTableManager.cs | 13 +++++++------ .../DisplayManagement/Descriptors/Interfaces.cs | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Setup/SetupMode.cs b/src/Orchard.Web/Modules/Orchard.Setup/SetupMode.cs index f7f185abb..5db72cf02 100644 --- a/src/Orchard.Web/Modules/Orchard.Setup/SetupMode.cs +++ b/src/Orchard.Web/Modules/Orchard.Setup/SetupMode.cs @@ -1,8 +1,8 @@ using System; -using System.Collections.Generic; using System.Web.Routing; using Autofac; using JetBrains.Annotations; +using Orchard.Caching; using Orchard.Commands; using Orchard.Commands.Builtin; using Orchard.ContentManagement; @@ -46,6 +46,7 @@ namespace Orchard.Setup { builder.RegisterModule(new MvcModule()); builder.RegisterModule(new CommandModule()); builder.RegisterModule(new WorkContextModule()); + builder.RegisterModule(new CacheModule()); builder.RegisterType().As().InstancePerLifetimeScope(); builder.RegisterType().As().InstancePerLifetimeScope(); diff --git a/src/Orchard/DisplayManagement/Descriptors/DefaultShapeTableManager.cs b/src/Orchard/DisplayManagement/Descriptors/DefaultShapeTableManager.cs index e5cf361c6..0087b87b8 100644 --- a/src/Orchard/DisplayManagement/Descriptors/DefaultShapeTableManager.cs +++ b/src/Orchard/DisplayManagement/Descriptors/DefaultShapeTableManager.cs @@ -1,29 +1,30 @@ using System; -using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using Autofac.Features.Metadata; +using Orchard.Caching; using Orchard.Environment.Extensions; using Orchard.Environment.Extensions.Models; using Orchard.Utility; namespace Orchard.DisplayManagement.Descriptors { - public class DefaultShapeTableManager : IShapeTableManager, ISingletonDependency { + public class DefaultShapeTableManager : IShapeTableManager { private readonly IEnumerable> _bindingStrategies; private readonly IExtensionManager _extensionManager; + private readonly ICacheManager _cacheManager; public DefaultShapeTableManager( IEnumerable> bindingStrategies, - IExtensionManager extensionManager) { + IExtensionManager extensionManager, + ICacheManager cacheManager) { _extensionManager = extensionManager; + _cacheManager = cacheManager; _bindingStrategies = bindingStrategies; } - readonly ConcurrentDictionary _tables = new ConcurrentDictionary(); - public ShapeTable GetShapeTable(string themeName) { - return _tables.GetOrAdd(themeName ?? "", x => { + return _cacheManager.Get(themeName ?? "", x => { var builderFactory = new ShapeTableBuilderFactory(); foreach (var bindingStrategy in _bindingStrategies) { Feature strategyDefaultFeature = bindingStrategy.Metadata.ContainsKey("Feature") ? diff --git a/src/Orchard/DisplayManagement/Descriptors/Interfaces.cs b/src/Orchard/DisplayManagement/Descriptors/Interfaces.cs index 11be14c3a..dfe5a13ba 100644 --- a/src/Orchard/DisplayManagement/Descriptors/Interfaces.cs +++ b/src/Orchard/DisplayManagement/Descriptors/Interfaces.cs @@ -1,6 +1,6 @@ namespace Orchard.DisplayManagement.Descriptors { - public interface IShapeTableManager : IDependency { + public interface IShapeTableManager : ISingletonDependency { ShapeTable GetShapeTable(string themeName); } From 946257f5138bb3e5aff606ecb660d5554754e101 Mon Sep 17 00:00:00 2001 From: Suha Can Date: Fri, 3 Dec 2010 12:19:02 -0800 Subject: [PATCH 6/6] Fixing unit test failures introduced by ShapeTable caching changes. --HG-- branch : perf --- .../Common/Providers/CommonPartProviderTests.cs | 2 ++ .../Descriptors/DefaultShapeTableManagerTests.cs | 6 ++++-- src/Orchard.Tests/DisplayManagement/ShapeFactoryTests.cs | 8 +++----- src/Orchard.Tests/DisplayManagement/ShapeHelperTests.cs | 9 +++------ src/Orchard.Tests/DisplayManagement/SubsystemTests.cs | 3 +++ 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/Orchard.Core.Tests/Common/Providers/CommonPartProviderTests.cs b/src/Orchard.Core.Tests/Common/Providers/CommonPartProviderTests.cs index 8f1222e2b..4986cb536 100644 --- a/src/Orchard.Core.Tests/Common/Providers/CommonPartProviderTests.cs +++ b/src/Orchard.Core.Tests/Common/Providers/CommonPartProviderTests.cs @@ -6,6 +6,7 @@ using Autofac; using JetBrains.Annotations; using Moq; using NUnit.Framework; +using Orchard.Caching; using Orchard.ContentManagement.Aspects; using Orchard.ContentManagement.Drivers; using Orchard.ContentManagement.Drivers.Coordinators; @@ -53,6 +54,7 @@ namespace Orchard.Core.Tests.Common.Providers { builder.RegisterType().As(); builder.RegisterType().As(); builder.RegisterType().As(); + builder.RegisterType().As(); builder.RegisterInstance(new Mock().Object); builder.RegisterInstance(new Mock().Object); builder.RegisterInstance(new Mock().Object); diff --git a/src/Orchard.Tests/DisplayManagement/Descriptors/DefaultShapeTableManagerTests.cs b/src/Orchard.Tests/DisplayManagement/Descriptors/DefaultShapeTableManagerTests.cs index 5cdf6e35d..6c7bdc513 100644 --- a/src/Orchard.Tests/DisplayManagement/Descriptors/DefaultShapeTableManagerTests.cs +++ b/src/Orchard.Tests/DisplayManagement/Descriptors/DefaultShapeTableManagerTests.cs @@ -3,18 +3,20 @@ using System.Collections.Generic; using System.Linq; using Autofac; using NUnit.Framework; +using Orchard.Caching; using Orchard.ContentManagement; using Orchard.DisplayManagement.Descriptors; using Orchard.DisplayManagement.Implementation; -using Orchard.Environment.Descriptor.Models; using Orchard.Environment.Extensions; using Orchard.Environment.Extensions.Models; +using Orchard.Tests.Stubs; namespace Orchard.Tests.DisplayManagement.Descriptors { [TestFixture] public class DefaultShapeTableManagerTests : ContainerTestBase { - protected override void Register(Autofac.ContainerBuilder builder) { + protected override void Register(ContainerBuilder builder) { builder.RegisterType().As(); + builder.RegisterType().As(); var features = new [] { new FeatureDescriptor { diff --git a/src/Orchard.Tests/DisplayManagement/ShapeFactoryTests.cs b/src/Orchard.Tests/DisplayManagement/ShapeFactoryTests.cs index d217198b8..bda26c966 100644 --- a/src/Orchard.Tests/DisplayManagement/ShapeFactoryTests.cs +++ b/src/Orchard.Tests/DisplayManagement/ShapeFactoryTests.cs @@ -1,9 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Autofac; +using Autofac; using NUnit.Framework; +using Orchard.Caching; using Orchard.DisplayManagement; using Orchard.DisplayManagement.Descriptors; using Orchard.DisplayManagement.Implementation; @@ -22,6 +19,7 @@ namespace Orchard.Tests.DisplayManagement { builder.RegisterType().As(); builder.RegisterType().As(); builder.RegisterType().As(); + builder.RegisterType().As(); _container = builder.Build(); } diff --git a/src/Orchard.Tests/DisplayManagement/ShapeHelperTests.cs b/src/Orchard.Tests/DisplayManagement/ShapeHelperTests.cs index ce6b42307..953efdadf 100644 --- a/src/Orchard.Tests/DisplayManagement/ShapeHelperTests.cs +++ b/src/Orchard.Tests/DisplayManagement/ShapeHelperTests.cs @@ -1,13 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Autofac; +using Autofac; using NUnit.Framework; +using Orchard.Caching; using Orchard.DisplayManagement; using Orchard.DisplayManagement.Descriptors; using Orchard.DisplayManagement.Implementation; -using Orchard.DisplayManagement.Shapes; using Orchard.Environment.Extensions; using Orchard.Tests.Stubs; @@ -22,6 +18,7 @@ namespace Orchard.Tests.DisplayManagement { builder.RegisterType().As(); builder.RegisterType().As(); builder.RegisterType().As(); + builder.RegisterType().As(); _container = builder.Build(); } diff --git a/src/Orchard.Tests/DisplayManagement/SubsystemTests.cs b/src/Orchard.Tests/DisplayManagement/SubsystemTests.cs index 34e4b7a1b..e2e7eb30f 100644 --- a/src/Orchard.Tests/DisplayManagement/SubsystemTests.cs +++ b/src/Orchard.Tests/DisplayManagement/SubsystemTests.cs @@ -4,6 +4,7 @@ using System.Web.Routing; using Autofac; using Moq; using NUnit.Framework; +using Orchard.Caching; using Orchard.DisplayManagement; using Orchard.DisplayManagement.Descriptors; using Orchard.DisplayManagement.Descriptors.ShapeAttributeStrategy; @@ -11,6 +12,7 @@ using Orchard.DisplayManagement.Implementation; using Orchard.DisplayManagement.Shapes; using Orchard.Environment; using Orchard.Environment.Extensions.Models; +using Orchard.Tests.Stubs; using Orchard.Tests.Utility; namespace Orchard.Tests.DisplayManagement { @@ -45,6 +47,7 @@ namespace Orchard.Tests.DisplayManagement { builder.RegisterType().As(); builder.RegisterType().As(); builder.RegisterType().As(); + builder.RegisterType().As(); builder.RegisterInstance(new DefaultDisplayManagerTests.TestWorkContextAccessor(workContext)).As(); builder.RegisterInstance(new SimpleShapes()).WithMetadata("Feature", testFeature); builder.RegisterInstance(new RouteCollection());