Skip to content

Commit d41757e

Browse files
authored
Merge pull request Azure#3099 from AuxMon/dev
Using new Swagger spec for the SDK, avoiding breaking changes, and adding deprecation messages for future changes
2 parents 0e5e6a7 + 9ff3450 commit d41757e

File tree

179 files changed

+11503
-2865
lines changed

Some content is hidden

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

179 files changed

+11503
-2865
lines changed

AzurePowershell.Test.targets

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
<ServiceManagementTestDebug>.\src\ServiceManagement\Compute\Commands.ServiceManagement.Test\bin\Debug\Microsoft.WindowsAzure.Commands.ServiceManagement.Test.dll</ServiceManagementTestDebug>
3232
<SqlDatabaseTestDebug>.\src\ServiceManagement\Sql\Commands.SqlDatabase.Test\bin\Debug\Microsoft.WindowsAzure.Commands.SqlDatabase.Test.dll</SqlDatabaseTestDebug>
3333
<HDInsightTestDebug>.\src\ServiceManagement\HDInsight\Commands.HDInsight.Test\bin\Debug\Microsoft.WindowsAzure.Commands.HDInsight.Test.dll</HDInsightTestDebug>
34+
<InsightsTestDebug>.\src\ResourceManager\Insights\Commands.Insights.Test\bin\Debug\Microsoft.Azure.Commands.Insights.Test.dll</InsightsTestDebug>
3435
<StorageTestDebug>.\src\Storage\Commands.Storage.Test\bin\Debug\Microsoft.WindowsAzure.Commands.Storage.Test.dll</StorageTestDebug>
3536
<KeyVaultTestDebug>.\src\ResourceManager\KeyVault\Commands.KeyVault.Test\bin\Debug\Microsoft.Azure.Commands.KeyVault.Test.dll</KeyVaultTestDebug>
3637
<DataLakeAnalyticsTestDebug>.\src\ResourceManager\DataLakeAnalytics\Commands.DataLakeAnalytics.Test\bin\Debug\Microsoft.Azure.Commands.DataLakeAnalytics.Test.dll</DataLakeAnalyticsTestDebug>
@@ -83,7 +84,7 @@
8384
<!-- <XUnitTests Include=".\src\ResourceManager\DevTestLabs\Commands.DevTestLabs.Test\bin\Debug\Microsoft.Azure.Commands.DevTestLabs.Test.dll"/> -->
8485
<XUnitTests Include=".\src\ResourceManager\Dns\Commands.Dns.Test\bin\Debug\Microsoft.Azure.Commands.Dns.Test.dll"/>
8586
<XUnitTests Include=".\src\ResourceManager\HDInsight\Commands.HDInsight.Test\bin\Debug\Commands.HDInsight.Test.dll"/>
86-
<!-- <XUnitTests Include=".\src\ResourceManager\Insights\Commands.Insights.Test\bin\Debug\Microsoft.Azure.Commands.Insights.Test.dll"/> -->
87+
<XUnitTests Include=".\src\ResourceManager\Insights\Commands.Insights.Test\bin\Debug\Microsoft.Azure.Commands.Insights.Test.dll"/>
8788
<XUnitTests Include=".\src\ResourceManager\KeyVault\Commands.KeyVault.Test\bin\Debug\Microsoft.Azure.Commands.KeyVault.Test.dll"/>
8889
<XUnitTests Include=".\src\ResourceManager\LogicApp\Commands.LogicApp.Test\bin\Debug\Microsoft.Azure.Commands.LogicApp.Test.dll"/>
8990
<XUnitTests Include=".\src\ResourceManager\Network\Commands.Network.Test\bin\Debug\Microsoft.Azure.Commands.Network.Test.dll"/>
@@ -246,6 +247,12 @@
246247
Projects="build.proj"/>
247248
</Target>
248249

