Nearly working integration of multi tenancy components

Tenant service provides refresh signal to host (temporary need)
Setup module changed to run in any named shell that is uninitialized
Table prefix added to setup form (for when sql server option is selected)
CreateSetupContext takes shellsettings to support uninitialized tenants
Removed name on default route provider - adding several routes by same name not allowed in single appdomain

--HG--
branch : dev
This commit is contained in:
Louis DeJardin
2010-04-23 17:05:28 -07:00
parent 5fb845dcc9
commit 0c6ae8b8d7
19 changed files with 254 additions and 24 deletions

View File

@@ -53,5 +53,16 @@ namespace Orchard.Specs.Bindings {
});
}
[When(@"I cycle the app domain")]
public void WhenICycleTheAppDomain() {
var webApp = Binding<WebAppHosting>();
webApp.Host.Execute(() => {
Trace.WriteLine("This call to Host.Reinitialize should not be needed, eventually");
MvcApplication.Host.Reinitialize_Obsolete();
});
}
}
}

View File

@@ -119,6 +119,14 @@ namespace Orchard.Specs.Bindings {
}
[When(@"I go to ""(.*)"" on host (.*)")]
public void WhenIGoToPathOnHost(string urlPath, string host) {
Host.HostName = host;
_details = Host.SendRequest(urlPath);
_doc = new HtmlDocument();
_doc.Load(new StringReader(_details.ResponseText));
}
[When(@"I go to ""(.*)""")]
public void WhenIGoTo(string urlPath) {
_details = Host.SendRequest(urlPath);

View File

@@ -12,6 +12,7 @@ namespace Orchard.Specs.Hosting {
ResponseHeaders = new Dictionary<string, string>();
}
public string HostName { get; set; }
public string UrlPath { get; set; }
public string Page { get; set; }
public string Query { get; set; }

View File

@@ -16,6 +16,7 @@ namespace Orchard.Specs.Hosting {
var physicalPath = Bleroy.FluentPath.Path.Get(webHost.PhysicalDirectory);
var details = new RequestDetails {
HostName = webHost.HostName,
UrlPath = urlPath,
Page = physicalPath
.Combine(urlPath.TrimStart('/', '\\'))
@@ -89,6 +90,9 @@ namespace Orchard.Specs.Hosting {
if (_details.RequestHeaders.TryGetValue("Cookie", out value))
return value;
}
else if (index==HeaderHost) {
return _details.HostName;
}
return base.GetKnownRequestHeader(index);
}

View File

@@ -11,6 +11,7 @@ namespace Orchard.Specs.Hosting {
private Path _tempSite;
private Path _orchardWebPath;
public void Initialize(string templateName, string virtualDirectory) {
var baseDir = Path.Get(AppDomain.CurrentDomain.BaseDirectory);
@@ -29,6 +30,7 @@ namespace Orchard.Specs.Hosting {
.ShallowCopy("*.dll", _tempSite.Combine("bin"))
.ShallowCopy("*.pdb", _tempSite.Combine("bin"));
HostName = "localhost";
PhysicalDirectory = _tempSite;
VirtualDirectory = virtualDirectory;
@@ -44,6 +46,7 @@ namespace Orchard.Specs.Hosting {
sourceModule.Combine("Views").DeepCopy(targetModule.Combine("Views"));
}
public string HostName { get; set; }
public string PhysicalDirectory { get; private set; }
public string VirtualDirectory { get; private set; }

View File

@@ -41,3 +41,36 @@ Scenario: A new tenant is created with uninitialized state
And I am redirected
Then I should see "<td>Uninitialized</td>"
And the status should be 200 OK
Scenario: A new tenant goes to the setup screen
Given I have installed Orchard
And I have installed "Orchard.MultiTenancy"
When I go to "Admin/MultiTenancy/Add"
And I fill in
| name | value |
| Name | Scott |
| RequestUrlHost | scott.example.org |
And I hit "Save"
And I go to "/Setup" on host scott.example.org
Then I should see "Welcome to Orchard"
And I should see "Finish Setup"
And the status should be 200 OK
Scenario: A new tenant runs the setup
Given I have installed Orchard
And I have installed "Orchard.MultiTenancy"
When I go to "Admin/MultiTenancy/Add"
And I fill in
| name | value |
| Name | Scott |
| RequestUrlHost | scott.example.org |
And I hit "Save"
And I go to "/Setup" on host scott.example.org
And I fill in
| name | value |
| SiteName | Scott Site |
| AdminPassword | 6655321 |
And I hit "Finish Setup"
And I go to "/Default.aspx"
Then I should see "<h1>Scott Site</h1>"
And I should see "Welcome, <strong>admin</strong>!"

View File

@@ -2,7 +2,7 @@
// <auto-generated>
// This code was generated by SpecFlow (http://www.specflow.org/).
// SpecFlow Version:1.2.0.0
// Runtime Version:2.0.50727.3603
// Runtime Version:2.0.50727.4927
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -158,6 +158,98 @@ this.ScenarioSetup(scenarioInfo);
testRunner.Then("I should see \"<td>Uninitialized</td>\"");
#line 43
testRunner.And("the status should be 200 OK");
#line hidden
testRunner.CollectScenarioErrors();
}
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("A new tenant goes to the setup screen")]
public virtual void ANewTenantGoesToTheSetupScreen()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A new tenant goes to the setup screen", ((string[])(null)));
#line 45
this.ScenarioSetup(scenarioInfo);
#line 46
testRunner.Given("I have installed Orchard");
#line 47
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
#line 48
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
#line hidden
TechTalk.SpecFlow.Table table3 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table3.AddRow(new string[] {
"Name",
"Scott"});
table3.AddRow(new string[] {
"RequestUrlHost",
"scott.example.org"});
#line 49
testRunner.And("I fill in", ((string)(null)), table3);
#line 53
testRunner.And("I hit \"Save\"");
#line 54
testRunner.And("I go to \"/Setup\" on host scott.example.org");
#line 55
testRunner.Then("I should see \"Welcome to Orchard\"");
#line 56
testRunner.And("I should see \"Finish Setup\"");
#line 57
testRunner.And("the status should be 200 OK");
#line hidden
testRunner.CollectScenarioErrors();
}
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("A new tenant runs the setup")]
public virtual void ANewTenantRunsTheSetup()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A new tenant runs the setup", ((string[])(null)));
#line 59
this.ScenarioSetup(scenarioInfo);
#line 60
testRunner.Given("I have installed Orchard");
#line 61
testRunner.And("I have installed \"Orchard.MultiTenancy\"");
#line 62
testRunner.When("I go to \"Admin/MultiTenancy/Add\"");
#line hidden
TechTalk.SpecFlow.Table table4 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table4.AddRow(new string[] {
"Name",
"Scott"});
table4.AddRow(new string[] {
"RequestUrlHost",
"scott.example.org"});
#line 63
testRunner.And("I fill in", ((string)(null)), table4);
#line 67
testRunner.And("I hit \"Save\"");
#line 68
testRunner.And("I go to \"/Setup\" on host scott.example.org");
#line hidden
TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table5.AddRow(new string[] {
"SiteName",
"Scott Site"});
table5.AddRow(new string[] {
"AdminPassword",
"6655321"});
#line 69
testRunner.And("I fill in", ((string)(null)), table5);
#line 73
testRunner.And("I hit \"Finish Setup\"");
#line 74
testRunner.And("I go to \"/Default.aspx\"");
#line 75
testRunner.Then("I should see \"<h1>Scott Site</h1>\"");
#line 76
testRunner.And("I should see \"Welcome, <strong>admin</strong>!\"");
#line hidden
testRunner.CollectScenarioErrors();
}