Skip to content

HPF PR: dev <- Azure:dev #360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Jan 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
fe8c01e
Update DMLib.
EmmaZhu Nov 23, 2015
4ade1f0
Define storage cmdlets aliases in AzureStorageStartup.ps1
EmmaZhu Dec 12, 2015
0fb7696
Merge branch 'release-1.0.2' of https://github.com/Azure/azure-powers…
EmmaZhu Dec 12, 2015
5793f02
Adopt DMLib 0.2.0
EmmaZhu Dec 17, 2015
5065efb
Resolve a build issue.
EmmaZhu Dec 21, 2015
cfac4b4
Merge branch 'dev' of https://github.com/Azure/azure-powershell into …
EmmaZhu Dec 23, 2015
1e17b0f
Merge branch 'dev' of https://github.com/Azure/azure-powershell into …
EmmaZhu Dec 28, 2015
2fc985b
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
EmmaZhu Jan 11, 2016
f3fcdb8
Fix issue of cannot create a storage context with azure environment.
EmmaZhu Jan 11, 2016
e6a42fa
Merge branch 'dev' of https://github.com/Azure/azure-powershell into …
EmmaZhu Jan 13, 2016
ab9a469
RDBug 5516712:[PSH] We should add help for the behavior change of Get…
blueww Jan 14, 2016
d639661
Resolve the issue that cannot upload blob with 0 size..
EmmaZhu Jan 15, 2016
957b831
Use error messages in TransferException's InnerException for that DML…
EmmaZhu Jan 18, 2016
c4b554f
Should return more meaningful error message when the input blob type …
EmmaZhu Jan 19, 2016
0eff60e
Merge branch 'dev' of https://github.com/wastoresh/azure-powershell i…
EmmaZhu Jan 20, 2016
0a50a85
Merge branch 'newdmlib' of https://github.com/wastoresh/azure-powersh…
EmmaZhu Jan 20, 2016
af9ca94
Fix check-in test failures by recording sessions.
EmmaZhu Jan 22, 2016
aa496e3
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
EmmaZhu Jan 22, 2016
4483f1a
Resolve test failures by re-recording.
EmmaZhu Jan 22, 2016
9d076fd
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
EmmaZhu Jan 23, 2016
bd5cdd0
Upgrade XSCL from 6.0 to 6.1
EmmaZhu Jan 23, 2016
5e2989f
Fix storage scenario test failures.
EmmaZhu Jan 26, 2016
eaf716c
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
EmmaZhu Jan 26, 2016
30a8f01
Merge pull request #1684 from wastoresh/dev
Jan 26, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@
<Reference Include="Microsoft.WindowsAzure.Management.Storage">
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.Storage.5.1.1\lib\net40\Microsoft.WindowsAzure.Management.Storage.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Storage, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Reference Include="Microsoft.WindowsAzure.Storage, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\WindowsAzure.Storage.6.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
<HintPath>..\..\packages\WindowsAzure.Storage.6.1.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Commands.Common.Storage/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
<package id="Microsoft.WindowsAzure.Management.Storage" version="5.1.1" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
<package id="System.Spatial" version="5.6.4" targetFramework="net45" />
<package id="WindowsAzure.Storage" version="6.0.0" targetFramework="net45" />
<package id="WindowsAzure.Storage" version="6.1.0" targetFramework="net45" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@
<Reference Include="Microsoft.WindowsAzure.Configuration">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.ConfigurationManager.3.2.0\lib\net40\Microsoft.WindowsAzure.Configuration.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Storage">
<HintPath>..\..\..\packages\WindowsAzure.Storage.6.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
<Reference Include="Microsoft.WindowsAzure.Storage, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\WindowsAzure.Storage.6.1.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="3.2.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
<package id="System.Spatial" version="5.6.4" targetFramework="net45" />
<package id="WindowsAzure.Storage" version="6.0.0" targetFramework="net45" />
<package id="WindowsAzure.Storage" version="6.1.0" targetFramework="net45" />
<package id="xunit.runner.visualstudio" version="2.1.0-beta4-build1109" targetFramework="net45" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@
<Reference Include="Microsoft.WindowsAzure.Configuration">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.ConfigurationManager.3.2.0\lib\net40\Microsoft.WindowsAzure.Configuration.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Storage">
<HintPath>..\..\..\packages\WindowsAzure.Storage.6.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
<Reference Include="Microsoft.WindowsAzure.Storage, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\WindowsAzure.Storage.6.1.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="3.2.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
<package id="System.Spatial" version="5.6.4" targetFramework="net45" />
<package id="WindowsAzure.Storage" version="6.0.0" targetFramework="net45" />
<package id="WindowsAzure.Storage" version="6.1.0" targetFramework="net45" />
<package id="xunit.runner.visualstudio" version="2.1.0-beta4-build1109" targetFramework="net45" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Storage">
<HintPath>..\..\..\packages\WindowsAzure.Storage.6.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
<HintPath>..\..\..\packages\WindowsAzure.Storage.6.1.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Storage.DataMovement, Version=2.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Reference Include="Microsoft.WindowsAzure.Storage.DataMovement, Version=0.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\lib\Microsoft.WindowsAzure.Storage.DataMovement.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Storage.DataMovement.0.2.0\lib\net45\Microsoft.WindowsAzure.Storage.DataMovement.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
Expand Down Expand Up @@ -188,7 +188,7 @@
<Compile Include="Common\CommunicationExceptionUtilTest.cs" />
<Compile Include="Common\FileNamingGenerator.cs" />
<Compile Include="Common\IStorageManagement.cs" />
<Compile Include="Common\MockTransferJobRunner.cs" />
<Compile Include="Common\MockTransferManager.cs" />
<Compile Include="Common\MockupException.cs" />
<Compile Include="Common\NameUtilTest.cs" />
<Compile Include="Common\CmdletOperationContextTest.cs" />
Expand Down Expand Up @@ -281,4 +281,4 @@
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<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')" />
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,34 @@
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.WindowsAzure.Commands.Storage.Common;
using Microsoft.WindowsAzure.Storage.Blob;
using Microsoft.WindowsAzure.Storage.DataMovement;
using Microsoft.WindowsAzure.Storage.File;