250+
<Target Name="TestInsights">
251+
<MSBuild Targets="InvokeMSTest"
252+
Properties="_testAssembly=$(InsightsTestDebug);_testSettings=$(TestSettings);_testFilter=$(TestFilter);_testResult=$(TestOutputDirectory)\InsightsDebug.trx"
253+
Projects="build.proj"/>
254+
</Target>
255+
249256
<Target Name="TestStorage">
250257
<MSBuild Targets="InvokeMSTest"
251258
Properties="_testAssembly=$(StorageTestDebug);_testSettings=$(TestSettings);_testFilter=$(TestFilter);_testResult=$(TestOutputDirectory)\StorageDebug.trx"

setup/azurecmdfiles.wxi

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,9 +1266,6 @@
12661266
<Component Id="cmpAB0BE651457D19885EE5BD5615E283A9" Guid="*">
12671267
<File Id="fil7C8081F59D42A001771050D89E11D7CB" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.Insights\Microsoft.Azure.KeyVault.Core.dll" />
12681268
</Component>
1269-
<Component Id="cmpFB65291F937077CCA80689CFC3727B1A" Guid="*">
1270-
<File Id="fil87446160E4B0238E50AB62B792E935C1" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.Insights\Microsoft.Azure.ResourceManager.dll" />
1271-
</Component>
12721269
<Component Id="cmpBE9F3609F315D89DE19004AC7E629A12" Guid="*">
12731270
<File Id="filFED788047F438C9397D43C0F1F5AA7A6" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.Insights\Microsoft.Data.Edm.dll" />
12741271
</Component>
@@ -1281,12 +1278,12 @@
12811278
<Component Id="cmpC9466F4B506234EBA66C4F1204C0CD5D" Guid="*">
12821279
<File Id="fil923B64CC593E3BC837C3F9B6227E8342" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.Insights\Microsoft.IdentityModel.Clients.ActiveDirectory.dll" />
12831280
</Component>
1284-
<Component Id="cmp734CB1D0853F1EC3CC1EA7E5A0C5D408" Guid="*">
1285-
<File Id="filD8501C838DFEE91793C98002F926B62D" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.Insights\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll" />
1286-
</Component>
12871281
<Component Id="cmpFC33C3BBB9DE3FDA41AAC3F0C1652F45" Guid="*">
12881282
<File Id="fil0BC58752DC9792178625EA842D496953" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.Insights\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll" />
12891283
</Component>
1284+
<Component Id="cmpDE07060F7C404EB0947D0711C6A05ABA" Guid="*">
1285+
<File Id="fil7F437FF8C0784CA7B8438C683AE09BC4" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.Insights\Microsoft.Rest.ClientRuntime.Azure.dll" />
1286+
</Component>
12901287
<Component Id="cmpE0A4360ECC0B00A74E3D29F280B2FD2E" Guid="*">
12911288
<File Id="fil1FB9B7667782F24EAC7BB0B862A44410" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.Insights\Microsoft.Rest.ClientRuntime.dll" />
12921289
</Component>
@@ -5865,13 +5862,12 @@
58655862
<ComponentRef Id="cmp652574B007D36760A8F3951C8BBCBA73" />
58665863
<ComponentRef Id="cmp19A1422310791548B2EE9CC01D0E80AB" />
58675864
<ComponentRef Id="cmpAB0BE651457D19885EE5BD5615E283A9" />
5868-
<ComponentRef Id="cmpFB65291F937077CCA80689CFC3727B1A" />
58695865
<ComponentRef Id="cmpBE9F3609F315D89DE19004AC7E629A12" />
58705866
<ComponentRef Id="cmp45E9D11A1E7E15837ADBF6220B8DFD7E" />
58715867
<ComponentRef Id="cmp95FB8932F45A41F4AF974FB6F565B75C" />
58725868
<ComponentRef Id="cmpC9466F4B506234EBA66C4F1204C0CD5D" />
5873-
<ComponentRef Id="cmp734CB1D0853F1EC3CC1EA7E5A0C5D408" />
58745869
<ComponentRef Id="cmpFC33C3BBB9DE3FDA41AAC3F0C1652F45" />
5870+
<ComponentRef Id="cmpDE07060F7C404EB0947D0711C6A05ABA" />
58755871
<ComponentRef Id="cmpE0A4360ECC0B00A74E3D29F280B2FD2E" />
58765872
<ComponentRef Id="cmpE2B4EA9CCA75508B10345C79226A99BF" />
58775873
<ComponentRef Id="cmp545597FAE11FE5F91F4BDCD56D1DFE83" />

