Skip to content

Commit 34b3c5b

Browse files
committed
Merge pull request Azure#360 from Azure/dev
HPF PR: dev <- Azure:dev
2 parents da2ac74 + 30a8f01 commit 34b3c5b

File tree

113 files changed

+9521
-12752
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+9521
-12752
lines changed

src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@
122122
<Reference Include="Microsoft.WindowsAzure.Management.Storage">
123123
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.Storage.5.1.1\lib\net40\Microsoft.WindowsAzure.Management.Storage.dll</HintPath>
124124
</Reference>
125-
<Reference Include="Microsoft.WindowsAzure.Storage, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
125+
<Reference Include="Microsoft.WindowsAzure.Storage, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
126126
<SpecificVersion>False</SpecificVersion>
127-
<HintPath>..\..\packages\WindowsAzure.Storage.6.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
127+
<HintPath>..\..\packages\WindowsAzure.Storage.6.1.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
128128
</Reference>
129129
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
130130
<SpecificVersion>False</SpecificVersion>

src/Common/Commands.Common.Storage/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@
2222
<package id="Microsoft.WindowsAzure.Management.Storage" version="5.1.1" targetFramework="net45" />
2323
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
2424
<package id="System.Spatial" version="5.6.4" targetFramework="net45" />
25-
<package id="WindowsAzure.Storage" version="6.0.0" targetFramework="net45" />
25+
<package id="WindowsAzure.Storage" version="6.1.0" targetFramework="net45" />
2626
</packages>

src/Common/Storage/Commands.Storage.ScenarioTest/Commands.Storage.ScenarioTest.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@
8585
<Reference Include="Microsoft.WindowsAzure.Configuration">
8686
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.ConfigurationManager.3.2.0\lib\net40\Microsoft.WindowsAzure.Configuration.dll</HintPath>
8787
</Reference>
88-
<Reference Include="Microsoft.WindowsAzure.Storage">
89-
<HintPath>..\..\..\packages\WindowsAzure.Storage.6.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
88+
<Reference Include="Microsoft.WindowsAzure.Storage, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
89+
<SpecificVersion>False</SpecificVersion>
90+
<HintPath>..\..\..\packages\WindowsAzure.Storage.6.1.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
9091
</Reference>
9192
<Reference Include="Newtonsoft.Json">
9293
<HintPath>..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>

src/Common/Storage/Commands.Storage.ScenarioTest/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="3.2.0" targetFramework="net45" />
1414
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
1515
<package id="System.Spatial" version="5.6.4" targetFramework="net45" />
16-
<package id="WindowsAzure.Storage" version="6.0.0" targetFramework="net45" />
16+
<package id="WindowsAzure.Storage" version="6.1.0" targetFramework="net45" />
1717
<package id="xunit.runner.visualstudio" version="2.1.0-beta4-build1109" targetFramework="net45" />
1818
</packages>

src/Common/Storage/Commands.Storage.StorageTestLib/Commands.Storage.StorageTestLib.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@
6464
<Reference Include="Microsoft.WindowsAzure.Configuration">
6565
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.ConfigurationManager.3.2.0\lib\net40\Microsoft.WindowsAzure.Configuration.dll</HintPath>
6666
</Reference>
67-
<Reference Include="Microsoft.WindowsAzure.Storage">
68-
<HintPath>..\..\..\packages\WindowsAzure.Storage.6.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
67+
<Reference Include="Microsoft.WindowsAzure.Storage, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
68+
<SpecificVersion>False</SpecificVersion>
69+
<HintPath>..\..\..\packages\WindowsAzure.Storage.6.1.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
6970
</Reference>
7071
<Reference Include="Newtonsoft.Json">
7172
<HintPath>..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>

src/Common/Storage/Commands.Storage.StorageTestLib/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="3.2.0" targetFramework="net45" />
88
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
99
<package id="System.Spatial" version="5.6.4" targetFramework="net45" />
10-
<package id="WindowsAzure.Storage" version="6.0.0" targetFramework="net45" />
10+
<package id="WindowsAzure.Storage" version="6.1.0" targetFramework="net45" />
1111
<package id="xunit.runner.visualstudio" version="2.1.0-beta4-build1109" targetFramework="net45" />
1212
</packages>

