mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Added missing event notification is AzureShellSettingsManager
--HG-- branch : dev
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using Microsoft.WindowsAzure;
|
||||
using NUnit.Framework;
|
||||
using Orchard.Azure.Environment.Configuration;
|
||||
@@ -15,7 +14,7 @@ namespace Orchard.Azure.Tests.Environment.Configuration {
|
||||
CloudStorageAccount devAccount;
|
||||
CloudStorageAccount.TryParse("UseDevelopmentStorage=true", out devAccount);
|
||||
|
||||
Loader = new AzureShellSettingsManager(devAccount);
|
||||
Loader = new AzureShellSettingsManager(devAccount, new Moq.Mock<IShellSettingsManagerEventHandler>().Object);
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
|
@@ -34,6 +34,10 @@
|
||||
<Reference Include="Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
|
||||
<Reference Include="Microsoft.WindowsAzure.ServiceRuntime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
|
||||
<Reference Include="Microsoft.WindowsAzure.StorageClient, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
|
||||
<Reference Include="Moq, Version=4.0.812.4, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\moq\Moq.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework, Version=2.5.2.9222, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\nunit\nunit.framework.dll</HintPath>
|
||||
|
@@ -13,6 +13,7 @@ namespace Orchard.Azure.Environment.Configuration {
|
||||
|
||||
public class AzureShellSettingsManager : IShellSettingsManager {
|
||||
public const string ContainerName = "sites"; // container names must be lower cased
|
||||
private readonly IShellSettingsManagerEventHandler _events;
|
||||
|
||||
private readonly CloudStorageAccount _storageAccount;
|
||||
public CloudBlobClient BlobClient { get; private set; }
|
||||
@@ -21,14 +22,16 @@ namespace Orchard.Azure.Environment.Configuration {
|
||||
Localizer T { get; [UsedImplicitly]
|
||||
set; }
|
||||
|
||||
public AzureShellSettingsManager() : this(CloudStorageAccount.FromConfigurationSetting("DataConnectionString"))
|
||||
public AzureShellSettingsManager(IShellSettingsManagerEventHandler events)
|
||||
: this(CloudStorageAccount.FromConfigurationSetting("DataConnectionString"), events)
|
||||
{
|
||||
}
|
||||
|
||||
public AzureShellSettingsManager(CloudStorageAccount storageAccount)
|
||||
public AzureShellSettingsManager(CloudStorageAccount storageAccount, IShellSettingsManagerEventHandler events)
|
||||
{
|
||||
// Setup the connection to custom storage accountm, e.g. Development Storage
|
||||
_storageAccount = storageAccount;
|
||||
_events = events;
|
||||
|
||||
BlobClient = _storageAccount.CreateCloudBlobClient();
|
||||
|
||||
@@ -54,6 +57,8 @@ namespace Orchard.Azure.Environment.Configuration {
|
||||
var filePath =String.Concat(settings.Name, "/", "Settings.txt");
|
||||
var blob = Container.GetBlockBlobReference(filePath);
|
||||
blob.UploadText(ComposeSettings(settings));
|
||||
|
||||
_events.Saved(settings);
|
||||
}
|
||||
|
||||
IEnumerable<ShellSettings> LoadSettings() {
|
||||
|
Reference in New Issue
Block a user