src/ResourceManager/Insights/Commands.Insights.Test/Alerts/AddAzureRmLogAlertRuleTests.cs

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
using Microsoft.Azure.Commands.Insights.Alerts;
1616
using Microsoft.Azure.Management.Insights;
1717
using Microsoft.Azure.Management.Insights.Models;
18-
using Microsoft.Azure.ServiceManagemenet.Common.Models;
1918
using Microsoft.WindowsAzure.Commands.ScenarioTest;
2019
using Moq;
2120
using System;
@@ -33,16 +32,16 @@ public class AddAzureRmLogAlertRuleTests
3332
{
3433
private readonly AddAzureRmLogAlertRuleCommand cmdlet;
3534
private readonly Mock<InsightsManagementClient> insightsManagementClientMock;
36-
private readonly Mock<IAlertOperations> insightsAlertRuleOperationsMock;
35+
private readonly Mock<IAlertRulesOperations> insightsAlertRuleOperationsMock;
3736
private Mock<ICommandRuntime> commandRuntimeMock;
38-
private AzureOperationResponse response;
37+
private Rest.Azure.AzureOperationResponse<AlertRuleResource> response;
3938
private string resourceGroup;
40-
private RuleCreateOrUpdateParameters createOrUpdatePrms;
39+
private AlertRuleResource createOrUpdatePrms;
4140

4241
public AddAzureRmLogAlertRuleTests(ITestOutputHelper output)
4342
{
44-
XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output));
45-
insightsAlertRuleOperationsMock = new Mock<IAlertOperations>();
43+
// XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output));
44+
insightsAlertRuleOperationsMock = new Mock<IAlertRulesOperations>();
4645
insightsManagementClientMock = new Mock<InsightsManagementClient>();
4746
commandRuntimeMock = new Mock<ICommandRuntime>();
4847
cmdlet = new AddAzureRmLogAlertRuleCommand()
@@ -51,21 +50,21 @@ public AddAzureRmLogAlertRuleTests(ITestOutputHelper output)
5150
InsightsManagementClient = insightsManagementClientMock.Object
5251
};
5352

54-
response = new AzureOperationResponse()
53+
AlertRuleResource alertRuleResourceInput = new AlertRuleResource(location: null, isEnabled: true, alertRuleResourceName: "a name");
54+
response = new Rest.Azure.AzureOperationResponse<AlertRuleResource>()
5555
{
56-
RequestId = Guid.NewGuid().ToString(),
57-
StatusCode = HttpStatusCode.OK,
56+
Body = alertRuleResourceInput
5857
};
5958

60-
insightsAlertRuleOperationsMock.Setup(f => f.CreateOrUpdateRuleAsync(It.IsAny<string>(), It.IsAny<RuleCreateOrUpdateParameters>(), It.IsAny<CancellationToken>()))
61-
.Returns(Task.FromResult<AzureOperationResponse>(response))
62-
.Callback((string resourceGrp, RuleCreateOrUpdateParameters createOrUpdateParams, CancellationToken t) =>
59+
insightsAlertRuleOperationsMock.Setup(f => f.CreateOrUpdateWithHttpMessagesAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<AlertRuleResource>(), It.IsAny<Dictionary<string, List<string>>>(), It.IsAny<CancellationToken>()))
60+
.Returns(Task.FromResult<Rest.Azure.AzureOperationResponse<AlertRuleResource>>(response))
61+
.Callback((string resourceGrp, string name, AlertRuleResource createOrUpdateParams, Dictionary<string, List<string>> headers, CancellationToken t) =>
6362
{
6463
resourceGroup = resourceGrp;
6564
createOrUpdatePrms = createOrUpdateParams;
6665
});
6766

68-
insightsManagementClientMock.SetupGet(f => f.AlertOperations).Returns(this.insightsAlertRuleOperationsMock.Object);
67+
insightsManagementClientMock.SetupGet(f => f.AlertRules).Returns(this.insightsAlertRuleOperationsMock.Object);
6968
}
7069