src/Common/Storage/Commands.Storage.Test/Commands.Storage.Test.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@
123123
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
124124
</Reference>
125125
<Reference Include="Microsoft.WindowsAzure.Storage">
126-
<HintPath>..\..\..\packages\WindowsAzure.Storage.6.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
126+
<HintPath>..\..\..\packages\WindowsAzure.Storage.6.1.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
127127
</Reference>
128-
<Reference Include="Microsoft.WindowsAzure.Storage.DataMovement, Version=2.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
128+
<Reference Include="Microsoft.WindowsAzure.Storage.DataMovement, Version=0.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
129129
<SpecificVersion>False</SpecificVersion>
130-
<HintPath>..\..\..\lib\Microsoft.WindowsAzure.Storage.DataMovement.dll</HintPath>
130+
<HintPath>..\..\..\packages\Microsoft.Azure.Storage.DataMovement.0.2.0\lib\net45\Microsoft.WindowsAzure.Storage.DataMovement.dll</HintPath>
131131
</Reference>
132132
<Reference Include="Newtonsoft.Json">
133133
<HintPath>..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
@@ -188,7 +188,7 @@
188188
<Compile Include="Common\CommunicationExceptionUtilTest.cs" />
189189
<Compile Include="Common\FileNamingGenerator.cs" />
190190
<Compile Include="Common\IStorageManagement.cs" />
191-
<Compile Include="Common\MockTransferJobRunner.cs" />
191+
<Compile Include="Common\MockTransferManager.cs" />
192192
<Compile Include="Common\MockupException.cs" />
193193
<Compile Include="Common\NameUtilTest.cs" />
194194
<Compile Include="Common\CmdletOperationContextTest.cs" />
@@ -281,4 +281,4 @@
281281
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
282282
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
283283
<Import Project="..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
284-
</Project>
284+
</Project>

src/Common/Storage/Commands.Storage.Test/Common/MockTransferJobRunner.cs renamed to src/Common/Storage/Commands.Storage.Test/Common/MockTransferManager.cs

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,34 @@
1717
using System.Threading.Tasks;
1818
using Microsoft.VisualStudio.TestTools.UnitTesting;
1919
using Microsoft.WindowsAzure.Commands.Storage.Common;
20+
using Microsoft.WindowsAzure.Storage.Blob;
2021
using Microsoft.WindowsAzure.Storage.DataMovement;
22+
using Microsoft.WindowsAzure.Storage.File;
2123

2224
namespace Microsoft.WindowsAzure.Management.Storage.Test.Common
2325
{
24-
internal sealed class MockTransferJobRunner : ITransferJobRunner
26+
abstract class MockTransferManager : ITransferManager
2527
{
26-
private Func<TransferJob, Task> runnerValidation;
28+
private AssertFailedException assertException = null;
2729

28-
private AssertFailedException assertException;
30+
public virtual Task DownloadAsync(CloudFile sourceFile, string destPath, DownloadOptions options, TransferContext context, CancellationToken cancellationToken)
31+
{
32+
throw new NotImplementedException();
33+
}
2934

30-
public MockTransferJobRunner(Func<TransferJob, Task> runnerValidation)
35+
public virtual Task DownloadAsync(CloudBlob sourceBlob, string destPath, DownloadOptions options, TransferContext context, CancellationToken cancellationToken)
3136
{
32-
this.runnerValidation = runnerValidation;
37+
throw new NotImplementedException();
3338
}
3439

35-
public Task RunTransferJob(TransferJob job, Action<double, double> progressReport, CancellationToken cancellationToken)
40+
public virtual Task UploadAsync(string sourcePath, CloudFile destFile, UploadOptions options, TransferContext context, CancellationToken cancellationToken)
3641
{
37-
try
38-
{
39-
return runnerValidation(job);
40-
}
41-
catch (AssertFailedException e)
42-
{
43-
this.assertException = e;
44-
throw new MockupException("AssertFailed");
45-
}
42+
throw new NotImplementedException();
43+
}
44+
45+
public virtual Task UploadAsync(string sourcePath, CloudBlob destBlob, UploadOptions options, TransferContext context, CancellationToken cancellationToken)
46+
{
47+
throw new NotImplementedException();
4648
}
4749

4850
public void ThrowAssertExceptionIfAvailable()
@@ -52,9 +54,5 @@ public void ThrowAssertExceptionIfAvailable()
5254
throw this.assertException;
5355
}
5456
}
55-
56-
public void Dispose()
57-
{
58-
}
5957
}
6058
}

src/Common/Storage/Commands.Storage.Test/File/Cmdlet/GetAzureStorageFileContentTest.cs

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
using System;
22
using System.Collections.Generic;
33
using System.IO;
4+
using System.Threading;
45
using System.Threading.Tasks;
56
using Microsoft.VisualStudio.TestTools.UnitTesting;
67
using Microsoft.WindowsAzure.Commands.Storage.Common;
78
using Microsoft.WindowsAzure.Commands.Storage.File;
89
using Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet;
910
using Microsoft.WindowsAzure.Management.Storage.Test.Common;
11+
using Microsoft.WindowsAzure.Storage.DataMovement;
12+
using Microsoft.WindowsAzure.Storage.File;
13+
using PSHFile = Microsoft.WindowsAzure.Commands.Storage.File;
1014