namespace Microsoft.WindowsAzure.Management.Storage.Test.Common
{
internal sealed class MockTransferJobRunner : ITransferJobRunner
abstract class MockTransferManager : ITransferManager
{
private Func<TransferJob, Task> runnerValidation;
private AssertFailedException assertException = null;

private AssertFailedException assertException;
public virtual Task DownloadAsync(CloudFile sourceFile, string destPath, DownloadOptions options, TransferContext context, CancellationToken cancellationToken)
{
throw new NotImplementedException();
}

public MockTransferJobRunner(Func<TransferJob, Task> runnerValidation)
public virtual Task DownloadAsync(CloudBlob sourceBlob, string destPath, DownloadOptions options, TransferContext context, CancellationToken cancellationToken)
{
this.runnerValidation = runnerValidation;
throw new NotImplementedException();
}

public Task RunTransferJob(TransferJob job, Action<double, double> progressReport, CancellationToken cancellationToken)
public virtual Task UploadAsync(string sourcePath, CloudFile destFile, UploadOptions options, TransferContext context, CancellationToken cancellationToken)
{
try
{
return runnerValidation(job);
}
catch (AssertFailedException e)
{
this.assertException = e;
throw new MockupException("AssertFailed");
}
throw new NotImplementedException();
}

public virtual Task UploadAsync(string sourcePath, CloudBlob destBlob, UploadOptions options, TransferContext context, CancellationToken cancellationToken)
{
throw new NotImplementedException();
}

public void ThrowAssertExceptionIfAvailable()
Expand All @@ -52,9 +54,5 @@ public void ThrowAssertExceptionIfAvailable()
throw this.assertException;
}
}

public void Dispose()
{
}
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.WindowsAzure.Commands.Storage.Common;
using Microsoft.WindowsAzure.Commands.Storage.File;
using Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet;
using Microsoft.WindowsAzure.Management.Storage.Test.Common;
using Microsoft.WindowsAzure.Storage.DataMovement;
using Microsoft.WindowsAzure.Storage.File;
using PSHFile = Microsoft.WindowsAzure.Commands.Storage.File;