7170
[Fact]
@@ -170,16 +169,16 @@ int actionsCount
170169

171170
if (actionsNull)
172171
{
173-
Assert.Null(this.createOrUpdatePrms.Properties.Actions);
172+
Assert.Null(this.createOrUpdatePrms.Actions);
174173
}
175174
else
176175
{
177-
Assert.NotNull(this.createOrUpdatePrms.Properties.Actions);
178-
Assert.Equal(actionsCount, this.createOrUpdatePrms.Properties.Actions.Count);
176+
Assert.NotNull(this.createOrUpdatePrms.Actions);
177+
Assert.Equal(actionsCount, this.createOrUpdatePrms.Actions.Count);
179178
}
180179

181-
Assert.Equal(Utilities.Name, this.createOrUpdatePrms.Properties.Name);
182-
Assert.Equal(isEnabled, this.createOrUpdatePrms.Properties.IsEnabled);
180+
Assert.Equal(Utilities.Name, this.createOrUpdatePrms.AlertRuleResourceName);
181+
Assert.Equal(isEnabled, this.createOrUpdatePrms.IsEnabled);
183182
}
184183
}
185184
}

src/ResourceManager/Insights/Commands.Insights.Test/Alerts/AddAzureRmMetricAlertRuleTests.cs

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
using Microsoft.Azure.Commands.Insights.Alerts;
1616
using Microsoft.Azure.Management.Insights;
1717
using Microsoft.Azure.Management.Insights.Models;
18-
using Microsoft.Azure.ServiceManagemenet.Common.Models;
1918
using Microsoft.WindowsAzure.Commands.ScenarioTest;
2019
using Moq;
2120
using System;
@@ -33,16 +32,16 @@ public class AddAzureRmMetricAlertRuleTests
3332
{
3433
private readonly AddAzureRmMetricAlertRuleCommand cmdlet;
3534
private readonly Mock<InsightsManagementClient> insightsManagementClientMock;
36-
private readonly Mock<IAlertOperations> insightsAlertRuleOperationsMock;
35+
private readonly Mock<IAlertRulesOperations> insightsAlertRuleOperationsMock;
3736
private Mock<ICommandRuntime> commandRuntimeMock;
38-
private AzureOperationResponse response;
37+
private Rest.Azure.AzureOperationResponse<AlertRuleResource> response;
3938
private string resourceGroup;
40-
private RuleCreateOrUpdateParameters createOrUpdatePrms;
39+
private AlertRuleResource alertRuleResource;
4140

4241
public AddAzureRmMetricAlertRuleTests(ITestOutputHelper output)
4342
{
44-
XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output));
45-
insightsAlertRuleOperationsMock = new Mock<IAlertOperations>();
43+
//XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output));
44+
insightsAlertRuleOperationsMock = new Mock<IAlertRulesOperations>();
4645
insightsManagementClientMock = new Mock<InsightsManagementClient>();
4746
commandRuntimeMock = new Mock<ICommandRuntime>();
4847
cmdlet = new AddAzureRmMetricAlertRuleCommand()
@@ -51,21 +50,21 @@ public AddAzureRmMetricAlertRuleTests(ITestOutputHelper output)
5150
InsightsManagementClient = insightsManagementClientMock.Object
5251
};
5352

54-
response = new AzureOperationResponse()
53+
AlertRuleResource alertRuleResourceInput = new AlertRuleResource(alertRuleResourceName: "a name", location: null, isEnabled: true);
54+
response = new Rest.Azure.AzureOperationResponse<AlertRuleResource>()
5555
{
56-
RequestId = Guid.NewGuid().ToString(),
57-
StatusCode = HttpStatusCode.OK,
56+
Body = alertRuleResourceInput
5857
};
5958

