Working on feature activation lifecycle

Rationalizing some record names
Adding a shell feature concept, with Install and Enable states of rising/up/falling/down
Host has capability of firing a named event with an explicit configuration - needed for controlled execution of rising/falling state changes notifications

--HG--
branch : dev
This commit is contained in:
Louis DeJardin
2010-05-28 13:03:57 -07:00
parent 0fec7c869f
commit 13f44990ca
38 changed files with 811 additions and 129 deletions

View File

@@ -5,6 +5,7 @@ using Autofac;
using NUnit.Framework;
using Orchard.Core.Settings.Topology;
using Orchard.Core.Settings.Topology.Records;
using Orchard.Environment.State;
using Orchard.Environment.Topology;
using Orchard.Environment.Topology.Models;
using Orchard.Events;
@@ -34,9 +35,9 @@ namespace Orchard.Tests.Modules.Settings.Topology {
protected override IEnumerable<Type> DatabaseTypes {
get {
return new[] {
typeof (TopologyRecord),
typeof (TopologyFeatureRecord),
typeof (TopologyParameterRecord),
typeof (ShellDescriptorRecord),
typeof (ShellFeatureRecord),
typeof (ShellParameterRecord),
};
}
}
@@ -142,5 +143,21 @@ namespace Orchard.Tests.Modules.Settings.Topology {
Assert.That(eventBus.LastMessageName, Is.EqualTo("IShellDescriptorManagerEventHandler.Changed"));
}
[Test]
public void ManagerReturnsStateForFeaturesInDescriptor() {
var descriptorManager = _container.Resolve<IShellDescriptorManager>();
var stateManager = _container.Resolve<IShellStateProvider>();
var state = stateManager.GetShellState();
Assert.That(state.Features.Count(), Is.EqualTo(0));
descriptorManager.UpdateShellDescriptor(
0,
new[]{new ShellFeature{ Name="Foo"}},
Enumerable.Empty<ShellParameter>());
var state2 = stateManager.GetShellState();
Assert.That(state2.Features.Count(), Is.EqualTo(1));
Assert.That(state2.Features, Has.Some.Property("Name").EqualTo("Foo"));
}
}
}