1115
namespace Microsoft.WindowsAzure.Management.Storage.Test.File.Cmdlet
1216
{
@@ -46,7 +50,7 @@ public void DownloadFileUsingShareNameAndPathToLocalFileTest()
4650
"remoteFile",
4751
this.destinationFilePath,
4852
() => this.CmdletInstance.RunCmdlet(
49-
Constants.ShareNameParameterSetName,
53+
PSHFile.Constants.ShareNameParameterSetName,
5054
new KeyValuePair<string, object>("ShareName", "share"),
5155
new KeyValuePair<string, object>("Path", "remoteFile"),
5256
new KeyValuePair<string, object>("Destination", this.destinationFilePath)));
@@ -60,7 +64,7 @@ public void DownloadFileUsingShareObjectAndPathToLocalFileTest()
6064
"remoteFile",
6165
this.destinationFilePath,
6266
() => this.CmdletInstance.RunCmdlet(
63-
Constants.ShareParameterSetName,
67+
PSHFile.Constants.ShareParameterSetName,
6468
new KeyValuePair<string, object>("Share", this.MockChannel.GetShareReference("share")),
6569
new KeyValuePair<string, object>("Path", "remoteFile"),
6670
new KeyValuePair<string, object>("Destination", this.destinationFilePath)));
@@ -74,7 +78,7 @@ public void DownloadFileUsingDirectoryAndPathToLocalFileTest()
7478
"remoteFile",
7579
this.destinationFilePath,
7680
() => this.CmdletInstance.RunCmdlet(
77-
Constants.DirectoryParameterSetName,
81+
PSHFile.Constants.DirectoryParameterSetName,
7882
new KeyValuePair<string, object>("Directory", this.MockChannel.GetShareReference("share").GetRootDirectoryReference()),
7983
new KeyValuePair<string, object>("Path", "remoteFile"),
8084
new KeyValuePair<string, object>("Destination", this.destinationFilePath)));
@@ -88,7 +92,7 @@ public void DownloadFileUsingFileObjectToLocalFileTest()
8892
"remoteFile",
8993
this.destinationFilePath,
9094
() => this.CmdletInstance.RunCmdlet(
91-
Constants.FileParameterSetName,
95+
PSHFile.Constants.FileParameterSetName,
9296
new KeyValuePair<string, object>("File", this.MockChannel.GetShareReference("share").GetRootDirectoryReference().GetFileReference("remoteFile")),
9397
new KeyValuePair<string, object>("Destination", this.destinationFilePath)));
9498
}
@@ -102,29 +106,43 @@ public void DownloadFileUsingFileObjectToLocalDirectoryTest()
102106
"remoteFile",
103107
this.destinationFilePath,
104108
() => this.CmdletInstance.RunCmdlet(
105-
Constants.FileParameterSetName,
109+
PSHFile.Constants.FileParameterSetName,
106110
new KeyValuePair<string, object>("File", this.MockChannel.GetShareReference("share").GetRootDirectoryReference().GetFileReference("remoteFile")),
107111
new KeyValuePair<string, object>("Destination", this.destinationPath)));
108112
}
109113

110114
private void DownloadFileInternal(string shareName, string fileName, string destination, Action downloadFileAction)
111115
{
112-
var mockupRunner = new MockTransferJobRunner(
113-
job =>
116+
var mockupTransferManager = new DownloadTransferManager(
117+
(sourceFile, destPath) =>
114118
{
115-
Assert.AreEqual(destination, job.Destination.FilePath, "Destination validation failed.");
116-
Assert.AreEqual(shareName, job.Source.AzureFile.Share.Name, "Share validation failed.");
117-
Assert.AreEqual(fileName, job.Source.AzureFile.Name, "SourceFile validation failed.");
118-
return TaskEx.FromResult(true);
119+
Assert.AreEqual(destination, destPath, "Destination validation failed.");
120+
Assert.AreEqual(shareName, sourceFile.Share.Name, "Share validation failed.");
121+
Assert.AreEqual(fileName, sourceFile.Name, "SourceFile validation failed.");
119122
});
120123

121-
TransferJobRunnerFactory.SetCachedRunner(mockupRunner);
124+
TransferManagerFactory.SetCachedTransferManager(mockupTransferManager);
122125

123126
downloadFileAction();
124127

125-
mockupRunner.ThrowAssertExceptionIfAvailable();
128+
mockupTransferManager.ThrowAssertExceptionIfAvailable();
126129
this.MockCmdRunTime.OutputPipeline.AssertNoObject();
127-
this.MockCmdRunTime.ErrorStream.AssertNoObject();
130+
}
131+
132+
private sealed class DownloadTransferManager : MockTransferManager
133+
{
134+
private Action<CloudFile, string> validateAction;
135+
136+
public DownloadTransferManager(Action<CloudFile, string> validate)
137+
{
138+
validateAction = validate;
139+
}
140+
141+
public override Task DownloadAsync(CloudFile sourceFile, string destFilePath, DownloadOptions options, TransferContext context, CancellationToken cancellationToken)
142+
{
143+
validateAction(sourceFile, destFilePath);
144+
return TaskEx.FromResult(true);
145+
}
128146
}
129147
}
130148
}

0 commit comments

Comments
 (0)