Skip to content

Commit 3ffbfd5

Browse files
author
Jianghao Lu
committed
Fix ARM ScenarioTests.Common
1 parent d82db34 commit 3ffbfd5

File tree

9 files changed

+41
-111
lines changed

9 files changed

+41
-111
lines changed

src/Common/Commands.Common/ProfileClient.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace Microsoft.Azure.Common.Authentication
3232
/// </summary>
3333
public class ProfileClient
3434
{
35-
public AzureSMProfile Profile { get; private set; }
35+
public AzureRMProfile Profile { get; private set; }
3636

3737
public Action<string> WarningLog;
3838

@@ -129,12 +129,12 @@ private void UpgradeProfile()
129129
// In case that we changed a disk profile, reload it
130130
if (Profile != null && Profile.ProfilePath == newProfileFilePath)
131131
{
132-
Profile = new AzureSMProfile(Profile.ProfilePath);
132+
Profile = new AzureRMProfile(Profile.ProfilePath);
133133
}
134134
}
135135
}
136136

137-
public ProfileClient(AzureSMProfile profile)
137+
public ProfileClient(AzureRMProfile profile)
138138
{
139139
Profile = profile;
140140
WarningLog = (s) => Debug.WriteLine(s);
@@ -330,16 +330,16 @@ public AzureAccount AddAccountAndLoadSubscriptions(AzureAccount account, AzureEn
330330
AddOrSetSubscription(subscription);
331331
}
332332

333-
if (Profile.DefaultSubscription == null)
333+
if (Profile.DefaultContext.Subscription == null)
334334
{
335-
var firstSubscription = Profile.Subscriptions.Values.FirstOrDefault();
335+
var firstSubscription = Profile.DefaultContext.Subscription.Values.FirstOrDefault();
336336
if (firstSubscription != null)
337337
{
338338
SetSubscriptionAsDefault(firstSubscription.Name, firstSubscription.Account);
339339
}
340340
}
341341

342-
return Profile.Accounts[account.Id];
342+
return Profile.DefaultContext.Account;
343343
}
344344
else
345345
{

src/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,18 @@
167167
<Compile Include="..\Commands.Common\PowerShellUtilities.cs">
168168
<Link>Common\PowerShellUtilities.cs</Link>
169169
</Compile>
170+
<Compile Include="..\Commands.Common\ProfileClient.cs">
171+
<Link>Common\ProfileClient.cs</Link>
172+
</Compile>
173+
<Compile Include="..\Commands.Common\ProfileClientExtensions.cs">
174+
<Link>Common\ProfileClientExtensions.cs</Link>
175+
</Compile>
176+
<Compile Include="..\Commands.Common\PSAzureAccount.cs">
177+
<Link>Common\PSAzureAccount.cs</Link>
178+
</Compile>
179+
<Compile Include="..\Commands.Common\PublishSettingsImporter.cs">
180+
<Link>Common\PublishSettingsImporter.cs</Link>
181+
</Compile>
170182
<Compile Include="..\Commands.Common\RecordingTracingInterceptor.cs">
171183
<Link>Common\RecordingTracingInterceptor.cs</Link>
172184
</Compile>

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

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

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,7 @@ Select Y to enable data collection [Y/N]:</value>
145145
<data name="DataCollectionSaveFileInformation" xml:space="preserve">
146146
<value>The setting profile has been saved to the following path '{0}'.</value>
147147
</data>
148+
<data name="InvalidDefaultSubscription" xml:space="preserve">
149+
<value>No default subscription has been designated. Use Select-AzureSubscription -Default &lt;subscriptionName&gt; to set the default subscription.</value>
150+
</data>
148151
</root>

src/Common/Commands.ScenarioTests.ResourceManager.Common/Commands.ScenarioTests.ResourceManager.Common.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@
133133
<Compile Include="Mocks\MockCommandRuntime.cs" />
134134
<Compile Include="PSCmdletExtensions.cs" />
135135
<Compile Include="Constants.cs" />
136-
<Compile Include="EnvironmentSetupHelper.cs" />
137136
<Compile Include="Mocks\MockAccessToken.cs" />
138137
<Compile Include="Mocks\MockAccessTokenProvider.cs" />
139138
<Compile Include="Mocks\MockCertificateAuthenticationFactory.cs" />
@@ -143,7 +142,6 @@
143142
<Compile Include="PowerShellExtensions.cs" />
144143
<Compile Include="Properties\AssemblyInfo.cs" />
145144
<Compile Include="RMTestBase.cs" />
146-
<Compile Include="SMTestBase.cs" />
147145
</ItemGroup>
148146
<ItemGroup>
149147
<None Include="Assert.ps1">
@@ -155,10 +153,6 @@
155153
<None Include="packages.config" />
156154
</ItemGroup>
157155
<ItemGroup>
158-
<ProjectReference Include="..\Commands.Common\Commands.Common.csproj">
159-
<Project>{5ee72c53-1720-4309-b54b-5fb79703195f}</Project>
160-
<Name>Commands.Common</Name>
161-
</ProjectReference>
162156
<ProjectReference Include="..\Commands.ResourceManager.Common\Commands.ResourceManager.Common.csproj">
163157
<Project>{3819d8a7-c62c-4c47-8ddd-0332d9ce1252}</Project>
164158
<Name>Commands.ResourceManager.Common</Name>

src/Common/Commands.ScenarioTests.ResourceManager.Common/EnvironmentSetupHelper.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// ----------------------------------------------------------------------------------
1414

1515
using Microsoft.Azure;
16+
using Microsoft.Azure.Commands.ResourceManager.Common;
1617
using Microsoft.Azure.Common.Authentication;
1718
using Microsoft.Azure.Common.Authentication.Models;
1819
using Microsoft.Azure.Test;
@@ -50,8 +51,8 @@ public EnvironmentSetupHelper()
5051
{
5152
var datastore = new MemoryDataStore();
5253
AzureSession.DataStore = datastore;
53-
var profile = new AzureSMProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile));
54-
AzureSMCmdlet.CurrentProfile = profile;
54+
var profile = new AzureRMProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile));
55+
AzureRMCmdlet.DefaultProfile = profile;
5556
AzureSession.DataStore = datastore;
5657
ProfileClient = new ProfileClient(profile);
5758

src/Common/Commands.ScenarioTests.ResourceManager.Common/Mocks/MockClientFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public TClient CreateClient<TClient>(AzureSMProfile profile, AzureSubscription s
6666
{
6767
if (subscription == null)
6868
{
69-
throw new ArgumentException(Commands.Common.Properties.Resources.InvalidDefaultSubscription);
69+
throw new ArgumentException(Microsoft.Azure.Commands.ResourceManager.Common.Properties.Resources.InvalidDefaultSubscription);
7070
}
7171

7272
if (profile == null)

src/Common/Commands.ScenarioTests.ResourceManager.Common/SMTestBase.cs

Lines changed: 0 additions & 89 deletions
This file was deleted.

src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/GetAzureVMSqlServerExtensionCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ public class GetAzureVMSqlServerExtensionCommand : VirtualMachineExtensionBaseCm
5757
[ValidateNotNullOrEmpty]
5858
public string Name { get; set; }
5959

60-
public override void ExecuteCmdlet()
60+
protected override void ProcessRecord()
6161
{
62-
base.ExecuteCmdlet();
62+
base.ProcessRecord();
6363

6464
if (String.IsNullOrEmpty(Name))
6565
{

0 commit comments

Comments
 (0)