Skip to content

Commit aa07ccc

Browse files
committed
Merge pull request #1232 from wastoresh/sprint55
Add cmdlets to get/set storage file metrics
2 parents 41e91d9 + 830f961 commit aa07ccc

File tree

117 files changed

+75933
-52676
lines changed

Some content is hidden

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

117 files changed

+75933
-52676
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@
6767
<HintPath>..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll</HintPath>
6868
<Private>True</Private>
6969
</Reference>
70-
<Reference Include="Microsoft.Azure.Management.Storage, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
71-
<HintPath>..\..\packages\Microsoft.Azure.Management.Storage.2.4.0-preview\lib\net40\Microsoft.Azure.Management.Storage.dll</HintPath>
72-
<Private>True</Private>
70+
<Reference Include="Microsoft.Azure.Management.Storage, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
71+
<SpecificVersion>False</SpecificVersion>
72+
<HintPath>..\..\packages\Microsoft.Azure.Management.Storage.3.0.0\lib\net40\Microsoft.Azure.Management.Storage.dll</HintPath>
7373
</Reference>
7474
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
7575
<SpecificVersion>False</SpecificVersion>
@@ -118,9 +118,9 @@
118118
<Reference Include="Microsoft.WindowsAzure.Management.Storage">
119119
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.Storage.5.1.1\lib\net40\Microsoft.WindowsAzure.Management.Storage.dll</HintPath>
120120
</Reference>
121-
<Reference Include="Microsoft.WindowsAzure.Storage, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
121+
<Reference Include="Microsoft.WindowsAzure.Storage, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
122122
<SpecificVersion>False</SpecificVersion>
123-
<HintPath>..\..\packages\WindowsAzure.Storage.5.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
123+
<HintPath>..\..\packages\WindowsAzure.Storage.6.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
124124
</Reference>
125125
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
126126
<SpecificVersion>False</SpecificVersion>

src/Common/Commands.Common.Storage/StorageUtilities.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,14 @@ public static CloudStorageAccount GenerateCloudStorageAccount(Arm.IStorageManage
4848
Uri blobEndpoint = storageServiceResponse.StorageAccount.PrimaryEndpoints.Blob;
4949
Uri queueEndpoint = storageServiceResponse.StorageAccount.PrimaryEndpoints.Queue;
5050
Uri tableEndpoint = storageServiceResponse.StorageAccount.PrimaryEndpoints.Table;
51+
Uri fileEndpoint = storageServiceResponse.StorageAccount.PrimaryEndpoints.File;
52+
5153
return new CloudStorageAccount(
5254
GenerateStorageCredentials(storageClient, resourceGroupName, accountName),
5355
blobEndpoint,
5456
queueEndpoint,
55-
tableEndpoint, null);
57+
tableEndpoint,
58+
fileEndpoint);
5659
}
5760
else
5861
{
@@ -61,8 +64,8 @@ public static CloudStorageAccount GenerateCloudStorageAccount(Arm.IStorageManage
6164
Convert.ToBase64String(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString()))),
6265
new Uri(string.Format("https://{0}.blob.core.windows.net", accountName)),
6366
new Uri(string.Format("https://{0}.queue.core.windows.net", accountName)),
64-
new Uri(string.Format("https://{0}.table.core.windows.net", accountName)),
65-
null);
67+
new Uri(string.Format("https://{0}.table.core.windows.net", accountName)),
68+
new Uri(string.Format("https://{0}.file.core.windows.net", accountName)));
6669
}
6770
}
6871

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
77
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net45" />
88
<package id="Microsoft.Azure.Management.Resources" version="2.18.7-preview" targetFramework="net45" />
9-
<package id="Microsoft.Azure.Management.Storage" version="2.4.0-preview" targetFramework="net45" />
9+
<package id="Microsoft.Azure.Management.Storage" version="3.0.0" targetFramework="net45" />
1010
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
1111
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net45" />
1212
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" />
@@ -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="5.0.0" targetFramework="net45" />
25+
<package id="WindowsAzure.Storage" version="6.0.0" targetFramework="net45" />
2626
</packages>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.ConfigurationManager.2.0.3\lib\net40\Microsoft.WindowsAzure.Configuration.dll</HintPath>
8787
</Reference>
8888
<Reference Include="Microsoft.WindowsAzure.Storage">
89-
<HintPath>..\..\..\packages\WindowsAzure.Storage.5.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
89+
<HintPath>..\..\..\packages\WindowsAzure.Storage.6.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
9090
</Reference>
9191
<Reference Include="Newtonsoft.Json">
9292
<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="2.0.3" 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="5.0.0" targetFramework="net45" />
16+
<package id="WindowsAzure.Storage" version="6.0.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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.ConfigurationManager.2.0.3\lib\net40\Microsoft.WindowsAzure.Configuration.dll</HintPath>
6666
</Reference>
6767
<Reference Include="Microsoft.WindowsAzure.Storage">
68-
<HintPath>..\..\..\packages\WindowsAzure.Storage.5.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
68+
<HintPath>..\..\..\packages\WindowsAzure.Storage.6.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
6969
</Reference>
7070
<Reference Include="Newtonsoft.Json">
7171
<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="2.0.3" 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="5.0.0" targetFramework="net45" />
10+
<package id="WindowsAzure.Storage" version="6.0.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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
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.5.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
126+
<HintPath>..\..\..\packages\WindowsAzure.Storage.6.0.0\lib\net40\Microsoft.WindowsAzure.Storage.dll</HintPath>
127127
</Reference>
128128
<Reference Include="Microsoft.WindowsAzure.Storage.DataMovement, Version=2.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
129129
<SpecificVersion>False</SpecificVersion>

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

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -76,33 +76,34 @@ public void GetFileFromSubDirectoryTest_UsingShareObjectWithPath()
7676
{
7777
var share = this.MockChannel.GetShareReference(ShareName);
7878
var dir = share.GetRootDirectoryReference().GetDirectoryReference("dir");
79-
var listItems = Enumerable.Range(0, 10).Select(x => dir.GetFileReference(string.Format("file{0}", x))).Cast<IListFileItem>()
80-
.Concat(Enumerable.Range(0, 5).Select(x => dir.GetDirectoryReference(string.Format("dir{0}", x)))).ToArray();
8179

82-
this.ListFilesAndAssertResults(
83-
() => this.CmdletInstance.RunCmdlet(
84-
Constants.ShareParameterSetName,
85-
new KeyValuePair<string, object>("Share", share),
86-
new KeyValuePair<string, object>("Path", dir.Name)),
87-
listItems,
88-
dir);
80+
this.MockChannel.SetsAvailableDirectories(dir.Name);
81+
82+
this.CmdletInstance.RunCmdlet(
83+
Constants.ShareNameParameterSetName,
84+
new KeyValuePair<string, object>("ShareName", ShareName),
85+
new KeyValuePair<string, object>("Path", dir.Name));
86+
87+
List<IListFileItem> fileList = new List<IListFileItem>();
88+
fileList.Add(dir);
89+
this.MockCmdRunTime.OutputPipeline.AssertListFileItems(fileList);
8990
}
9091