60-
insightsAlertRuleOperationsMock.Setup(f => f.CreateOrUpdateRuleAsync(It.IsAny<string>(), It.IsAny<RuleCreateOrUpdateParameters>(), It.IsAny<CancellationToken>()))
61-
.Returns(Task.FromResult<AzureOperationResponse>(response))
62-
.Callback((string resourceGrp, RuleCreateOrUpdateParameters createOrUpdateParams, CancellationToken t) =>
59+
insightsAlertRuleOperationsMock.Setup(f => f.CreateOrUpdateWithHttpMessagesAsync(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<AlertRuleResource>(), It.IsAny<Dictionary<string, List<string>>>(), It.IsAny<CancellationToken>()))
60+
.Returns(Task.FromResult<Rest.Azure.AzureOperationResponse<AlertRuleResource>>(response))
61+
.Callback((string resourceGrp, string name, AlertRuleResource alertRuleResourceIn, Dictionary<string, List<string>> headers, CancellationToken t) =>
6362
{
6463
resourceGroup = resourceGrp;
65-
createOrUpdatePrms = createOrUpdateParams;
64+
alertRuleResource = alertRuleResourceIn;
6665
});
6766

68-
insightsManagementClientMock.SetupGet(f => f.AlertOperations).Returns(this.insightsAlertRuleOperationsMock.Object);
67+
insightsManagementClientMock.SetupGet(f => f.AlertRules).Returns(this.insightsAlertRuleOperationsMock.Object);
6968
}
7069

7170
[Fact]
@@ -221,38 +220,37 @@ private void AssertResult(
221220
string resourceUri)
222221
{
223222
Assert.Equal(Utilities.ResourceGroup, this.resourceGroup);
224-
Assert.Equal(location, this.createOrUpdatePrms.Location);
225-
Assert.True(this.createOrUpdatePrms.Tags.ContainsKey(tagsKey));
223+
Assert.Equal(location, this.alertRuleResource.Location);
224+
Assert.True(this.alertRuleResource.Tags.ContainsKey(tagsKey));
226225

227-
Assert.NotNull(this.createOrUpdatePrms);
226+
Assert.NotNull(this.alertRuleResource);
228227

229228
if (actionsNull)
230229
{
231-
Assert.Null(this.createOrUpdatePrms.Properties.Actions);
230+
Assert.Null(this.alertRuleResource.Actions);
232231
}
233232
else
234233
{
235-
Assert.NotNull(this.createOrUpdatePrms.Properties.Actions);
236-
Assert.Equal(actionsCount, this.createOrUpdatePrms.Properties.Actions.Count);
234+
Assert.NotNull(this.alertRuleResource.Actions);
235+
Assert.Equal(actionsCount, this.alertRuleResource.Actions.Count);
237236
}
238237

239-
Assert.Equal(Utilities.Name, this.createOrUpdatePrms.Properties.Name);
240-
Assert.Equal(isEnabled, this.createOrUpdatePrms.Properties.IsEnabled);
238+
Assert.Equal(Utilities.Name, this.alertRuleResource.AlertRuleResourceName);
239+
Assert.Equal(isEnabled, this.alertRuleResource.IsEnabled);
241240

242-
Assert.True(this.createOrUpdatePrms.Properties.Condition is ThresholdRuleCondition);
241+
Assert.True(this.alertRuleResource.Condition is ThresholdRuleCondition);
243242

244-
var condition = this.createOrUpdatePrms.Properties.Condition as ThresholdRuleCondition;
243+
var condition = this.alertRuleResource.Condition as ThresholdRuleCondition;
245244
Assert.Equal(threshold, condition.Threshold);
246-
Assert.Equal(conditionOperator, condition.Operator);
247-
Assert.Equal(totalMinutes, condition.WindowSize.TotalMinutes);
245+
Assert.Equal(conditionOperator, condition.OperatorProperty);
246+
Assert.Equal(totalMinutes, ((TimeSpan)condition.WindowSize).TotalMinutes);
248247
Assert.Equal(timeAggregationOperator, condition.TimeAggregation);
249248

250249
Assert.True(condition.DataSource is RuleMetricDataSource);
251250

252251
var dataSource = condition.DataSource as RuleMetricDataSource;
253252
Assert.Equal(metricName, dataSource.MetricName);
254253
Assert.Equal(resourceUri, dataSource.ResourceUri);
255-
Assert.Null(dataSource.MetricNamespace);
256254
}
257255
}
258256
}

0 commit comments

Comments
 (0)