namespace Microsoft.WindowsAzure.Management.Storage.Test.File.Cmdlet
{
Expand Down Expand Up @@ -46,7 +50,7 @@ public void DownloadFileUsingShareNameAndPathToLocalFileTest()
"remoteFile",
this.destinationFilePath,
() => this.CmdletInstance.RunCmdlet(
Constants.ShareNameParameterSetName,
PSHFile.Constants.ShareNameParameterSetName,
new KeyValuePair<string, object>("ShareName", "share"),
new KeyValuePair<string, object>("Path", "remoteFile"),
new KeyValuePair<string, object>("Destination", this.destinationFilePath)));
Expand All @@ -60,7 +64,7 @@ public void DownloadFileUsingShareObjectAndPathToLocalFileTest()
"remoteFile",
this.destinationFilePath,
() => this.CmdletInstance.RunCmdlet(
Constants.ShareParameterSetName,
PSHFile.Constants.ShareParameterSetName,
new KeyValuePair<string, object>("Share", this.MockChannel.GetShareReference("share")),
new KeyValuePair<string, object>("Path", "remoteFile"),
new KeyValuePair<string, object>("Destination", this.destinationFilePath)));
Expand All @@ -74,7 +78,7 @@ public void DownloadFileUsingDirectoryAndPathToLocalFileTest()
"remoteFile",
this.destinationFilePath,
() => this.CmdletInstance.RunCmdlet(
Constants.DirectoryParameterSetName,
PSHFile.Constants.DirectoryParameterSetName,
new KeyValuePair<string, object>("Directory", this.MockChannel.GetShareReference("share").GetRootDirectoryReference()),
new KeyValuePair<string, object>("Path", "remoteFile"),
new KeyValuePair<string, object>("Destination", this.destinationFilePath)));
Expand All @@ -88,7 +92,7 @@ public void DownloadFileUsingFileObjectToLocalFileTest()
"remoteFile",
this.destinationFilePath,
() => this.CmdletInstance.RunCmdlet(
Constants.FileParameterSetName,
PSHFile.Constants.FileParameterSetName,
new KeyValuePair<string, object>("File", this.MockChannel.GetShareReference("share").GetRootDirectoryReference().GetFileReference("remoteFile")),
new KeyValuePair<string, object>("Destination", this.destinationFilePath)));
}
Expand All @@ -102,29 +106,43 @@ public void DownloadFileUsingFileObjectToLocalDirectoryTest()
"remoteFile",
this.destinationFilePath,
() => this.CmdletInstance.RunCmdlet(
Constants.FileParameterSetName,
PSHFile.Constants.FileParameterSetName,
new KeyValuePair<string, object>("File", this.MockChannel.GetShareReference("share").GetRootDirectoryReference().GetFileReference("remoteFile")),
new KeyValuePair<string, object>("Destination", this.destinationPath)));
}

private void DownloadFileInternal(string shareName, string fileName, string destination, Action downloadFileAction)
{
var mockupRunner = new MockTransferJobRunner(
job =>
var mockupTransferManager = new DownloadTransferManager(
(sourceFile, destPath) =>
{
Assert.AreEqual(destination, job.Destination.FilePath, "Destination validation failed.");
Assert.AreEqual(shareName, job.Source.AzureFile.Share.Name, "Share validation failed.");
Assert.AreEqual(fileName, job.Source.AzureFile.Name, "SourceFile validation failed.");
return TaskEx.FromResult(true);
Assert.AreEqual(destination, destPath, "Destination validation failed.");
Assert.AreEqual(shareName, sourceFile.Share.Name, "Share validation failed.");
Assert.AreEqual(fileName, sourceFile.Name, "SourceFile validation failed.");
});

TransferJobRunnerFactory.SetCachedRunner(mockupRunner);
TransferManagerFactory.SetCachedTransferManager(mockupTransferManager);

downloadFileAction();

mockupRunner.ThrowAssertExceptionIfAvailable();
mockupTransferManager.ThrowAssertExceptionIfAvailable();
this.MockCmdRunTime.OutputPipeline.AssertNoObject();
this.MockCmdRunTime.ErrorStream.AssertNoObject();
}

private sealed class DownloadTransferManager : MockTransferManager
{
private Action<CloudFile, string> validateAction;

public DownloadTransferManager(Action<CloudFile, string> validate)
{
validateAction = validate;
}

public override Task DownloadAsync(CloudFile sourceFile, string destFilePath, DownloadOptions options, TransferContext context, CancellationToken cancellationToken)
{
validateAction(sourceFile, destFilePath);
return TaskEx.FromResult(true);
}
}
}
}
Loading