Skip to content

Commit 13eb57b

Browse files
committed
Changes for CR comments
1 parent bba1025 commit 13eb57b

File tree

6 files changed

+66
-57
lines changed

6 files changed

+66
-57
lines changed

src/ResourceManager/Sql/Commands.Sql.Test/Commands.Sql.Test.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,10 @@
207207
<None Include="ScenarioTests\ServerActiveDirectoryAdministratorTest.ps1">
208208
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
209209
</None>
210-
<None Include="ScenarioTests\ServerCommunicationLinkCrudTests.ps1" />
210+
<None Include="ScenarioTests\ServerCommunicationLinkCrudTests.ps1">
211+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
212+
213+
</None>
211214
<None Include="ScenarioTests\ServiceTierAdvisorTests.ps1">
212215
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
213216
</None>

src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/ServerCommunicationLinkCrudTests.ps1

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -13,88 +13,88 @@
1313
# ----------------------------------------------------------------------------------
1414

1515
<#
16-
.SYNOPSIS
17-
Tests creating a server communication link
16+
.SYNOPSIS
17+
Tests creating a server communication link
1818
#>
1919
function Test-CreateServerCommunicationLink
2020
{
21-
# Setup
21+
# Setup
2222
$rg = Create-ResourceGroupForTest
2323
$server = Create-ServerForTest $rg "Japan East"
2424
$server2 = Create-ServerForTest $rg "Japan East"
2525

26-
try
27-
{
26+
try
27+
{
2828
$linkName = Get-ElasticPoolName
2929
$ep1 = New-AzureRmSqlServerCommunicationLink -ServerName $server1.ServerName -ResourceGroupName $rg.ResourceGroupName `
3030
-LinkName $linkName -PartnerServer $server2.ServerName
3131

32-
Assert-NotNull $ep1
33-
Assert-AreEqual $server2.ServerName $ep1.PartnerServer
34-
}
35-
finally
36-
{
37-
Remove-ResourceGroupForTest $rg
38-
}
32+
Assert-NotNull $ep1
33+
Assert-AreEqual $server2.ServerName $ep1.PartnerServer
34+
}
35+
finally
36+
{
37+
Remove-ResourceGroupForTest $rg
38+
}
3939
}
4040

4141
<#
42-
.SYNOPSIS
43-
Tests getting a server communication link
42+
.SYNOPSIS
43+
Tests getting a server communication link
4444
#>
4545
function Test-GetServerCommunicationLink
4646
{
47-
# Setup
47+
# Setup
4848
$rg = Create-ResourceGroupForTest
4949
$server = Create-ServerForTest $rg "Japan East"
5050
$server2 = Create-ServerForTest $rg "Japan East"
5151

52-
$linkName = Get-ElasticPoolName
53-
$ep1 = New-AzureRmSqlServerCommunicationLink -ServerName $server1.ServerName -ResourceGroupName $rg.ResourceGroupName `
54-
-LinkName $linkName -PartnerServer $server2.ServerName
55-
Assert-NotNull $ep1
56-
57-
try
58-
{
59-
$gep1 = Get-AzureRmSqlServerCommunicationLink -ServerName $server1.ServerName -ResourceGroupName $rg.ResourceGroupName `
60-
-LinkName $ep1.LinkName
61-
Assert-NotNull $ep1
62-
Assert-AreEqual $server2.ServerName $ep1.PartnerServer
52+
$linkName = Get-ElasticPoolName
53+
$ep1 = New-AzureRmSqlServerCommunicationLink -ServerName $server1.ServerName -ResourceGroupName $rg.ResourceGroupName `
54+
-LinkName $linkName -PartnerServer $server2.ServerName
55+
Assert-NotNull $ep1
56+
57+
try
58+
{
59+
$gep1 = Get-AzureRmSqlServerCommunicationLink -ServerName $server1.ServerName -ResourceGroupName $rg.ResourceGroupName `
60+
-LinkName $ep1.LinkName
61+
Assert-NotNull $ep1
62+
Assert-AreEqual $server2.ServerName $ep1.PartnerServer
6363

64-
$all = $server | Get-AzureRmSqlServerCommunicationLink
65-
Assert-AreEqual $all.Count 1
66-
}
67-
finally
68-
{
69-
Remove-ResourceGroupForTest $rg
70-
}
64+
$all = $server | Get-AzureRmSqlServerCommunicationLink
65+
Assert-AreEqual $all.Count 1
66+
}
67+
finally
68+
{
69+
Remove-ResourceGroupForTest $rg
70+
}
7171
}
7272

7373
<#
74-
.SYNOPSIS
75-
Tests removing a server communication link
74+
.SYNOPSIS
75+
Tests removing a server communication link
7676
#>
7777
function Test-RemoveServerCommunicationLink
7878
{
79-
# Setup
79+
# Setup
8080
$rg = Create-ResourceGroupForTest
8181
$server1 = Create-ServerForTest $rg "Japan East"
8282
$server2 = Create-ServerForTest $rg "Japan East"
8383

84-
$linkName = Get-ElasticPoolName
85-
$ep1 = New-AzureRmSqlServerCommunicationLink -ServerName $server1.ServerName -ResourceGroupName $rg.ResourceGroupName `
86-
-LinkName $linkName -PartnerServer $server2.ServerName
87-
Assert-NotNull $ep1
88-
89-
try
90-
{
91-
Remove-AzureRmSqlServerCommunicationLink -ServerName $server1.ServerName -ResourceGroupName $rg.ResourceGroupName -LinkName $ep1.LinkName -Force
92-
93-
$all = $server | Get-AzureRmSqlServerCommunicationLink
94-
Assert-AreEqual $all.Count 0
95-
}
96-
finally
97-
{
98-
Remove-ResourceGroupForTest $rg
99-
}
84+
$linkName = Get-ElasticPoolName
85+
$ep1 = New-AzureRmSqlServerCommunicationLink -ServerName $server1.ServerName -ResourceGroupName $rg.ResourceGroupName `
86+
-LinkName $linkName -PartnerServer $server2.ServerName
87+
Assert-NotNull $ep1
88+
89+
try
90+
{
91+
Remove-AzureRmSqlServerCommunicationLink -ServerName $server1.ServerName -ResourceGroupName $rg.ResourceGroupName -LinkName $ep1.LinkName -Force
92+
93+
$all = $server | Get-AzureRmSqlServerCommunicationLink
94+
Assert-AreEqual $all.Count 0
95+
}
96+
finally
97+
{
98+
Remove-ResourceGroupForTest $rg
99+
}
100100
}

src/ResourceManager/Sql/Commands.Sql/Properties/Resources.resx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@
260260
</data>
261261
<data name="ServerCommunicationLinkNameExists" xml:space="preserve">
262262
<value>Server communication link with name: '{0}' already exists in server '{1}'.</value>
263+
</data>
263264
<data name="EmailsAreNotValid" xml:space="preserve">
264265
<value>One or more of the email addresses you entered are not valid.</value>
265266
</data>

src/ResourceManager/Sql/Commands.Sql/ServerCommunicationLink/Cmdlet/AzureSqlServerCommunicationLinkCmdletBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ public abstract class AzureSqlServerCommunicationLinkCmdletBase : AzureSqlCmdlet
3535
/// <summary>
3636
/// Initializes the adapter
3737
/// </summary>
38-
/// <param name="subscription"></param>
39-
/// <returns></returns>
38+
/// <param name="subscription">The subscription</param>
39+
/// <returns>Link adapter for ServerCommunicationLink</returns>
4040
protected override AzureSqlServerCommunicationLinkAdapter InitModelAdapter(Azure.Common.Authentication.Models.AzureSubscription subscription)
4141
{
4242
return new AzureSqlServerCommunicationLinkAdapter(DefaultProfile.Context);

src/ResourceManager/Sql/Commands.Sql/ServerCommunicationLink/Cmdlet/NewAzureSqlServerCommunicationLink.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,20 @@ protected override IEnumerable<AzureSqlServerCommunicationLinkModel> GetEntity()
8383
protected override IEnumerable<AzureSqlServerCommunicationLinkModel> ApplyUserInputToModel(IEnumerable<AzureSqlServerCommunicationLinkModel> model)
8484
{
8585
string location = ModelAdapter.GetServerLocation(ResourceGroupName, ServerName);
86+
87+
if (!MyInvocation.BoundParameters.ContainsKey("PartnerServer"))
88+
{
89+
throw new CmdletInvocationException("'PartnerServer' must be specified in the invocation of this cmdlet.");
90+
}
91+
8692
List<AzureSqlServerCommunicationLinkModel> newEntity = new List<AzureSqlServerCommunicationLinkModel>();
8793
newEntity.Add(new AzureSqlServerCommunicationLinkModel()
8894
{
8995
ResourceGroupName = ResourceGroupName,
9096
ServerName = ServerName,
9197
Location = location,
9298
Name = LinkName,
93-
PartnerServer = MyInvocation.BoundParameters.ContainsKey("PartnerServer") ? PartnerServer : null,
99+
PartnerServer = PartnerServer,
94100
});
95101
return newEntity;
96102
}

src/ResourceManager/Sql/Commands.Sql/ServerCommunicationLink/Services/AzureSqlServerCommunicationLinkAdapter.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ public void RemoveServerCommunicationLink(string resourceGroupName, string serve
118118
Communicator.Remove(resourceGroupName, serverName, communicationLinkName, Util.GenerateTracingId());
119119
}
120120

121-
122121
/// <summary>
123122
/// Gets the Location of the server.
124123
/// </summary>

0 commit comments

Comments
 (0)