Skip to content

Commit 7398190

Browse files
committed
Merge pull request #323 from amarzavery/goli
fixing naveen's pr #315
2 parents e7f170f + 42733c1 commit 7398190

File tree

12 files changed

+943
-32
lines changed

12 files changed

+943
-32
lines changed

src/ResourceManager/Websites/Commands.Websites.Test/Commands.Websites.Test.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@
131131
<None Include="SessionRecords\Microsoft.Azure.Commands.WebApp.Test.ScenarioTests.WebAppTests\TestCreatesNewSimpleWebApp.json">
132132
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
133133
</None>
134+
<None Include="SessionRecords\Microsoft.Azure.Commands.WebApp.Test.ScenarioTests.WebAppTests\TestSetNewAppServicePlan.json">
135+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
136+
</None>
134137
</ItemGroup>
135138
<ItemGroup>
136139
<ProjectReference Include="..\..\..\Common\Commands.Common.Test\Commands.Common.Test.csproj">

src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/Common.ps1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Gets a website name for testing.
1818
#>
1919
function Get-WebsiteName
2020
{
21-
# need to remove hardcoding
2221
return getAssetName
2322
}
2423

@@ -28,7 +27,6 @@ Gets a website name for testing.
2827
#>
2928
function Get-WebHostPlanName
3029
{
31-
# need to remove hardcoding
3230
return getAssetName
3331
}
3432

src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/WebAppTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,12 @@ public void TestCreatesNewAppServicePlan()
3333
{
3434
WebsitesController.NewInstance.RunPsTest("Test-CreatesNewAppServicePlan");
3535
}
36+
37+
[Fact]
38+
[Trait(Category.AcceptanceType, Category.CheckIn)]
39+
public void TestSetNewAppServicePlan()
40+
{
41+
WebsitesController.NewInstance.RunPsTest("Test-SetNewAppServicePlan");
42+
}
3643
}
3744
}

src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/WebAppTests.ps1

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,47 @@ function Test-CreatesNewAppServicePlan
7878
Remove-AzureAppServicePlan -ResourceGroupName $rgname -Name $whpName -Force
7979
Remove-AzureResourceGroup -Name $rgname -Force
8080
}
81+
}
82+
83+
<#
84+
.SYNOPSIS
85+
Tests creating a new Web Hosting Plan.
86+
#>
87+
function Test-SetNewAppServicePlan
88+
{
89+
# Setup
90+
$rgname = Get-ResourceGroupName
91+
$whpName = Get-WebHostPlanName
92+
$location = Get-Location
93+
94+
try
95+
{
96+
#Setup
97+
New-AzureResourceGroup -Name $rgname -Location $location
98+
# Test
99+
$actual = New-AzureAppServicePlan -ResourceGroupName $rgname -Name $whpName -Location $location
100+
$result = Get-AzureAppServicePlan -ResourceGroupName $rgname -Name $whpName
101+
# Assert
102+
Assert-AreEqual $whpName $result.WebHostingPlan.Name
103+
Assert-AreEqual 1 $result.WebHostingPlan.Properties.NumberOfWorkers
104+
Assert-AreEqual "Standard" $result.WebHostingPlan.Properties.Sku
105+
Assert-AreEqual "Small" $result.WebHostingPlan.Properties.WorkerSize
106+
107+
# Test setting the created service plan
108+
$newresult = Set-AzureAppServicePlan -ResourceGroupName $rgname -Name $whpName -Location $location -Sku Premium -NumberofWorkers 12 -WorkerSize Medium
109+
# due to a bug Set and New are not returning the appropriate object so need to get.
110+
$newresult = Get-AzureAppServicePlan -ResourceGroupName $rgname -Name $whpName
111+
112+
# Assert
113+
Assert-AreEqual $whpName $result.WebHostingPlan.Name
114+
Assert-AreEqual 12 $newresult.WebHostingPlan.Properties.NumberOfWorkers
115+
Assert-AreEqual "Premium" $newresult.WebHostingPlan.Properties.Sku
116+
Assert-AreEqual "Medium" $newresult.WebHostingPlan.Properties.WorkerSize
117+
}
118+
finally
119+
{
120+
# Cleanup
121+
Remove-AzureAppServicePlan -ResourceGroupName $rgname -Name $whpName -Force
122+
Remove-AzureResourceGroup -Name $rgname -Force
123+
}
81124
}

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.WebApp.Test.ScenarioTests.WebAppTests/TestSetNewAppServicePlan.json

Lines changed: 862 additions & 0 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites/Cmdlets/AppServicePlan/GetAzureAppServicePlan.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ public override void ExecuteCmdlet()
5656

5757
private void GetByWebHostingPlan()
5858
{
59-
WriteObject(WebsitesClient.GetWebHostingPlan(ResourceGroupName, Name));
59+
WriteObject(WebsitesClient.GetAppServicePlan(ResourceGroupName, Name));
6060
}
6161

6262
private void GetByResourceGroup()
6363
{
64-
WriteObject(WebsitesClient.ListWebHostingPlan(ResourceGroupName));
64+
WriteObject(WebsitesClient.ListAppServicePlan(ResourceGroupName));
6565
}
6666
}
6767
}

src/ResourceManager/Websites/Commands.Websites/Cmdlets/AppServicePlan/NewAzureAppServicePlan.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public override void ExecuteCmdlet()
116116
}
117117
}
118118

119-
WriteObject(WebsitesClient.CreateWebHostingPlan(ResourceGroupName, Name, Location, adminSiteName, NumberofWorkers, skuInput, workerSizeInput));
119+
WriteObject(WebsitesClient.CreateAppServicePlan(ResourceGroupName, Name, Location, adminSiteName, NumberofWorkers, skuInput, workerSizeInput));
120120

121121
}
122122

src/ResourceManager/Websites/Commands.Websites/Cmdlets/AppServicePlan/RemoveAppServicePlan.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ public override void ExecuteCmdlet()
4848
{
4949
ConfirmAction(
5050
Force.IsPresent,
51-
string.Format(Microsoft.Azure.Commands.WebApp.Properties.Resources.RemovingWebHostPlan, Name),
52-
Microsoft.Azure.Commands.WebApp.Properties.Resources.RemovingWebHostPlan,
51+
string.Format(Microsoft.Azure.Commands.WebApp.Properties.Resources.RemovingAppServicePlan, Name),
52+
Microsoft.Azure.Commands.WebApp.Properties.Resources.RemovingAppServicePlan,
5353
Name,
54-
() => WebsitesClient.RemoveWebHostingPlan(ResourceGroupName, Name));
54+
() => WebsitesClient.RemoveAppServicePlan(ResourceGroupName, Name));
5555
}
5656
}
5757
}

src/ResourceManager/Websites/Commands.Websites/Cmdlets/AppServicePlan/SetAzureAppServicePlan.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public override void ExecuteCmdlet()
115115
}
116116
}
117117

118-
WriteObject(WebsitesClient.CreateWebHostingPlan(ResourceGroupName, Name, Location, adminSiteName, NumberofWorkers, skuInput, workerSizeInput));
118+
WriteObject(WebsitesClient.CreateAppServicePlan(ResourceGroupName, Name, Location, adminSiteName, NumberofWorkers, skuInput, workerSizeInput));
119119

120120
}
121121

src/ResourceManager/Websites/Commands.Websites/Properties/Resources.Designer.cs

Lines changed: 12 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)