Skip to content

Commit d1eab7f

Browse files
authored
Merge pull request #4113 from felixwa/CognitiveServices-PS-1.0.0
Cognitive Services PS 1.0.0
2 parents 17ae71b + f05a56f commit d1eab7f

23 files changed

+3069
-3600
lines changed

src/ResourceManager/CognitiveServices/ChangeLog.md

Lines changed: 3 additions & 1 deletion
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 1.0.0.
22+
* Fix an account name length checking bug.
2123

2224
## Version 0.8.0
2325
* Update detailed display of license agreements when creating Cognitive Services resources
@@ -38,4 +40,4 @@
3840

3941
## Version 0.4.2
4042

41-
## Version 0.4.1
43+
## Version 0.4.1

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\..\</SolutionDir>
1717
<RestorePackages>true</RestorePackages>
1818
<NuGetPackageImportStamp>f747f8a7</NuGetPackageImportStamp>
19+
<TargetFrameworkProfile />
1920
</PropertyGroup>
2021
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
2122
<DebugSymbols>true</DebugSymbols>
@@ -50,9 +51,8 @@
5051
<Reference Include="Microsoft.Azure.Management.Authorization">
5152
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.2.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
5253
</Reference>
53-
<Reference Include="Microsoft.Azure.Management.CognitiveServices, Version=0.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
54-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.CognitiveServices.0.2.1-preview\lib\net45\Microsoft.Azure.Management.CognitiveServices.dll</HintPath>
55-
<Private>True</Private>
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>
5656
</Reference>
5757
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
5858
<SpecificVersion>False</SpecificVersion>
@@ -62,8 +62,7 @@
6262
<HintPath>..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.6179.26854-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll</HintPath>
6363
</Reference>
6464
<Reference Include="Microsoft.Azure.Test.HttpRecorder, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
65-
<HintPath>..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.6.7-preview\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll</HintPath>
66-
<Private>True</Private>
65+
<HintPath>..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.8.1\lib\net452\Microsoft.Azure.Test.HttpRecorder.dll</HintPath>
6766
</Reference>
6867
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.28.3.860, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6968
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.28.3\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll</HintPath>
@@ -72,20 +71,16 @@
7271
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.28.3\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll</HintPath>
7372
</Reference>
7473
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
75-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.5\lib\net45\Microsoft.Rest.ClientRuntime.dll</HintPath>
76-
<Private>True</Private>
74+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.8\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
7775
</Reference>
7876
<Reference Include="Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
79-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.5\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
80-
<Private>True</Private>
77+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.7\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
8178
</Reference>
8279
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
83-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.2.9-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll</HintPath>
84-
<Private>True</Private>
80+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.3.0\lib\net452\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll</HintPath>
8581
</Reference>
86-
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.TestFramework">
87-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.TestFramework.1.5.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.TestFramework.dll</HintPath>
88-
<Private>True</Private>
82+
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.TestFramework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
83+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.TestFramework.1.7.2\lib\net452\Microsoft.Rest.ClientRuntime.Azure.TestFramework.dll</HintPath>
8984
</Reference>
9085
<Reference Include="Microsoft.Threading.Tasks">
9186
<HintPath>..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll</HintPath>
@@ -157,7 +152,9 @@
157152
</ProjectReference>
158153
</ItemGroup>
159154
<ItemGroup>
160-
<None Include="packages.config" />
155+
<None Include="packages.config">
156+
<SubType>Designer</SubType>
157+
</None>
161158
<None Include="ScenarioTests\Common.ps1">
162159
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
163160
</None>
@@ -176,6 +173,9 @@
176173
<None Include="SessionRecords\CognitiveServices.Test.ScenarioTests.CognitiveServicesAccountTests\TestGetAccounts.json">
177174
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
178175
</None>
176+
<None Include="SessionRecords\CognitiveServices.Test.ScenarioTests.CognitiveServicesAccountTests\TestMinMaxAccountNames.json">
177+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
178+
</None>
179179
<None Include="SessionRecords\CognitiveServices.Test.ScenarioTests.CognitiveServicesAccountTests\TestNewAccount.json">
180180
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
181181
</None>

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,12 @@ public void TestPipingToGetSkus()
111111
{
112112
TestController.NewInstance.RunPsTest("Test-PipingToGetAccountSkus");
113113
}
114+
115+
[Fact]
116+
[Trait(Category.AcceptanceType, Category.CheckIn)]
117+
public void TestMinMaxAccountNames()
118+
{
119+
TestController.NewInstance.RunPsTest("Test-MinMaxAccountName");
120+
}
114121
}
115122
}

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

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ Test Get-AzureRmCognitiveServicesAccount | Set-AzureRmCognitiveServicesAccount
363363
#>
364364
function Test-PipingToSetAzureAccount
365365
{
366-
# Setup
366+
# Setup
367367
$rgname = Get-CognitiveServicesManagementTestResourceName
368368

369369
try
@@ -398,7 +398,7 @@ Test Get-AzureRmCognitiveServicesAccount | Get-AzureRmCognitiveServicesAccountSk
398398
#>
399399
function Test-PipingToGetAccountSkus
400400
{
401-
# Setup
401+
# Setup
402402
$rgname = Get-CognitiveServicesManagementTestResourceName
403403

404404
try
@@ -428,3 +428,37 @@ function Test-PipingToGetAccountSkus
428428
}
429429
}
430430

431+
<#
432+
.SYNOPSIS
433+
Test New-AzureRmCognitiveServicesAccount
434+
#>
435+
function Test-MinMaxAccountName
436+
{
437+
# Setup
438+
$rgname = Get-CognitiveServicesManagementTestResourceName
439+
440+
try
441+
{
442+
# Test
443+
$shortname = 'aa';
444+
$longname = 'testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttest';
445+
$skuname = 'S2';
446+
$accounttype = 'TextAnalytics';
447+
$loc = 'West US';
448+
449+
New-AzureRmResourceGroup -Name $rgname -Location $loc;
450+
$shortaccount = New-AzureRmCognitiveServicesAccount -ResourceGroupName $rgname -Name $shortname -Type $accounttype -SkuName $skuname -Location $loc -Force;
451+
$longaccount = New-AzureRmCognitiveServicesAccount -ResourceGroupName $rgname -Name $longname -Type $accounttype -SkuName $skuname -Location $loc -Force;
452+
453+
Assert-AreEqual $shortname $shortaccount.AccountName;
454+
Assert-AreEqual $longname $longaccount.AccountName;
455+
456+
Retry-IfException { Remove-AzureRmCognitiveServicesAccount -ResourceGroupName $rgname -Name $accountname -Force; }
457+
}
458+
finally
459+
{
460+
# Cleanup
461+
Clean-ResourceGroup $rgname
462+
}
463+
}
464+

0 commit comments

Comments
 (0)