mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-03 12:03:51 +08:00
Merge
--HG-- branch : 1.x
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<add key="AzureSDK" value="C:\Program Files\Windows Azure SDK\v1.3\"/>
|
||||
<add key="AzureSDK" value="C:\Program Files\Windows Azure SDK\v1.4\"/>
|
||||
</appSettings>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.ComponentModel;
|
||||
using System.Configuration;
|
||||
using System.Configuration;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using Microsoft.WindowsAzure;
|
||||
|
||||
@@ -10,19 +10,19 @@ namespace Orchard.Azure.Tests.FileSystems.Media {
|
||||
[TestFixture]
|
||||
public class AzureBlobStorageProviderTests : AzureVirtualEnvironmentTest {
|
||||
|
||||
CloudStorageAccount DevAccount;
|
||||
CloudStorageAccount _devAccount;
|
||||
private AzureBlobStorageProvider _azureBlobStorageProvider;
|
||||
|
||||
protected override void OnInit() {
|
||||
CloudStorageAccount.TryParse("UseDevelopmentStorage=true", out DevAccount);
|
||||
CloudStorageAccount.TryParse("UseDevelopmentStorage=true", out _devAccount);
|
||||
|
||||
_azureBlobStorageProvider = new AzureBlobStorageProvider(new ShellSettings { Name = "default" }, DevAccount);
|
||||
_azureBlobStorageProvider = new AzureBlobStorageProvider(new ShellSettings { Name = "default" }, _devAccount);
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public void Setup() {
|
||||
// ensure default container is empty before running any test
|
||||
DeleteAllBlobs(_azureBlobStorageProvider.Container.Name, DevAccount);
|
||||
DeleteAllBlobs(_azureBlobStorageProvider.Container.Name, _devAccount);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -128,6 +128,23 @@ namespace Orchard.Azure.Tests.FileSystems.Media {
|
||||
Assert.AreEqual("folder", _azureBlobStorageProvider.ListFolders("folder").First().GetName());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ShouldDeleteFiles() {
|
||||
_azureBlobStorageProvider.CreateFile("folder/foo1.txt");
|
||||
_azureBlobStorageProvider.CreateFile("folder/foo2.txt");
|
||||
_azureBlobStorageProvider.CreateFile("folder/folder/foo1.txt");
|
||||
_azureBlobStorageProvider.CreateFile("folder/folder/foo2.txt");
|
||||
|
||||
Assert.That(_azureBlobStorageProvider.ListFiles("folder").Count(), Is.EqualTo(2));
|
||||
Assert.That(_azureBlobStorageProvider.ListFiles("folder/folder").Count(), Is.EqualTo(2));
|
||||
|
||||
_azureBlobStorageProvider.DeleteFile("folder/foo1.txt");
|
||||
_azureBlobStorageProvider.DeleteFile("folder/folder/foo2.txt");
|
||||
|
||||
Assert.That(_azureBlobStorageProvider.ListFiles("folder").Count(), Is.EqualTo(1));
|
||||
Assert.That(_azureBlobStorageProvider.ListFiles("folder/folder").Count(), Is.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DeleteFolderShouldDeleteFilesAlso() {
|
||||
_azureBlobStorageProvider.CreateFile("folder/foo1.txt");
|
||||
@@ -167,17 +184,15 @@ namespace Orchard.Azure.Tests.FileSystems.Media {
|
||||
|
||||
[Test]
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
public void CannotCreateAlreadyExistingFolders()
|
||||
{
|
||||
public void CannotCreateAlreadyExistingFolders() {
|
||||
_azureBlobStorageProvider.CreateFile("folder1/foo.txt");
|
||||
_azureBlobStorageProvider.CreateFolder("folder1");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanCreateAlreadyExistingFolder()
|
||||
{
|
||||
public void CanCreateAlreadyExistingFolder() {
|
||||
_azureBlobStorageProvider.CreateFile("folder1/foo.txt");
|
||||
_azureBlobStorageProvider.TryCreateFolder("folder1");
|
||||
Assert.That(_azureBlobStorageProvider.TryCreateFolder("folder1"), Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -155,15 +155,15 @@ namespace Orchard.Azure {
|
||||
}
|
||||
|
||||
public bool TryCreateFolder(string path) {
|
||||
EnsurePathIsRelative(path);
|
||||
using (new HttpContextWeaver()) {
|
||||
if (Container.DirectoryExists(String.Concat(_root, path))) {
|
||||
return true;
|
||||
try {
|
||||
if (!Container.DirectoryExists(String.Concat(_root, path))) {
|
||||
CreateFolder(path);
|
||||
}
|
||||
|
||||
CreateFile(Combine(path, FolderEntry));
|
||||
return true;
|
||||
}
|
||||
catch {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void CreateFolder(string path) {
|
||||
|
||||
@@ -80,8 +80,10 @@ margin:5px 0;
|
||||
.widgets-listed li.last {
|
||||
margin:0;
|
||||
}
|
||||
|
||||
.widgets-listed li:hover, .widgets-listed li.on {
|
||||
border-color:#bfd3a7;
|
||||
/*border-color:#bfd3a7;*/
|
||||
border-color:#487328;
|
||||
}
|
||||
#widgets-available h2 {
|
||||
font-size:1.231em;
|
||||
@@ -99,11 +101,24 @@ padding:5px 100px 5px 25px;
|
||||
#widgets-layer-visibility li {
|
||||
margin:1px 0 0;
|
||||
}
|
||||
.widgets-listed li li.widgets-this-layer, #widgets-layer-visibility li.widgets-this-layer, #widgets-layer-visibility li.widgets-this-layer:hover {
|
||||
border-color:#898989;
|
||||
.widgets-listed li li.widgets-this-layer, #widgets-layer-visibility li.widgets-this-layer {
|
||||
border-color:#cfe493;
|
||||
border-color:#487328;
|
||||
background-color:#e6f1c9;
|
||||
}
|
||||
/*#widgets-layer-visibility li.widgets-this-layer:hover {
|
||||
border-color:#487328;
|
||||
}*/
|
||||
.widgets-listed li li.widgets-this-layer:hover, #widgets-layer-visibility li:hover {
|
||||
border-color:#bfd3a7;
|
||||
/*border-color:#bfd3a7;*/
|
||||
border-color:#487328;
|
||||
}
|
||||
#widgets-layer-visibility li.widgets-empty-layer:hover, #widgets-layer-visibility li.off:hover {
|
||||
border-color:#eaeaea;
|
||||
}
|
||||
#widgets-layer-visibility li.widgets-this-layer.widgets-empty-layer:hover {
|
||||
border-color:#cfe493;
|
||||
border-color:#487328;
|
||||
}
|
||||
.widgets-listed .widgets-mover {
|
||||
margin-left:-18px;
|
||||
@@ -169,11 +184,12 @@ display:block;
|
||||
padding:5px 10px;
|
||||
}
|
||||
#widgets-available li a:hover {
|
||||
border-color:#bfd3a7;
|
||||
/*border-color:#bfd3a7;*/
|
||||
border-color:#487328;
|
||||
}
|
||||
#widgets-available a h2, #widgets-available a p {
|
||||
/*#widgets-available a h2, #widgets-available a p {
|
||||
color:#333;
|
||||
}
|
||||
}*/
|
||||
#widgets-available a p {
|
||||
margin-top:5px;
|
||||
}
|
||||
@@ -188,15 +204,15 @@ margin-top:0;
|
||||
#widgets-layer-visibility li {
|
||||
cursor:default;
|
||||
}
|
||||
#widgets-layer-visibility .widgets-other-layer, #widgets-layer-visibility .widgets-this-layer {
|
||||
#widgets-layer-visibility .widgets-other-layer, #widgets-layer-visibility .widgets-this-layer {
|
||||
background-image:url(images/eye.png);
|
||||
background-position:5px 11px;
|
||||
background-repeat:no-repeat;
|
||||
cursor:pointer;
|
||||
}
|
||||
#widgets-layer-visibility .widgets-this-layer.widgets-empty-layer {
|
||||
/*#widgets-layer-visibility .widgets-this-layer .widgets-empty-layer {
|
||||
background-image:none;
|
||||
}
|
||||
}*/
|
||||
#widgets-layer-visibility .widgets-this-layer {cursor:default;}
|
||||
#widgets-layer-visibility .widgets-other-layer.off, #widgets-layer-visibility .widgets-other-layer.off:hover {
|
||||
background-position:5px -17px;
|
||||
|
||||
@@ -173,6 +173,39 @@
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target> -->
|
||||
<PropertyGroup>
|
||||
<CopyAllFilesToSingleFolderForPackageDependsOn>
|
||||
CustomCollectFiles;
|
||||
$(CopyAllFilesToSingleFolderForPackageDependsOn);
|
||||
</CopyAllFilesToSingleFolderForPackageDependsOn>
|
||||
|
||||
</PropertyGroup>
|
||||
<Target Name="CustomCollectFiles">
|
||||
<ItemGroup>
|
||||
<Orchard-Web-Bins Include="bin\*" />
|
||||
<SqlCeBinariesx86 Include="..\..\lib\sqlce\x86\**\*" />
|
||||
<SqlCeBinariesx64 Include="..\..\lib\sqlce\amd64\**\*" />
|
||||
|
||||
<_CustomFiles
|
||||
Include="Modules\**\*;Themes\**\*;Core\**\*;**\*.po"
|
||||
Exclude="**\obj\**;@(Orchard-Web-Bins -> '**\%(Filename)%(Extension)');**\*.csproj.user;**\*.hg*"
|
||||
/>
|
||||
<FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
|
||||
<DestinationRelativePath>%(RelativeDir)%(Filename)%(Extension)</DestinationRelativePath>
|
||||
</FilesForPackagingFromProject>
|
||||
|
||||
<_SqlCeBinariesx86Files Include="@(SqlCeBinariesx86);" />
|
||||
<FilesForPackagingFromProject Include="%(_SqlCeBinariesx86Files.Identity)">
|
||||
<DestinationRelativePath>bin\x86\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
|
||||
</FilesForPackagingFromProject>
|
||||
|
||||
<_SqlCeBinariesx64Files Include="@(SqlCeBinariesx64);" />
|
||||
<FilesForPackagingFromProject Include="%(_SqlCeBinariesx64Files.Identity)">
|
||||
<DestinationRelativePath>bin\amd64\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
|
||||
</FilesForPackagingFromProject>
|
||||
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
<Target Name="CopySqlCeBinaries">
|
||||
<ItemGroup>
|
||||
<SqlCeBinariesx86 Include="$(ProjectDir)..\..\lib\sqlce\x86\**\*" />
|
||||
|
||||
@@ -88,10 +88,6 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\fluentnhibernate\FluentNHibernate.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ICSharpCode.SharpZipLib, Version=0.85.5.452, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\sharpziplib\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\lib\fluentnhibernate\log4net.dll</HintPath>
|
||||
|
||||
Reference in New Issue
Block a user