Permalink
Browse files

Switch the default deployment logic to use the new generator site bui…

…lder factory.

Also enabled changing between testing of the original and new generator deployment logic using environment variable so we can add a job to the ci machine for testing both.
  • Loading branch information...
1 parent 1427b21 commit 839ca7d75f40face41c7dd0f7a1283c584891fea Amit Apple committed Jan 19, 2013
@@ -8,7 +8,7 @@ namespace Kudu.Core.Deployment
{
public class SiteBuilderFactoryDispatcher : ISiteBuilderFactory
{
- private const string Generator = "GENERATOR";
+ private static readonly string Original = "Original".ToUpperInvariant();
private readonly IDeploymentSettingsManager _settingsManager;
private readonly SiteBuilderFactory _originalSiteBuilderFactory;
@@ -32,13 +32,13 @@ private ISiteBuilderFactory CurrentSiteBuilderFactory
get
{
var setting = _settingsManager.GetValue(SettingsKeys.SiteBuilderFactory);
- if (!String.IsNullOrEmpty(setting) && setting.ToUpperInvariant().Trim() == Generator)
+ if (!String.IsNullOrEmpty(setting) && setting.ToUpperInvariant().Trim() == Original)
{
- return _generatorSiteBuilderFactory;
+ return _originalSiteBuilderFactory;
}
else
{
- return _originalSiteBuilderFactory;
+ return _generatorSiteBuilderFactory;
}
}
}
@@ -3,8 +3,8 @@
<appSettings>
<!-- Uncomment out this line to reuse the same site for all functional tests, which runs much faster -->
<add key="SiteReusedForAllTests" value="TestRunnerSite"/>
- <!-- Set to true to test the generator site builder factory -->
- <add key="TestGeneratorSiteBuilderFactory" value="false"/>
+ <!-- Set to true to test the original site builder factory -->
+ <add key="TestOriginalSiteBuilderFactory" value="false"/>
</appSettings>
<system.net>
<connectionManagement>
@@ -125,9 +125,9 @@ public static void Run(string testName, Action<ApplicationManager> action)
}
const string siteBuilderFactory = "site_builder_factory";
- if (KuduUtils.TestGeneratorSiteBuilderFactory)
+ if (KuduUtils.TestOriginalSiteBuilderFactory)
{
- appManager.SettingsManager.SetValue(siteBuilderFactory, "generator").Wait();
+ appManager.SettingsManager.SetValue(siteBuilderFactory, "original").Wait();
}
else
{
@@ -96,19 +96,33 @@ public static bool ReuseSameSiteForAllTests
}
}
- public static bool TestGeneratorSiteBuilderFactory
+ public static bool TestOriginalSiteBuilderFactory
{
get
{
bool retValue;
- if (bool.TryParse(ConfigurationManager.AppSettings["TestGeneratorSiteBuilderFactory"], out retValue))
+ if (bool.TryParse(GetTestSetting("TestOriginalSiteBuilderFactory"), out retValue))
{
return retValue;
}
return false;
}
}
+
+ private static string GetTestSetting(string settingName)
+ {
+ // If value exists as an environment setting use that otherwise try to get from app settings (for usage of the ci)
+ string environmentValue = Environment.GetEnvironmentVariable(settingName);
+ if (!String.IsNullOrEmpty(environmentValue))
+ {
+ return environmentValue;
+ }
+ else
+ {
+ return ConfigurationManager.AppSettings[settingName];
+ }
+ }
}
}

0 comments on commit 839ca7d

Please sign in to comment.