Skip to content

Commit 8db5b3e

Browse files
authored
Merge branch 'preview' into athipp-pr
2 parents d428b7a + 69e474b commit 8db5b3e

File tree

143 files changed

+52030
-51109
lines changed

Some content is hidden

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

143 files changed

+52030
-51109
lines changed

src/Common/Commands.Common/DataCollectionController.cs

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,32 @@ public abstract class DataCollectionController
2626

2727
static AzurePSDataCollectionProfile Initialize(IAzureSession session)
2828
{
29-
AzurePSDataCollectionProfile result = new AzurePSDataCollectionProfile();
29+
AzurePSDataCollectionProfile result = new AzurePSDataCollectionProfile(true);
3030
try
3131
{
32-
var store = session.DataStore;
33-
string dataPath = Path.Combine(session.ProfileDirectory, AzurePSDataCollectionProfile.DefaultFileName);
34-
if (store.FileExists(dataPath))
32+
var environmentValue = Environment.GetEnvironmentVariable(AzurePSDataCollectionProfile.EnvironmentVariableName);
33+
bool enabled = true;
34+
if (!string.IsNullOrWhiteSpace(environmentValue) && bool.TryParse(environmentValue, out enabled))
3535
{
36-
string contents = store.ReadFileAsText(dataPath);
37-
var localResult = JsonConvert.DeserializeObject<AzurePSDataCollectionProfile>(contents);
38-
if (localResult != null && localResult.EnableAzureDataCollection.HasValue)
39-
{
40-
result = localResult;
41-
}
36+
result.EnableAzureDataCollection = enabled;
4237
}
4338
else
4439
{
45-
WritePSDataCollectionProfile(session, new AzurePSDataCollectionProfile(true));
40+
var store = session.DataStore;
41+
string dataPath = Path.Combine(session.ProfileDirectory, AzurePSDataCollectionProfile.DefaultFileName);
42+
if (store.FileExists(dataPath))
43+
{
44+
string contents = store.ReadFileAsText(dataPath);
45+
var localResult = JsonConvert.DeserializeObject<AzurePSDataCollectionProfile>(contents);
46+
if (localResult != null && localResult.EnableAzureDataCollection.HasValue)
47+
{
48+
result = localResult;
49+
}
50+
}
51+
else
52+
{
53+
WritePSDataCollectionProfile(session, new AzurePSDataCollectionProfile(true));
54+
}
4655
}
4756
}
4857
catch

src/ResourceManager/CognitiveServices/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21+
* Integrate with Cognitive Services Management SDK version 2.0.0.
22+
* Get-AzureRmCognitiveServicesAccount now can correctly support paging.
2123

2224
## Version 0.8.4
2325

src/ResourceManager/CognitiveServices/CognitiveServices.Test/Commands.Management.CognitiveServices.Test.csproj

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@
4949
<HintPath>..\..\..\packages\Microsoft.Azure.Gallery.2.6.2-preview\lib\net40\Microsoft.Azure.Gallery.dll</HintPath>
5050
</Reference>
5151
<Reference Include="Microsoft.Azure.Management.Authorization">
52-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.2.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
52+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.1.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
5353
</Reference>
54-
<Reference Include="Microsoft.Azure.Management.CognitiveServices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
55-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.CognitiveServices.1.0.0\lib\net452\Microsoft.Azure.Management.CognitiveServices.dll</HintPath>
54+
<Reference Include="Microsoft.Azure.Management.CognitiveServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
55+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.CognitiveServices.2.0.0\lib\net452\Microsoft.Azure.Management.CognitiveServices.dll</HintPath>
5656
</Reference>
5757
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
5858
<SpecificVersion>False</SpecificVersion>
@@ -175,6 +175,9 @@
175175
<None Include="SessionRecords\CognitiveServices.Test.ScenarioTests.CognitiveServicesAccountTests\TestGetAccounts.json">
176176
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
177177
</None>
178+
<None Include="SessionRecords\CognitiveServices.Test.ScenarioTests.CognitiveServicesAccountTests\TestGetWithPaging.json">
179+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
180+
</None>
178181
<None Include="SessionRecords\CognitiveServices.Test.ScenarioTests.CognitiveServicesAccountTests\TestMinMaxAccountNames.json">
179182
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
180183
</None>

src/ResourceManager/CognitiveServices/CognitiveServices.Test/ScenarioTests/CognitiveServicesAccountTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,12 @@ public void TestMinMaxAccountNames()
118118
{
119119
TestController.NewInstance.RunPsTest("Test-MinMaxAccountName");
120120
}
121+
122+
[Fact]
123+
[Trait(Category.AcceptanceType, Category.CheckIn)]
124+
public void TestGetWithPaging()
125+
{
126+
TestController.NewInstance.RunPsTest("Test-GetWithPaging");
127+
}
121128
}
122129
}

src/ResourceManager/CognitiveServices/CognitiveServices.Test/ScenarioTests/CognitiveServicesAccountTests.ps1

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,3 +462,43 @@ function Test-MinMaxAccountName
462462
}
463463
}
464464

465+
<#
466+
.SYNOPSIS
467+
Test Test-GetWithPaging
468+
#>
469+
function Test-GetWithPaging
470+
{
471+
# Setup
472+
$rgname = Get-CognitiveServicesManagementTestResourceName
473+
$loc = 'West US'
474+
475+
try
476+
{
477+
$TotalCount = 100
478+
# Test
479+
New-AzureRmResourceGroup -Name $rgname -Location $loc
480+
481+
# 100 Face
482+
For($i = 0; $i -lt $TotalCount ; $i++)
483+
{
484+
New-AzureRmCognitiveServicesAccount -ResourceGroupName $rgname -Name "facepaging_wu_$i" -Type 'Face' -SkuName 'S0' -Location $loc -Force;
485+
}
486+
487+
# 100 Emotion
488+
For($i = 0; $i -lt $TotalCount ; $i++)
489+
{
490+
New-AzureRmCognitiveServicesAccount -ResourceGroupName $rgname -Name "emotionpaging_wu_$i" -Type 'Emotion' -SkuName 'S0' -Location $loc -Force;
491+
}
492+
493+
$accounts = Get-AzureRmCognitiveServicesAccount
494+
Assert-AreEqual 200 $accounts.Count
495+
496+
$accounts = Get-AzureRmCognitiveServicesAccount -ResourceGroupName $rgname
497+
Assert-AreEqual 200 $accounts.Count
498+
}
499+
finally
500+
{
501+
# Cleanup
502+
Clean-ResourceGroup $rgname
503+
}
504+
}

0 commit comments

Comments
 (0)