9192
[TestMethod]
9293
public void GetFileFromSubDirectoryTest_UsingShareNameWithPath()
9394
{
9495
var share = this.MockChannel.GetShareReference(ShareName);
9596
var dir = share.GetRootDirectoryReference().GetDirectoryReference("dir");
96-
var listItems = Enumerable.Range(0, 10).Select(x => dir.GetFileReference(string.Format("file{0}", x))).Cast<IListFileItem>()
97-
.Concat(Enumerable.Range(0, 5).Select(x => dir.GetDirectoryReference(string.Format("dir{0}", x)))).ToArray();
97+
this.MockChannel.SetsAvailableDirectories(dir.Name);
9898

99-
this.ListFilesAndAssertResults(
100-
() => this.CmdletInstance.RunCmdlet(
99+
this.CmdletInstance.RunCmdlet(
101100
Constants.ShareNameParameterSetName,
102101
new KeyValuePair<string, object>("ShareName", ShareName),
103-
new KeyValuePair<string, object>("Path", dir.Name)),
104-
listItems,
105-
dir);
102+
new KeyValuePair<string, object>("Path", dir.Name));
103+
104+
List<IListFileItem> fileList = new List<IListFileItem>();
105+
fileList.Add(dir);
106+
this.MockCmdRunTime.OutputPipeline.AssertListFileItems(fileList);
106107
}
107108

108109
[TestMethod]

src/Common/Storage/Commands.Storage.Test/Service/MockStorageFileManagement.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,26 @@ public void SetSharePermissions(CloudFileShare share, FileSharePermissions permi
171171

172172
public Task FetchFileAttributesAsync(CloudFile file, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken token)
173173
{
174-
throw new NotImplementedException();
174+
if (this.availableDirectoryNames.Contains(file.Name))
175+
{
176+
return TaskEx.FromResult(true);
177+
}
178+
else
179+
{
180+
throw new MockupException("FileNotFound");
181+
}
182+
}
183+
184+
public Task FetchDirectoryAttributesAsync(CloudFileDirectory directory, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken)
185+
{
186+
if (this.availableDirectoryNames.Contains(directory.Name))
187+
{
188+
return TaskEx.FromResult(true);
189+
}
190+
else
191+
{
192+
throw new MockupException("DirectoryNotFound");
193+
}
175194
}
176195

177196
public Task AbortCopyAsync(CloudFile file, string copyId, AccessCondition accessCondition, FileRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken)

0 commit comments

Comments
 (0)